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
This commit is contained in:
Bill Wendling
2009-06-28 07:36:13 +00:00
parent bd956c4290
commit d63bbadbef
10 changed files with 99 additions and 7 deletions

View File

@@ -423,7 +423,12 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
sprintf(MacroBuf, "__DECIMAL_DIG__=%d",
PickFP(&TI.getLongDoubleFormat(), -1/*FIXME*/, 17, 21, 33, 36));
DefineBuiltinMacro(Buf, MacroBuf);
if (LangOpts.StackProtector == 1)
DefineBuiltinMacro(Buf, "__SSP__=1");
else if (LangOpts.StackProtector == 2)
DefineBuiltinMacro(Buf, "__SSP_ALL__=2");
// Get other target #defines.
TI.getTargetDefines(LangOpts, Buf);
}