-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix some source map and name section behavior #23182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -501,12 +501,14 @@ def finalize_wasm(infile, outfile, js_syms): | |
|
|
||
| # if we don't need to modify the wasm, don't tell finalize to emit a wasm file | ||
| modify_wasm = False | ||
| need_name_section = False | ||
|
|
||
| if settings.WASM2JS: | ||
| # wasm2js requires full legalization (and will do extra wasm binary | ||
| # later processing later anyhow) | ||
| modify_wasm = True | ||
| if settings.DEBUG_LEVEL >= 2 or settings.ASYNCIFY_ADD or settings.ASYNCIFY_ADVISE or settings.ASYNCIFY_ONLY or settings.ASYNCIFY_REMOVE or settings.EMIT_SYMBOL_MAP or settings.EMIT_NAME_SECTION: | ||
| need_name_section = True | ||
| args.append('-g') | ||
| if settings.WASM_BIGINT: | ||
| args.append('--bigint') | ||
|
|
@@ -568,12 +570,18 @@ def finalize_wasm(infile, outfile, js_syms): | |
| infile] | ||
| shared.check_call(cmd) | ||
|
|
||
| if not settings.GENERATE_DWARF or not settings.EMIT_PRODUCERS_SECTION: | ||
| # For sections we no longer need, strip now to speed subsequent passes | ||
| # For sections we no longer need, strip now to speed subsequent passes. | ||
| # If Binaryen is not needed, this is also our last chance to strip. | ||
| strip_sections = [] | ||
| if not settings.EMIT_PRODUCERS_SECTION: | ||
| strip_sections += ['producers'] | ||
| if not need_name_section: | ||
| strip_sections += ['name'] | ||
|
|
||
| if strip_sections or not settings.GENERATE_DWARF: | ||
| building.save_intermediate(outfile, 'strip.wasm') | ||
| sections = ['producers'] if not settings.EMIT_PRODUCERS_SECTION else [] | ||
| building.strip(infile, outfile, debug=not settings.GENERATE_DWARF, | ||
| sections=sections) | ||
| sections=strip_sections) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code gives me a headache! LGTM though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the possible combinations of debug options is pretty bad. But I think this (and the previous change, which added all those tests in test_other) is an improvement because it's now more explicit in the emscripten code rather than part of the behavior being implicit with Binaryen. |
||
|
|
||
| metadata = get_metadata(outfile, outfile, modify_wasm, args) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see these TODOs fixed!