aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-06-28 07:36:13 +0000
committerBill Wendling <isanbard@gmail.com>2009-06-28 07:36:13 +0000
commit45483f7a1b3e57b4603b141bee80596b2d4dd443 (patch)
tree8fa4caaaa5f0ca371dd4be9d4b47f1c7808e8945 /lib/Frontend/InitPreprocessor.cpp
parent1bd1f6e85a011fe3129dc2898857e72741d36667 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74405 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--lib/Frontend/InitPreprocessor.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 730414e448..554868fd27 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -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);
}