diff --git a/lld/test/wasm/strip-debug.test b/lld/test/wasm/strip-debug.test --- a/lld/test/wasm/strip-debug.test +++ b/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 diff --git a/lld/test/wasm/weak-undefined.s b/lld/test/wasm/weak-undefined.s --- a/lld/test/wasm/weak-undefined.s +++ b/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 diff --git a/lld/wasm/SyntheticSections.h b/lld/wasm/SyntheticSections.h --- a/lld/wasm/SyntheticSections.h +++ b/lld/wasm/SyntheticSections.h @@ -362,9 +362,7 @@ NameSection(ArrayRef 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;