clang-cl: make /Gy imply -fdata-sections in addition to -ffunction-sections

llvm-svn: 204736
This commit is contained in:
Hans Wennborg 2014-03-25 17:50:25 +00:00
parent 4beef4c90d
commit d8d49ba20e
2 changed files with 8 additions and 0 deletions

View File

@ -4135,6 +4135,12 @@ void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs) const {
if (!Args.hasArg(options::OPT_frtti, options::OPT_fno_rtti))
CmdArgs.push_back("-fno-rtti");
// Let -ffunction-sections imply -fdata-sections.
if (Arg * A = Args.getLastArg(options::OPT_ffunction_sections,
options::OPT_fno_function_sections))
if (A->getOption().matches(options::OPT_ffunction_sections))
CmdArgs.push_back("-fdata-sections");
const Driver &D = getToolChain().getDriver();
Arg *MostGeneralArg = Args.getLastArg(options::OPT__SLASH_vmg);
Arg *BestCaseArg = Args.getLastArg(options::OPT__SLASH_vmb);

View File

@ -25,9 +25,11 @@
// GR_: -fno-rtti
// RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
// Gy: -fdata-sections
// Gy: -ffunction-sections
// RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
// Gy_-NOT: -fdata-sections
// Gy_-NOT: -ffunction-sections
// RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s