aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/Targets.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/Basic/Targets.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/Basic/Targets.cpp')
-rw-r--r--lib/Basic/Targets.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 9910e28fcd..d1158a6c6f 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -235,11 +235,14 @@ static void GetDarwinLanguageOptions(LangOptions &Opts,
if (!getDarwinNumber(Triple, Maj, Min, Rev))
return;
- // Blocks default to on for 10.6 (darwin10) and beyond.
- // As does nonfragile-abi for 64bit mode
- if (Maj > 9)
+ // Blocks and stack protectors default to on for 10.6 (darwin10) and beyond.
+ if (Maj > 9) {
Opts.Blocks = 1;
+ Opts.StackProtector = 1;
+ }
+ // Non-fragile ABI (in 64-bit mode) default to on for 10.5 (darwin9) and
+ // beyond.
if (Maj >= 9 && Opts.ObjC1 && !strncmp(Triple, "x86_64", 6))
Opts.ObjCNonFragileABI = 1;
}