diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-09-28 22:36:56 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-09-28 22:36:56 +0000 |
commit | 4edab1a9e8fd28a60b2d09cc38333652155c0a20 (patch) | |
tree | d9e224fede3bbbdee61427acdf97d280b812a6d8 | |
parent | f53458f693fcf813b4c6c785034141017bf35893 (diff) | |
download | external_llvm-4edab1a9e8fd28a60b2d09cc38333652155c0a20.zip external_llvm-4edab1a9e8fd28a60b2d09cc38333652155c0a20.tar.gz external_llvm-4edab1a9e8fd28a60b2d09cc38333652155c0a20.tar.bz2 |
Fix a FIXME. _foo.eh symbols are currently always exported so that the linker
knows about them. This is not necessary on 10.6 and later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114997 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 18 | ||||
-rw-r--r-- | test/CodeGen/X86/non-globl-eh-frame.ll | 24 |
2 files changed, 29 insertions, 13 deletions
diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 4afdc3d..0f36d42 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -444,27 +444,19 @@ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx, const TargetMachine &TM) { - // _foo.eh symbols are currently always exported so that the linker knows - // about them. This is not necessary on 10.6 and later, but it - // doesn't hurt anything. - // FIXME: I need to get this from Triple. IsFunctionEHSymbolGlobal = true; IsFunctionEHFrameSymbolPrivate = false; SupportsWeakOmittedEHFrame = false; Triple T(((LLVMTargetMachine&)TM).getTargetTriple()); if (T.getOS() == Triple::Darwin) { - switch (T.getDarwinMajorNumber()) { - case 7: // 10.3 Panther. - case 8: // 10.4 Tiger. + unsigned MajNum = T.getDarwinMajorNumber(); + if (MajNum == 7 || MajNum == 8) // 10.3 Panther, 10.4 Tiger CommDirectiveSupportsAlignment = false; - break; - case 9: // 10.5 Leopard. - case 10: // 10.6 SnowLeopard. - break; - } + if (MajNum > 9) // 10.6 SnowLeopard + IsFunctionEHSymbolGlobal = false; } - + TargetLoweringObjectFile::Initialize(Ctx, TM); TextSection // .text diff --git a/test/CodeGen/X86/non-globl-eh-frame.ll b/test/CodeGen/X86/non-globl-eh-frame.ll new file mode 100644 index 0000000..71349ec --- /dev/null +++ b/test/CodeGen/X86/non-globl-eh-frame.ll @@ -0,0 +1,24 @@ +; RUN: llc < %s -mtriple x86_64-apple-darwin10 -march x86 | not grep {{.globl\[\[:space:\]\]*__Z4funcv.eh}} +; RUN: llc < %s -mtriple x86_64-apple-darwin9 -march x86 | FileCheck %s -check-prefix=DARWIN9 + +%struct.__pointer_type_info_pseudo = type { %struct.__type_info_pseudo, i32, %"struct.std::type_info"* } +%struct.__type_info_pseudo = type { i8*, i8* } +%"struct.std::type_info" = type opaque + +@.str = private constant [12 x i8] c"hello world\00", align 1 +@_ZTIPc = external constant %struct.__pointer_type_info_pseudo + +define void @_Z4funcv() noreturn optsize ssp { +entry: + %0 = tail call i8* @__cxa_allocate_exception(i64 8) nounwind + %1 = bitcast i8* %0 to i8** + store i8* getelementptr inbounds ([12 x i8]* @.str, i64 0, i64 0), i8** %1, align 8 + tail call void @__cxa_throw(i8* %0, i8* bitcast (%struct.__pointer_type_info_pseudo* @_ZTIPc to i8*), void (i8*)* null) noreturn + unreachable +} + +; DARWIN9: .globl __Z4funcv.eh + +declare i8* @__cxa_allocate_exception(i64) nounwind + +declare void @__cxa_throw(i8*, i8*, void (i8*)*) noreturn |