Skip to content

Commit d4a4538

Browse files
authored
Don't strip debug info in unoptimized builds without -g (#12016)
We used to always run wasm-opt's --strip-debug when -g was not specified, which would strip out DWARF as well as the Name section. This changes us to leave it alone. This has no effect on release builds (-O1+) and no effect on proper debug builds (-O0 -g), but does have an effect on unoptimized builds (-O0) without -g, which may now contain DWARF or the Name section now, depending on how clang and wasm-ld were invoked. Part of reducing unnecessary work after link, and aligning us more with what LLVM tools normally do, see WebAssembly/binaryen#3043
1 parent 8b5e1bc commit d4a4538

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ Current Trunk
2424
producer's section in debug builds, you can remove it a tool like
2525
`wasm-opt --strip-producers` (which is what Emscripten still does in release
2626
builds, as always) or use `llvm-objcopy`.
27+
- Only strip debug info in release builds + when `-g` is not present. Previously
28+
even in an `-O0` build without `-g` we would strip it. This was not documented
29+
behavior, and has no effect on program behavior, but may be noticeable
30+
if you inspect a build output with `-O0`.
2731
- Do not remove `__original_main` using `--inline-main`. We used to do this
2832
so that it didn't show up in stack traces (which could be confusing because
2933
it is added by the linker - it's not in the source code). But this has had

emcc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,9 @@ def backend_binaryen_passes():
601601
# hardcoded value in the binaryen pass)
602602
if shared.Settings.OPT_LEVEL > 0 and shared.Settings.GLOBAL_BASE >= 1024:
603603
passes += ['--low-memory-unused']
604-
if shared.Settings.DEBUG_LEVEL < 3:
605-
passes += ['--strip-debug']
606604
if shared.Settings.OPT_LEVEL > 0:
605+
if shared.Settings.DEBUG_LEVEL < 3:
606+
passes += ['--strip-debug']
607607
if not shared.Settings.EMIT_PRODUCERS_SECTION:
608608
passes += ['--strip-producers']
609609
if shared.Settings.AUTODEBUG:

0 commit comments

Comments
 (0)