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 | |
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
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 5 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 5d8e5c2c4f..d0c7d03f20 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -448,11 +448,6 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, if (CodeGenOpts.NoImplicitFloat) FuncAttrs |= llvm::Attribute::NoImplicitFloat; - if (Features.getStackProtectorMode() == LangOptions::SSPOn) - FuncAttrs |= llvm::Attribute::StackProtect; - else if (Features.getStackProtectorMode() == LangOptions::SSPReq) - FuncAttrs |= llvm::Attribute::StackProtectReq; - QualType RetTy = FI.getReturnType(); unsigned Index = 1; const ABIArgInfo &RetAI = FI.getReturnInfo(); 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. |