From 0d82fa66a561cb0456968e1ec569f68373ad657e Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Mon, 16 Nov 2009 16:56:03 +0000 Subject: The ssp and sspreq function attributes should only be applied to function definitions, not declarations or calls. llvm-svn: 88915 --- clang/lib/CodeGen/CodeGenModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 26d810b4f1d..e5712e138b7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -348,6 +348,11 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, if (D->hasAttr()) 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()) F->setAlignment(AA->getAlignment()/8); // C++ ABI requires 2-byte alignment for member functions. -- cgit v1.2.3