summaryrefslogtreecommitdiff
path: root/lib/CodeGen
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
commit8df1506a8f89c05a622ab6c66640d5c69f59a3b0 (patch)
tree29c4122311c8b0f3e71826c6d02f664a88416ccd /lib/CodeGen
parentf17ed937a60b76b8b8c9c5c4056a163fcea745fa (diff)
downloadclang-8df1506a8f89c05a622ab6c66640d5c69f59a3b0.tar.gz
New clang option -fno-plt which avoids the PLT and lazy binding while making external calls.
Differential Revision: https://reviews.llvm.org/D39079 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317605 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGCall.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 971455a873..cefd73be27 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/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 ||