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 | ae94e594164b193236002516970aeec4c4574768 (patch) | |
tree | 00f4a5e3d57725f8b01a1ca106e61cba657d8ded /lib/Target/X86/X86Subtarget.cpp | |
parent | cd730fa3377ba9f019c810c3181390960b85e831 (diff) |
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/X86/X86Subtarget.cpp')
-rw-r--r-- | lib/Target/X86/X86Subtarget.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index c17f2dc682..b836471afc 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -40,10 +40,14 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, if (TM.getRelocationModel() != Reloc::Static && TM.getCodeModel() != CodeModel::Large) { if (isTargetDarwin()) { - return (!isDirectCall && - (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || - GV->hasCommonLinkage() || - (GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode()))); + bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode(); + if (GV->hasHiddenVisibility() && + (Is64Bit || (!isDecl && !GV->hasCommonLinkage()))) + // If symbol visibility is hidden, the extra load is not needed if + // target is x86-64 or the symbol is definitely defined in the current + // translation unit. + return false; + return !isDirectCall && (isDecl || GV->mayBeOverridden()); } else if (isTargetELF()) { // Extra load is needed for all externally visible. if (isDirectCall) |