From 1aa5828b7917a3b801526e7b142711541c692bd4 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 6 Jan 2016 19:43:32 +0000 Subject: [WebAssembly] Add --gc-sections to the link line. This will eventually be accompanied with a change to enable -ffunction-sections and -fdata-sections by default, which is currently delayed by some development process issues. llvm-svn: 256967 --- clang/lib/Driver/Tools.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 84681053dd1..598ebc955ee 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -6534,6 +6534,11 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA, ArgStringList CmdArgs; CmdArgs.push_back("-flavor"); CmdArgs.push_back("ld"); + + // Enable garbage collection of unused input sections by default, since code + // size is of particular importance. + CmdArgs.push_back("--gc-sections"); + AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs); CmdArgs.push_back("-o"); CmdArgs.push_back(Output.getFilename()); -- cgit v1.2.3