summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-08-11 23:52:28 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-08-11 23:52:28 +0000
commit3704eba1d1a88187cdd3895da9440e95e188e9cc (patch)
tree2754e73b005a7e044fdbb7f8833e952ebfe8e0f2 /llvm/lib/Target/TargetMachine.cpp
parenta9f6a529250565d60c8f8b279135857eb1f05ba6 (diff)
downloadbcm5719-llvm-3704eba1d1a88187cdd3895da9440e95e188e9cc.tar.gz
bcm5719-llvm-3704eba1d1a88187cdd3895da9440e95e188e9cc.zip
D36604: PR34148: Do not assume we can use a copy relocation for an `external_weak` global
An `external_weak` global may be intended to resolve as a null pointer if it's not defined, so it doesn't make sense to use a copy relocation for it. Differential Revision: https://reviews.llvm.org/D36604 llvm-svn: 310773
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/TargetMachine.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index e8fe0a2b218..b2578fb7a02 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -154,8 +154,9 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
return true;
bool IsTLS = GV && GV->isThreadLocal();
- bool IsAccessViaCopyRelocs =
- Options.MCOptions.MCPIECopyRelocations && GV && isa<GlobalVariable>(GV);
+ bool IsAccessViaCopyRelocs = Options.MCOptions.MCPIECopyRelocations && GV &&
+ isa<GlobalVariable>(GV) &&
+ !GV->hasExternalWeakLinkage();
Triple::ArchType Arch = TT.getArch();
bool IsPPC =
Arch == Triple::ppc || Arch == Triple::ppc64 || Arch == Triple::ppc64le;
OpenPOWER on IntegriCloud