diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-06-14 20:11:56 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-06-14 20:11:56 +0000 |
| commit | faa7bdccbfad3ca4d40039f229832f86de6aae93 (patch) | |
| tree | 6b3d8bf181d57e763676c57104f0b295af49afdb | |
| parent | bbb798c7d17f91f1d7a78623ede006072a9e2904 (diff) | |
| download | bcm5719-llvm-faa7bdccbfad3ca4d40039f229832f86de6aae93.tar.gz bcm5719-llvm-faa7bdccbfad3ca4d40039f229832f86de6aae93.zip | |
fix a nasty bug where we were not treating available_externally
symbols as declarations in the X86 backend. This would manifest
on darwin x86-32 as errors like this with -fvisibility=hidden:
symbol '__ZNSbIcED1Ev' can not be undefined in a subtraction expression
This fixes PR7353.
llvm-svn: 105954
| -rw-r--r-- | llvm/lib/Target/X86/X86Subtarget.cpp | 9 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/hidden-vis-pic.ll | 25 |
2 files changed, 31 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index 4012b50e53a..6eda20dd0c4 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -53,9 +53,12 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const { if (GV->hasDLLImportLinkage()) return X86II::MO_DLLIMPORT; - // Materializable GVs (in JIT lazy compilation mode) do not require an - // extra load from stub. - bool isDecl = GV->isDeclaration() && !GV->isMaterializable(); + // Determine whether this is a reference to a definition or a declaration. + // Materializable GVs (in JIT lazy compilation mode) do not require an extra + // load from stub. + bool isDecl = GV->hasAvailableExternallyLinkage(); + if (GV->isDeclaration() && !GV->isMaterializable()) + isDecl = true; // X86-64 in PIC mode. if (isPICStyleRIPRel()) { diff --git a/llvm/test/CodeGen/X86/hidden-vis-pic.ll b/llvm/test/CodeGen/X86/hidden-vis-pic.ll index 88fae37a168..aff4819c83c 100644 --- a/llvm/test/CodeGen/X86/hidden-vis-pic.ll +++ b/llvm/test/CodeGen/X86/hidden-vis-pic.ll @@ -1,4 +1,27 @@ ; RUN: llc < %s -mtriple=i386-apple-darwin9 -relocation-model=pic -disable-fp-elim -unwind-tables | FileCheck %s + + + +; PR7353 + +define available_externally hidden +void @_ZNSbIcED1Ev() nounwind readnone ssp align 2 { +entry: + ret void +} + +define void()* @test1() nounwind { +entry: + ret void()* @_ZNSbIcED1Ev +} + +; This must use movl of the stub, not an lea, since the function isn't being +; emitted here. +; CHECK: movl L__ZNSbIcED1Ev$non_lazy_ptr-L1$pb( + + + + ; <rdar://problem/7383328> @.str = private constant [12 x i8] c"hello world\00", align 1 ; <[12 x i8]*> [#uses=1] @@ -28,3 +51,5 @@ return: ; preds = %entry ; CHECK: .private_extern _func.eh ; CHECK: .private_extern _main.eh + + |

