Re: r256967 - [WebAssembly] Add --gc-sections to the link line.

2016-01-06 Thread Dan Gohman via cfe-commits
On Wed, Jan 6, 2016 at 3:53 PM, Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Wed, Jan 06, 2016 at 07:43:32PM -, Dan Gohman via cfe-commits wrote:
> > Author: djg
> > Date: Wed Jan  6 13:43:32 2016
> > New Revision: 256967
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=256967=rev
> > Log:
> > [WebAssembly] Add --gc-sections to the link line.
>
> Can you make sure it is added before any user options, so that in the
> worst case it can still be overriden?


I've now added a test for this in r257004.

Dan
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r256967 - [WebAssembly] Add --gc-sections to the link line.

2016-01-06 Thread Dan Gohman via cfe-commits
Author: djg
Date: Wed Jan  6 13:43:32 2016
New Revision: 256967

URL: http://llvm.org/viewvc/llvm-project?rev=256967=rev
Log:
[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.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/wasm-toolchain.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=256967=256966=256967=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jan  6 13:43:32 2016
@@ -6534,6 +6534,11 @@ void wasm::Linker::ConstructJob(Compilat
   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());

Modified: cfe/trunk/test/Driver/wasm-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/wasm-toolchain.c?rev=256967=256966=256967=diff
==
--- cfe/trunk/test/Driver/wasm-toolchain.c (original)
+++ cfe/trunk/test/Driver/wasm-toolchain.c Wed Jan  6 13:43:32 2016
@@ -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"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits