[lld] r340073 - [WebAssembly] Don't compress LEBs by default
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 17 12:42:46 PDT 2018
Author: sbc
Date: Fri Aug 17 12:42:46 2018
New Revision: 340073
URL: http://llvm.org/viewvc/llvm-project?rev=340073&view=rev
Log:
[WebAssembly] Don't compress LEBs by default
LEB compression breaks debug info so we don't want to enable
it by default, even at high optimization levels.
Differential Revision: https://reviews.llvm.org/D50729
Modified:
lld/trunk/test/wasm/compress-relocs.ll
lld/trunk/wasm/Driver.cpp
lld/trunk/wasm/Options.td
Modified: lld/trunk/test/wasm/compress-relocs.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/compress-relocs.ll?rev=340073&r1=340072&r2=340073&view=diff
==============================================================================
--- lld/trunk/test/wasm/compress-relocs.ll (original)
+++ lld/trunk/test/wasm/compress-relocs.ll Fri Aug 17 12:42:46 2018
@@ -2,8 +2,10 @@
; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -o %t.wasm %t2.o %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
-
-; RUN: wasm-ld -O2 -o %t-compressed.wasm %t2.o %t.o
+; RUN: wasm-ld -O2 -o %t-opt.wasm %t2.o %t.o
+; RUN: obj2yaml %t-opt.wasm | FileCheck %s
+; RUN: not wasm-ld --compress-relocations -o %t-compressed.wasm %t2.o %t.o 2>&1 | FileCheck %s -check-prefix=ERROR
+; RUN: wasm-ld --strip-debug --compress-relocations -o %t-compressed.wasm %t2.o %t.o
; RUN: obj2yaml %t-compressed.wasm | FileCheck %s -check-prefix=COMPRESS
target triple = "wasm32-unknown-unknown-wasm"
@@ -18,5 +20,7 @@ entry:
ret void
}
+; ERROR: wasm-ld: error: --compress-relocations is incompatible with output debug information. Please pass --strip-debug or --strip-all
+
; CHECK: Body: 4100280284888080002100410028028088808000118080808000001A2000118180808000001A0B
; COMPRESS: Body: 41002802840821004100280280081100001A20001101001A0B
Modified: lld/trunk/wasm/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Driver.cpp?rev=340073&r1=340072&r2=340073&view=diff
==============================================================================
--- lld/trunk/wasm/Driver.cpp (original)
+++ lld/trunk/wasm/Driver.cpp Fri Aug 17 12:42:46 2018
@@ -395,6 +395,7 @@ void LinkerDriver::link(ArrayRef<const c
Config->SearchPaths = args::getStrings(Args, OPT_L);
Config->StripAll = Args.hasArg(OPT_strip_all);
Config->StripDebug = Args.hasArg(OPT_strip_debug);
+ Config->CompressRelocTargets = Args.hasArg(OPT_compress_relocations);
Config->StackFirst = Args.hasArg(OPT_stack_first);
Config->ThinLTOCacheDir = Args.getLastArgValue(OPT_thinlto_cache_dir);
Config->ThinLTOCachePolicy = CHECK(
@@ -410,7 +411,9 @@ void LinkerDriver::link(ArrayRef<const c
Config->ZStackSize =
args::getZOptionValue(Args, OPT_z, "stack-size", WasmPageSize);
- Config->CompressRelocTargets = Config->Optimize > 0 && !Config->Relocatable;
+ if (!Config->StripDebug && !Config->StripAll && Config->CompressRelocTargets)
+ error("--compress-relocations is incompatible with output debug"
+ " information. Please pass --strip-debug or --strip-all");
if (Config->LTOO > 3)
error("invalid optimization level for LTO: " + Twine(Config->LTOO));
@@ -438,6 +441,8 @@ void LinkerDriver::link(ArrayRef<const c
error("entry point specified for relocatable output file");
if (Config->GcSections)
error("-r and --gc-sections may not be used together");
+ if (Config->CompressRelocTargets)
+ error("-r -and --compress-relocations may not be used together");
if (Args.hasArg(OPT_undefined))
error("-r -and --undefined may not be used together");
}
Modified: lld/trunk/wasm/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Options.td?rev=340073&r1=340072&r2=340073&view=diff
==============================================================================
--- lld/trunk/wasm/Options.td (original)
+++ lld/trunk/wasm/Options.td Fri Aug 17 12:42:46 2018
@@ -23,6 +23,9 @@ def color_diagnostics: F<"color-diagnost
def color_diagnostics_eq: J<"color-diagnostics=">,
HelpText<"Use colors in diagnostics; one of 'always', 'never', 'auto'">;
+def compress_relocations: F<"compress-relocations">,
+ HelpText<"Compress the relocation targets in the code section.">;
+
defm demangle: B<"demangle",
"Demangle symbol names",
"Do not demangle symbol names">;
More information about the llvm-commits
mailing list