diff options
| author | Bill Wendling <isanbard@gmail.com> | 2009-06-28 07:36:13 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2009-06-28 07:36:13 +0000 |
| commit | d63bbadbef6d8b1b9dbc9a5e024c275b0a9897e9 (patch) | |
| tree | 1b5305469985b27a4317fd886765b1ffbdea5424 /clang/lib/CodeGen | |
| parent | bd956c429040a41c7e9e4fdd3063ec0ab98457cb (diff) | |
| download | bcm5719-llvm-d63bbadbef6d8b1b9dbc9a5e024c275b0a9897e9.tar.gz bcm5719-llvm-d63bbadbef6d8b1b9dbc9a5e024c275b0a9897e9.zip | |
Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.
llvm-svn: 74405
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 30c5d28c227..61b6737be11 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -392,6 +392,11 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, if (CompileOpts.NoImplicitFloat) FuncAttrs |= llvm::Attribute::NoImplicitFloat; + if (Features.StackProtector == 1) + FuncAttrs |= llvm::Attribute::StackProtect; + else if (Features.StackProtector == 2) + FuncAttrs |= llvm::Attribute::StackProtectReq; + QualType RetTy = FI.getReturnType(); unsigned Index = 1; const ABIArgInfo &RetAI = FI.getReturnInfo(); |

