[PATCH] D106728: [lld][WebAssembly] Do not remove name section with --strip-debug
Derek Schuff via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 23 17:02:25 PDT 2021
dschuff created this revision.
dschuff added a reviewer: sbc100.
Herald added subscribers: wingo, ecnelises, sunfish, jgravelle-google.
dschuff requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.
Leave the name section in the output when using the --strip-debug
flag. This treats it more like ELF symbol tables, as the name
section has similar uses at runtime (e.g. wasm engines understand
it and it can be used for symbolization at runtime).
Fixes https://github.com/emscripten-core/emscripten/issues/14623
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106728
Files:
lld/test/wasm/strip-debug.test
lld/test/wasm/weak-undefined.s
lld/wasm/SyntheticSections.h
Index: lld/wasm/SyntheticSections.h
===================================================================
--- lld/wasm/SyntheticSections.h
+++ lld/wasm/SyntheticSections.h
@@ -362,9 +362,7 @@
NameSection(ArrayRef<OutputSegment *> segments)
: SyntheticSection(llvm::wasm::WASM_SEC_CUSTOM, "name"),
segments(segments) {}
- bool isNeeded() const override {
- return !config->stripDebug && !config->stripAll && numNames() > 0;
- }
+ bool isNeeded() const override { return !config->stripAll && numNames() > 0; }
void writeBody() override;
unsigned numNames() const { return numNamedGlobals() + numNamedFunctions(); }
unsigned numNamedGlobals() const;
Index: lld/test/wasm/weak-undefined.s
===================================================================
--- lld/test/wasm/weak-undefined.s
+++ lld/test/wasm/weak-undefined.s
@@ -1,5 +1,5 @@
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
-# RUN: wasm-ld -strip-debug %t.o -o %t.wasm
+# RUN: wasm-ld -strip-all %t.o -o %t.wasm
# RUN: obj2yaml %t.wasm | FileCheck %s
# Test that undefined weak externals (global_var) and (foo) don't cause
Index: lld/test/wasm/strip-debug.test
===================================================================
--- lld/test/wasm/strip-debug.test
+++ lld/test/wasm/strip-debug.test
@@ -6,5 +6,5 @@
RUN: wasm-ld -S -o %t.wasm %t.start.o
RUN: obj2yaml %t.wasm | FileCheck %s
-# Check that there is no name section
-CHECK-NOT: Name: name
+# Check that there is a name section
+CHECK: Name: name
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106728.361385.patch
Type: text/x-patch
Size: 1546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210724/ea2703ed/attachment.bin>
More information about the llvm-commits
mailing list