Skip to content

Commit

Permalink
Don't strip debug info in unoptimized builds without -g (#12016)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kripken committed Aug 24, 2020
1 parent 8b5e1bc commit d4a4538
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Current Trunk
producer's section in debug builds, you can remove it a tool like
`wasm-opt --strip-producers` (which is what Emscripten still does in release
builds, as always) or use `llvm-objcopy`.
- Only strip debug info in release builds + when `-g` is not present. Previously
even in an `-O0` build without `-g` we would strip it. This was not documented
behavior, and has no effect on program behavior, but may be noticeable
if you inspect a build output with `-O0`.
- Do not remove `__original_main` using `--inline-main`. We used to do this
so that it didn't show up in stack traces (which could be confusing because
it is added by the linker - it's not in the source code). But this has had
Expand Down
4 changes: 2 additions & 2 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,9 @@ def backend_binaryen_passes():
# hardcoded value in the binaryen pass)
if shared.Settings.OPT_LEVEL > 0 and shared.Settings.GLOBAL_BASE >= 1024:
passes += ['--low-memory-unused']
if shared.Settings.DEBUG_LEVEL < 3:
passes += ['--strip-debug']
if shared.Settings.OPT_LEVEL > 0:
if shared.Settings.DEBUG_LEVEL < 3:
passes += ['--strip-debug']
if not shared.Settings.EMIT_PRODUCERS_SECTION:
passes += ['--strip-producers']
if shared.Settings.AUTODEBUG:
Expand Down

0 comments on commit d4a4538

Please sign in to comment.