summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2017-11-08 00:01:05 +0000
committerSriraman Tallam <tmsriram@google.com>2017-11-08 00:01:05 +0000
commit056b3fd6fba58b3a534daaf8a16c5e8af139a9c0 (patch)
tree1f2a46da4f09a9eb5ff4ab1a6a5e67352adadff1 /llvm/lib/Target/TargetMachine.cpp
parent0379d3f84434043ecb814eb2cb473523c5f406a9 (diff)
downloadbcm5719-llvm-056b3fd6fba58b3a534daaf8a16c5e8af139a9c0.tar.gz
bcm5719-llvm-056b3fd6fba58b3a534daaf8a16c5e8af139a9c0.zip
Attribute nonlazybind should not affect calls to functions with hidden visibility.
Differential Revision: https://reviews.llvm.org/D39625 llvm-svn: 317639
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/TargetMachine.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index 5dcb89477a3..b24888fa9cb 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -167,6 +167,13 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
if (GV && !GV->isDeclarationForLinker())
return true;
+ // A symbol marked nonlazybind should not be accessed with a plt. If the
+ // symbol turns out to be external, the linker will convert a direct
+ // access to an access via the plt, so don't assume it is local.
+ const Function *F = dyn_cast_or_null<Function>(GV);
+ if (F && F->hasFnAttribute(Attribute::NonLazyBind))
+ return false;
+
bool IsTLS = GV && GV->isThreadLocal();
bool IsAccessViaCopyRelocs =
Options.MCOptions.MCPIECopyRelocations && GV && isa<GlobalVariable>(GV);
OpenPOWER on IntegriCloud