Skip to content

Commit d6f4231

Browse files
authored
Warn about DWARF inhibiting binaryen opts only when binaryen optimizes (#25889)
If we don't optimize, the warning can be confusing.
1 parent 48f443e commit d6f4231

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

test/test_other.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13412,8 +13412,9 @@ def test_wasm_worker_preprocessor_flags(self):
1341213412
@parameterized({
1341313413
# we will warn here since -O2 runs the optimizer and -g enables DWARF
1341413414
'O2_g': (True, ['-O2', '-g']),
13415-
# asyncify will force wasm-opt to run as well, so we warn here too
13416-
'asyncify_g': (True, ['-sASYNCIFY', '-g']),
13415+
# asyncify will force wasm-opt to run as well, but without optimizations, so
13416+
# we do not warn about the lack of optimization
13417+
'asyncify_g': (False, ['-sASYNCIFY', '-g']),
1341713418
# with --profiling-funcs however we do not use DWARF (we just emit the
1341813419
# names section) and will not warn.
1341913420
'O2_pfuncs': (False, ['-O2', '--profiling-funcs']),

tools/link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,7 @@ def phase_binaryen(target, options, wasm_target):
23502350
intermediate_debug_info -= 1
23512351
# currently binaryen's DWARF support will limit some optimizations; warn on
23522352
# that. see https://github.com/emscripten-core/emscripten/issues/15269
2353-
if settings.GENERATE_DWARF:
2353+
if settings.GENERATE_DWARF and should_run_binaryen_optimizer():
23542354
diagnostics.warning('limited-postlink-optimizations', 'running limited binaryen optimizations because DWARF info requested (or indirectly required)')
23552355
with ToolchainProfiler.profile_block('wasm_opt'):
23562356
building.run_wasm_opt(wasm_target,

0 commit comments

Comments
 (0)