forked from OSchip/llvm-project
[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
This commit is contained in:
parent
5eb90a7835
commit
1aa5828b79
|
@ -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());
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
// RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown -x assembler %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
|
||||
// AS_LINK: clang{{.*}}" "-cc1as" {{.*}} "-o" "[[temp:[^"]*]]"
|
||||
// AS_LINK: lld{{.*}}" "-flavor" "ld" "[[temp]]" "-o" "a.out"
|
||||
// AS_LINK: lld{{.*}}" "-flavor" "ld" "--gc-sections" "[[temp]]" "-o" "a.out"
|
||||
|
|
Loading…
Reference in New Issue