diff options
author | Sriraman Tallam <tmsriram@google.com> | 2017-11-07 19:37:51 +0000 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2017-11-07 19:37:51 +0000 |
commit | 5c65148565d9af773c51e20c219f494a5fc3cd3d (patch) | |
tree | 0a5be1ef782e6a6416940f6858fe60c666adbef4 /clang/lib/CodeGen/CGCall.cpp | |
parent | 4e8ce0225f39ce8fbb278ed8ed6ef83813a82cf2 (diff) | |
download | bcm5719-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.cpp | 10 |
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 || |