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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user