summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86Subtarget.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-10-27 21:18:48 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-10-27 21:18:48 +0000
commit2393c3b4e12460cd9c430840e21d333ad6294b5a (patch)
treefc638ebba802bbde25b96b36455c3443693b84d4 /llvm/lib/Target/X86/X86Subtarget.cpp
parent94f5032aedbd49e2f828e2bb31c006332c2bcaa7 (diff)
downloadbcm5719-llvm-2393c3b4e12460cd9c430840e21d333ad6294b5a.tar.gz
bcm5719-llvm-2393c3b4e12460cd9c430840e21d333ad6294b5a.zip
Handle undefined weak hidden symbols on all architectures.
We were handling the non-hidden case in lib/Target/TargetMachine.cpp, but the hidden case was handled in architecture dependent code and only X86_64 and AArch64 were covered. While it is true that some code sequences in some ABIs might be able to produce the correct value at runtime, that doesn't seem to be the common case. I left the AArch64 code in place since it also forces a got access for non-pic code. It is not clear if that is needed, but it is probably better to change that in another commit. llvm-svn: 316799
Diffstat (limited to 'llvm/lib/Target/X86/X86Subtarget.cpp')
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index 0de5619cff2..b0ce1335bd3 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -99,22 +99,6 @@ X86Subtarget::classifyLocalReference(const GlobalValue *GV) const {
return X86II::MO_GOTOFF;
}
-static bool shouldAssumeGlobalReferenceLocal(const X86Subtarget *ST,
- const TargetMachine &TM,
- const Module &M,
- const GlobalValue *GV) {
- if (!TM.shouldAssumeDSOLocal(M, GV))
- return false;
- // A weak reference can end up being 0. If the code can be more that 4g away
- // from zero and we are using the small code model we have to treat it as non
- // local.
- if (GV && GV->hasExternalWeakLinkage() &&
- TM.getCodeModel() == CodeModel::Small && TM.isPositionIndependent() &&
- ST->is64Bit() && ST->isTargetELF())
- return false;
- return true;
-}
-
unsigned char X86Subtarget::classifyGlobalReference(const GlobalValue *GV,
const Module &M) const {
// Large model never uses stubs.
@@ -134,7 +118,7 @@ unsigned char X86Subtarget::classifyGlobalReference(const GlobalValue *GV,
}
}
- if (shouldAssumeGlobalReferenceLocal(this, TM, M, GV))
+ if (TM.shouldAssumeDSOLocal(M, GV))
return classifyLocalReference(GV);
if (isTargetCOFF())
OpenPOWER on IntegriCloud