diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-12-05 01:06:39 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-12-05 01:06:39 +0000 |
commit | 2a03c7e977b7a7bd923c8f8c41c0e81e3b96f63e (patch) | |
tree | b04c06f8152f3ad50cf9a947732418d8097e3477 /llvm/lib/Target/PowerPC/PPCSubtarget.cpp | |
parent | d368de794af01b50d269306649f02128e4fbbbea (diff) | |
download | bcm5719-llvm-2a03c7e977b7a7bd923c8f8c41c0e81e3b96f63e.tar.gz bcm5719-llvm-2a03c7e977b7a7bd923c8f8c41c0e81e3b96f63e.zip |
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.
llvm-svn: 60571
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCSubtarget.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCSubtarget.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp index 14983fcf1de..e63368bd659 100644 --- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/llvm/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; } |