From 4e480206b288d82c5cb525e739d39da346c64c55 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 7 Jan 2016 00:32:04 +0000 Subject: [WebAssembly] Only enable --gc-sections when optimizations are enabled. Also, revamp the wasm-toolchain.c test and add a test to ensure that a user-supplied --no-gc-sections comes after --gc-sections. llvm-svn: 257004 --- clang/lib/Driver/Tools.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/lib/Driver/Tools.cpp') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 598ebc955ee..0236e613a37 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -6537,7 +6537,8 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Enable garbage collection of unused input sections by default, since code // size is of particular importance. - CmdArgs.push_back("--gc-sections"); + if (areOptimizationsEnabled(Args)) + CmdArgs.push_back("--gc-sections"); AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs); CmdArgs.push_back("-o"); -- cgit v1.2.3