diff options
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index e73c22d..4ee7714 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -6183,6 +6183,14 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, /*default=*/false)) CmdArgs.push_back("-fno-rtti-data"); + // This controls whether or not we emit stack-protector instrumentation. + // In MSVC, Buffer Security Check (/GS) is on by default. + if (Args.hasFlag(options::OPT__SLASH_GS, options::OPT__SLASH_GS_, + /*default=*/true)) { + CmdArgs.push_back("-stack-protector"); + CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong))); + } + // Emit CodeView if -Z7 is present. *EmitCodeView = Args.hasArg(options::OPT__SLASH_Z7); if (*EmitCodeView) @@ -10022,6 +10030,11 @@ std::unique_ptr<Command> visualstudio::Compiler::GetCommand( if (Args.hasFlag(options::OPT__SLASH_GR_, options::OPT__SLASH_GR, /*default=*/false)) CmdArgs.push_back("/GR-"); + + if (Args.hasFlag(options::OPT__SLASH_GS_, options::OPT__SLASH_GS, + /*default=*/false)) + CmdArgs.push_back("/GS-"); + if (Arg *A = Args.getLastArg(options::OPT_ffunction_sections, options::OPT_fno_function_sections)) CmdArgs.push_back(A->getOption().getID() == options::OPT_ffunction_sections |