summaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorJosh Magee <joshua_magee@playstation.sony.com>2014-02-11 01:35:14 +0000
committerJosh Magee <joshua_magee@playstation.sony.com>2014-02-11 01:35:14 +0000
commit3ab3daec81111e00f1a70f482f29aaf38bfcedf3 (patch)
treefd78aee5faf94074d5c3ab3c0a920b920f8c7b6a /lib/Driver/Tools.cpp
parenta9808833919b90a03cf645a8bbe508c4bc779953 (diff)
downloadclang-3ab3daec81111e00f1a70f482f29aaf38bfcedf3.tar.gz
clang-3ab3daec81111e00f1a70f482f29aaf38bfcedf3.tar.bz2
clang-3ab3daec81111e00f1a70f482f29aaf38bfcedf3.tar.xz
[stackprotector] Add command line option -fstack-protector-strong
This option has the following effects: * It adds the sspstrong IR attribute to each function within the CU. * It defines the macro __SSP_STRONG__ with the value of 2. Differential Revision: http://llvm-reviews.chandlerc.com/D2717 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index d2bb9ba532..5792f42b6f 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -10,6 +10,7 @@
#include "Tools.h"
#include "InputInfo.h"
#include "ToolChains.h"
+#include "clang/Basic/LangOptions.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/Version.h"
#include "clang/Driver/Action.h"
@@ -3114,11 +3115,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
unsigned StackProtectorLevel = 0;
if (Arg *A = Args.getLastArg(options::OPT_fno_stack_protector,
options::OPT_fstack_protector_all,
+ options::OPT_fstack_protector_strong,
options::OPT_fstack_protector)) {
if (A->getOption().matches(options::OPT_fstack_protector))
- StackProtectorLevel = 1;
+ StackProtectorLevel = LangOptions::SSPOn;
+ else if (A->getOption().matches(options::OPT_fstack_protector_strong))
+ StackProtectorLevel = LangOptions::SSPStrong;
else if (A->getOption().matches(options::OPT_fstack_protector_all))
- StackProtectorLevel = 2;
+ StackProtectorLevel = LangOptions::SSPReq;
} else {
StackProtectorLevel =
getToolChain().GetDefaultStackProtectorLevel(KernelOrKext);