aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PowerPC/PPCSubtarget.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-12-05 01:06:39 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-12-05 01:06:39 +0000
commita65854f8c54ecbf787262221338a7cffd8e3e771 (patch)
tree00f4a5e3d57725f8b01a1ca106e61cba657d8ded /lib/Target/PowerPC/PPCSubtarget.cpp
parenta658d0290e99bd31cf1ea1268aa6105633c579b8 (diff)
downloadexternal_llvm-a65854f8c54ecbf787262221338a7cffd8e3e771.zip
external_llvm-a65854f8c54ecbf787262221338a7cffd8e3e771.tar.gz
external_llvm-a65854f8c54ecbf787262221338a7cffd8e3e771.tar.bz2
Re-did 60519. It turns out Darwin's handling of hidden visibility symbols are a bit more complicate than I expected. Both declarations and weak definitions still need a stub indirection. However, the stubs are in data section and they contain the addresses of the actual symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCSubtarget.cpp')
-rw-r--r--lib/Target/PowerPC/PPCSubtarget.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp
index 14983fc..e63368b 100644
--- a/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -141,8 +141,11 @@ 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;
-
+ // If symbol visibility is hidden, the extra load is not needed if
+ // the symbol is definitely defined in the current translation unit.
+ bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
+ if (GV->hasHiddenVisibility() && !isDecl && !GV->hasCommonLinkage())
+ return false;
return GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
- GV->hasCommonLinkage() ||
- (GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode());
+ GV->hasCommonLinkage() || isDecl;
}