aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86Subtarget.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2007-01-17 10:33:08 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2007-01-17 10:33:08 +0000
commit5032e5a61381437174e035de2a7dd728978f7bd5 (patch)
treed3490b98b33a202ee2b2a399692d9c7b169ac1c8 /lib/Target/X86/X86Subtarget.cpp
parente911615c4769d793588087b5321d303ecb9661c7 (diff)
* Fix one more bug in PIC codegen: extra load is needed for *all*
non-statics. * Introduce new option to output zero-initialized data to .bss section. This can reduce size of binaries. Enable it by default for ELF & Cygwin/Mingw targets. Probably, Darwin should be also added. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86Subtarget.cpp')
-rw-r--r--lib/Target/X86/X86Subtarget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp
index 5f2342ff4d..be5c64d6d3 100644
--- a/lib/Target/X86/X86Subtarget.cpp
+++ b/lib/Target/X86/X86Subtarget.cpp
@@ -36,10 +36,14 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV,
bool isDirectCall) const
{
if (TM.getRelocationModel() != Reloc::Static)
- if (isTargetDarwin() || isPICStyleGOT()) {
+ if (isTargetDarwin()) {
return (!isDirectCall &&
(GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
(GV->isExternal() && !GV->hasNotBeenReadFromBytecode())));
+ } else if (isPICStyleGOT()) {
+ // Extra load is needed for all non-statics.
+ return (!isDirectCall &&
+ (GV->isExternal() || !GV->hasInternalLinkage()));
} else if (isTargetCygMing() || isTargetWindows()) {
return (GV->hasDLLImportLinkage());
}