summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86Subtarget.cpp
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2018-02-23 21:32:06 +0000
committerSriraman Tallam <tmsriram@google.com>2018-02-23 21:32:06 +0000
commit609f8c013c0b68ee051294f3e7ad6786d83bafac (patch)
tree6b8f8a903e354f32b86238bc9ae1ef0dce25ad42 /llvm/lib/Target/X86/X86Subtarget.cpp
parent80af005a485357bf87e0d58f6d4fbab1d186881b (diff)
downloadbcm5719-llvm-609f8c013c0b68ee051294f3e7ad6786d83bafac.tar.gz
bcm5719-llvm-609f8c013c0b68ee051294f3e7ad6786d83bafac.zip
Intrinsics calls should avoid the PLT when "RtLibUseGOT" metadata is present.
Differential Revision: https://reviews.llvm.org/D42216 llvm-svn: 325962
Diffstat (limited to 'llvm/lib/Target/X86/X86Subtarget.cpp')
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index 0a6eda7e243..c6ebaef587d 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -157,8 +157,11 @@ X86Subtarget::classifyGlobalFunctionReference(const GlobalValue *GV,
// 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;
+ // If PLT must be avoided then the call should be via GOTPCREL.
+ if (((F && F->hasFnAttribute(Attribute::NonLazyBind)) ||
+ (!F && M.getRtLibUseGOT())) &&
+ is64Bit())
+ return X86II::MO_GOTPCREL;
return X86II::MO_PLT;
}
OpenPOWER on IntegriCloud