summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2017-11-07 19:37:51 +0000
committerSriraman Tallam <tmsriram@google.com>2017-11-07 19:37:51 +0000
commit5c65148565d9af773c51e20c219f494a5fc3cd3d (patch)
tree0a5be1ef782e6a6416940f6858fe60c666adbef4 /clang/lib/CodeGen/CGCall.cpp
parent4e8ce0225f39ce8fbb278ed8ed6ef83813a82cf2 (diff)
downloadbcm5719-llvm-5c65148565d9af773c51e20c219f494a5fc3cd3d.tar.gz
bcm5719-llvm-5c65148565d9af773c51e20c219f494a5fc3cd3d.zip
New clang option -fno-plt which avoids the PLT and lazy binding while making external calls.
Differential Revision: https://reviews.llvm.org/D39079 llvm-svn: 317605
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 971455a8737..cefd73be276 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1855,6 +1855,16 @@ void CodeGenModule::ConstructAttributeList(
!(TargetDecl && TargetDecl->hasAttr<NoSplitStackAttr>()))
FuncAttrs.addAttribute("split-stack");
+ // Add NonLazyBind attribute to function declarations when -fno-plt
+ // is used.
+ if (TargetDecl && CodeGenOpts.NoPLT) {
+ if (auto *Fn = dyn_cast<FunctionDecl>(TargetDecl)) {
+ if (!Fn->isDefined() && !AttrOnCallSite) {
+ FuncAttrs.addAttribute(llvm::Attribute::NonLazyBind);
+ }
+ }
+ }
+
if (!AttrOnCallSite) {
bool DisableTailCalls =
CodeGenOpts.DisableTailCalls ||
OpenPOWER on IntegriCloud