diff options
author | Anders Carlsson <andersca@mac.com> | 2009-11-16 16:56:03 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-11-16 16:56:03 +0000 |
commit | fd015353a3c4f528216276f25df5b4d464d7a0cd (patch) | |
tree | 3c1c8f533342c43bcaed9197ed3e3a174ce53b0e /lib/CodeGen/CodeGenModule.cpp | |
parent | eef22efce8dd9d0ba9adb8f4746b96b584f2521d (diff) |
The ssp and sspreq function attributes should only be applied to function definitions, not declarations or calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 26d810b4f1..e5712e138b 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -348,6 +348,11 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, if (D->hasAttr<NoInlineAttr>()) F->addFnAttr(llvm::Attribute::NoInline); + if (Features.getStackProtectorMode() == LangOptions::SSPOn) + F->addFnAttr(llvm::Attribute::StackProtect); + else if (Features.getStackProtectorMode() == LangOptions::SSPReq) + F->addFnAttr(llvm::Attribute::StackProtectReq); + if (const AlignedAttr *AA = D->getAttr<AlignedAttr>()) F->setAlignment(AA->getAlignment()/8); // C++ ABI requires 2-byte alignment for member functions. |