diff options
author | Sriraman Tallam <tmsriram@google.com> | 2017-11-08 00:01:05 +0000 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2017-11-08 00:01:05 +0000 |
commit | 056b3fd6fba58b3a534daaf8a16c5e8af139a9c0 (patch) | |
tree | 1f2a46da4f09a9eb5ff4ab1a6a5e67352adadff1 /llvm/lib/Target/X86/X86Subtarget.cpp | |
parent | 0379d3f84434043ecb814eb2cb473523c5f406a9 (diff) | |
download | bcm5719-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/X86/X86Subtarget.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86Subtarget.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index 9e060f97df3..66fea1e688f 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -144,15 +144,6 @@ 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; @@ -162,12 +153,16 @@ 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. // In Regcall calling convention those registers are used for passing // parameters. Thus we need to prevent lazy binding in Regcall. return X86II::MO_GOTPCREL; + if (F && F->hasFnAttribute(Attribute::NonLazyBind) && is64Bit()) + return X86II::MO_GOTPCREL; return X86II::MO_PLT; } |