r204736 - clang-cl: make /Gy imply -fdata-sections in addition to -ffunction-sections
Hans Wennborg
hans at hanshq.net
Tue Mar 25 10:50:25 PDT 2014
Author: hans
Date: Tue Mar 25 12:50:25 2014
New Revision: 204736
URL: http://llvm.org/viewvc/llvm-project?rev=204736&view=rev
Log:
clang-cl: make /Gy imply -fdata-sections in addition to -ffunction-sections
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cl-options.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=204736&r1=204735&r2=204736&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 25 12:50:25 2014
@@ -4135,6 +4135,12 @@ void Clang::AddClangCLArgs(const ArgList
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);
Modified: cfe/trunk/test/Driver/cl-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=204736&r1=204735&r2=204736&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Tue Mar 25 12:50:25 2014
@@ -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
More information about the cfe-commits
mailing list