aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2016-01-06 19:43:32 +0000
committerDan Gohman <dan433584@gmail.com>2016-01-06 19:43:32 +0000
commit1aa5828b7917a3b801526e7b142711541c692bd4 (patch)
tree5faedba1fbe7c8684bf22b9f71965ec0ee24d0c4 /clang/lib/Driver/Tools.cpp
parent5eb90a7835b9558b151aafb88f1cca6f7f5e9c92 (diff)
downloadllvm-1aa5828b7917a3b801526e7b142711541c692bd4.zip
llvm-1aa5828b7917a3b801526e7b142711541c692bd4.tar.gz
llvm-1aa5828b7917a3b801526e7b142711541c692bd4.tar.bz2
[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
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 8468105..598ebc9 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());