Skip to content

Commit 5532f29

Browse files
committed
review comments; fix name section emission
1 parent 9eaa392 commit 5532f29

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

emcc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,13 @@ def consume_arg_file():
12591259
if is_int(requested_level):
12601260
# the -gX value is the debug level (-g1, -g2, etc.)
12611261
settings.DEBUG_LEVEL = validate_arg_level(requested_level, 4, 'invalid debug level: ' + arg)
1262+
if settings.DEBUG_LEVEL == 0:
1263+
# Set these explicitly so -g0 overrides previous -g on the cmdline
1264+
settings.GENERATE_DWARF = 0
1265+
settings.GENERATE_SOURCE_MAP = 0
1266+
settings.EMIT_NAME_SECTION = 0
1267+
elif settings.DEBUG_LEVEL > 1:
1268+
settings.EMIT_NAME_SECTION = 1
12621269
# if we don't need to preserve LLVM debug info, do not keep this flag
12631270
# for clang
12641271
if settings.DEBUG_LEVEL < 3:
@@ -1289,17 +1296,20 @@ def consume_arg_file():
12891296
settings.GENERATE_DWARF = 1
12901297
elif requested_level == 'source-map':
12911298
settings.GENERATE_SOURCE_MAP = 1
1299+
settings.EMIT_NAME_SECTION = 1
12921300
newargs[i] = '-g'
12931301
else:
12941302
# Other non-integer levels (e.g. -gline-tables-only or -gdwarf-5) are
12951303
# usually clang flags that emit DWARF. So we pass them through to
12961304
# clang and make the emscripten code treat it like any other DWARF.
12971305
settings.GENERATE_DWARF = 1
1306+
settings.EMIT_NAME_SECTION = 1
12981307
# In all cases set the emscripten debug level to 3 so that we do not
12991308
# strip during link (during compile, this does not make a difference).
13001309
settings.DEBUG_LEVEL = 3
13011310
elif check_flag('-profiling') or check_flag('--profiling'):
13021311
settings.DEBUG_LEVEL = max(settings.DEBUG_LEVEL, 2)
1312+
settings.EMIT_NAME_SECTION = 1
13031313
elif check_flag('-profiling-funcs') or check_flag('--profiling-funcs'):
13041314
settings.EMIT_NAME_SECTION = 1
13051315
elif newargs[i] == '--tracing' or newargs[i] == '--memoryprofiler':

test/test_core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8414,7 +8414,6 @@ def test_wasm2js(self):
84148414
if self.is_wasm2js():
84158415
self.skipTest('redundant to test wasm2js in wasm2js* mode')
84168416
self.set_setting('WASM', 0)
8417-
self.set_setting('WASM_BIGINT', 0)
84188417
self.do_core_test('test_hello_world.c')
84198418
self.assertNotExists('test_hello_world.js.mem')
84208419

test/test_other.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3079,8 +3079,7 @@ def test_dwarf_sourcemap_names(self):
30793079
# TODO: It seems odd that -gsource-map leaves behind a name section. Should it?
30803080
(['-gsource-map'], False, True, True),
30813081
(['-g1', '-Oz', '-gsource-map'], False, True, True),
3082-
# -g0 does not override -gsource-map but does remove name section. TODO: should it?
3083-
(['-gsource-map', '-g0'], False, True, False),
3082+
(['-gsource-map', '-g0'], False, False, False),
30843083
# --emit-symbol-map should not affect the results
30853084
(['--emit-symbol-map', '-gsource-map'], False, True, True),
30863085
(['--emit-symbol-map'], False, False, False),

tools/emscripten.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,12 +566,17 @@ def finalize_wasm(infile, outfile, js_syms):
566566
infile]
567567
shared.check_call(cmd)
568568

569-
if not settings.GENERATE_DWARF or not settings.EMIT_PRODUCERS_SECTION:
570-
# For sections we no longer need, strip now to speed subsequent passes
569+
# For sections we no longer need, strip now to speed subsequent passes
570+
strip_sections = []
571+
if not settings.EMIT_PRODUCERS_SECTION:
572+
strip_sections += ['producers']
573+
if not settings.EMIT_NAME_SECTION:
574+
strip_sections += ['name']
575+
576+
if strip_sections or not settings.GENERATE_DWARF:
571577
building.save_intermediate(outfile, 'strip.wasm')
572-
sections = ['producers'] if not settings.EMIT_PRODUCERS_SECTION else []
573578
building.strip(infile, outfile, debug=not settings.GENERATE_DWARF,
574-
sections=sections)
579+
sections=strip_sections)
575580

576581
metadata = get_metadata(outfile, outfile, modify_wasm, args)
577582

tools/feature_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Feature(IntEnum):
6666
Feature.JS_BIGINT_INTEGRATION: {
6767
'chrome': 67,
6868
'firefox': 68,
69-
'safari': 140100,
69+
'safari': 140100, # TODO: set this back to 15 after we update the default targets.
7070
},
7171
Feature.THREADS: {
7272
'chrome': 74,

tools/link.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,8 @@ def phase_linker_setup(options, state, newargs):
788788
settings.WASM2JS = 1
789789
# Wasm bigint doesn't make sense with wasm2js, since it controls how the
790790
# wasm and JS interact.
791-
settings.WASM_BIGINT = 0
792-
feature_matrix.disable_feature(feature_matrix.Feature.JS_BIGINT_INTEGRATION)
791+
if settings.WASM_BIGINT:
792+
exit_with_error('WASM_BIGINT is not compatible with WASM=0')
793793
if settings.WASM == 2:
794794
# Requesting both Wasm and Wasm2JS support
795795
settings.WASM2JS = 1
@@ -1390,8 +1390,7 @@ def phase_linker_setup(options, state, newargs):
13901390
settings.SUPPORTS_PROMISE_ANY = feature_matrix.caniuse(feature_matrix.Feature.PROMISE_ANY)
13911391
if not settings.BULK_MEMORY:
13921392
settings.BULK_MEMORY = feature_matrix.caniuse(feature_matrix.Feature.BULK_MEMORY)
1393-
if 'WASM_BIGINT' not in user_settings:
1394-
settings.WASM_BIGINT = feature_matrix.caniuse(feature_matrix.Feature.JS_BIGINT_INTEGRATION)
1393+
default_setting('WASM_BIGINT', feature_matrix.caniuse(feature_matrix.Feature.JS_BIGINT_INTEGRATION))
13951394

13961395
if settings.AUDIO_WORKLET:
13971396
if settings.AUDIO_WORKLET == 1:

0 commit comments

Comments
 (0)