[llvm-commits] [llvm] r105954 - in /llvm/trunk: lib/Target/X86/X86Subtarget.cpp test/CodeGen/X86/hidden-vis-pic.ll
Chris Lattner
sabre at nondot.org
Mon Jun 14 13:11:56 PDT 2010
Author: lattner
Date: Mon Jun 14 15:11:56 2010
New Revision: 105954
URL: http://llvm.org/viewvc/llvm-project?rev=105954&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/X86/X86Subtarget.cpp
llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=105954&r1=105953&r2=105954&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Jun 14 15:11:56 2010
@@ -53,9 +53,12 @@
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()) {
Modified: llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll?rev=105954&r1=105953&r2=105954&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll (original)
+++ llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll Mon Jun 14 15:11:56 2010
@@ -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 @@
; CHECK: .private_extern _func.eh
; CHECK: .private_extern _main.eh
+
+
More information about the llvm-commits
mailing list