diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 42aee2677cd..69452c13601 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -830,7 +830,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op, /// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol /// even in non-static mode. static bool GVIsIndirectSymbol(GlobalValue *GV, Reloc::Model RelocM) { - return RelocM != Reloc::Static && !GV->hasHiddenVisibility() && + return RelocM != Reloc::Static && (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || (GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode())); } diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 8d91b5c2f1e..3ed72658401 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -387,9 +387,8 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) { // External or weakly linked global variables need non-lazily-resolved stubs if (TM.getRelocationModel() != Reloc::Static) { - if (!GV->hasHiddenVisibility() && - (GV->isDeclaration() || GV->hasWeakLinkage() || - GV->hasLinkOnceLinkage() || GV->hasCommonLinkage())) { + if (((GV->isDeclaration() || GV->hasWeakLinkage() || + GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) { GVStubs.insert(Name); printSuffixedName(Name, "$non_lazy_ptr"); if (GV->hasExternalWeakLinkage()) diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp index aef47866bf2..14983fcf1de 100644 --- a/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/lib/Target/PowerPC/PPCSubtarget.cpp @@ -141,9 +141,7 @@ bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const { // We never hae stubs if HasLazyResolverStubs=false or if in static mode. if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static) return false; - // Extra load is not needed for symbols with hidden visibility. - if (GV->hasHiddenVisibility()) - return false; + return GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || GV->hasCommonLinkage() || (GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode()); diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index d5cb8bd13ca..66319c39816 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -391,8 +391,6 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, FnStubs.insert(Name); printSuffixedName(Name, "$stub"); } - } else if (GV->hasHiddenVisibility()) { - O << Name; } else { GVStubs.insert(Name); printSuffixedName(Name, "$non_lazy_ptr"); diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index 0e791324d38..c17f2dc6825 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -40,9 +40,6 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, if (TM.getRelocationModel() != Reloc::Static && TM.getCodeModel() != CodeModel::Large) { if (isTargetDarwin()) { - if (GV->hasHiddenVisibility()) - // Extra load is not needed for symbols with hidden visibility. - return false; return (!isDirectCall && (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || GV->hasCommonLinkage() || diff --git a/test/CodeGen/X86/hidden-vis-2.ll b/test/CodeGen/X86/hidden-vis-2.ll index e000547f44f..4df1c1c5b21 100644 --- a/test/CodeGen/X86/hidden-vis-2.ll +++ b/test/CodeGen/X86/hidden-vis-2.ll @@ -1,5 +1,6 @@ ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin9 | grep mov | count 1 ; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin9 | not grep GOT +; XFAIL: * @x = weak hidden global i32 0 ; [#uses=1]