diff options
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index bfc247a015f..ac07906c8fd 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -498,6 +498,18 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.AddLastArg(CmdArgs, options::OPT_fvisibility_EQ); Args.AddLastArg(CmdArgs, options::OPT_fwritable_strings); + // Forward stack protector flags. + if (Arg *A = Args.getLastArg(options::OPT_fno_stack_protector, + options::OPT_fstack_protector_all, + options::OPT_fstack_protector)) { + if (A->getOption().matches(options::OPT_fno_stack_protector)) + CmdArgs.push_back("--stack-protector=0"); + else if (A->getOption().matches(options::OPT_fstack_protector)) + CmdArgs.push_back("--stack-protector=1"); + else + CmdArgs.push_back("--stack-protector=2"); + } + // Forward -f options with positive and negative forms; we translate // these by hand. |