diff options
author | Sriraman Tallam <tmsriram@google.com> | 2017-11-03 00:10:19 +0000 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2017-11-03 00:10:19 +0000 |
commit | 7cdb10f1aabfe57b3e1dcb1a8e5a064b1c7343dc (patch) | |
tree | 475276bd49c074f4c0042ba07d0c35bf4f901701 /llvm/lib/Target/X86/X86Subtarget.cpp | |
parent | 19bbd8a92d8e8aca0a24f27f6c9d18dcdecf4fd9 (diff) | |
download | bcm5719-llvm-7cdb10f1aabfe57b3e1dcb1a8e5a064b1c7343dc.tar.gz bcm5719-llvm-7cdb10f1aabfe57b3e1dcb1a8e5a064b1c7343dc.zip |
Avoid PLT for external calls when attribute nonlazybind is used.
Differential Revision: https://reviews.llvm.org/D39065
llvm-svn: 317292
Diffstat (limited to 'llvm/lib/Target/X86/X86Subtarget.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86Subtarget.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index b0ce1335bd3..9e060f97df3 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -144,6 +144,15 @@ X86Subtarget::classifyGlobalFunctionReference(const GlobalValue *GV) const { unsigned char X86Subtarget::classifyGlobalFunctionReference(const GlobalValue *GV, const Module &M) const { + const Function *F = dyn_cast_or_null<Function>(GV); + + // Do not use the PLT when explicitly told to do so for ELF 64-bit + // target. + if (isTargetELF() && is64Bit() && F && + F->hasFnAttribute(Attribute::NonLazyBind) && + GV->isDeclarationForLinker()) + return X86II::MO_GOTPCREL; + if (TM.shouldAssumeDSOLocal(M, GV)) return X86II::MO_NO_FLAG; @@ -153,8 +162,6 @@ X86Subtarget::classifyGlobalFunctionReference(const GlobalValue *GV, return X86II::MO_DLLIMPORT; } - const Function *F = dyn_cast_or_null<Function>(GV); - if (isTargetELF()) { if (is64Bit() && F && (CallingConv::X86_RegCall == F->getCallingConv())) // According to psABI, PLT stub clobbers XMM8-XMM15. |