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
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 9910e28..d1158a6 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -235,11 +235,14 @@
   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;
 }