Skip to content

Commit 34ed67a

Browse files
committed
Consistent naming of .symbols and .mem files
This change only effects the names of the side files that are generated from `--emit-symbol-map` and `--memory-init-file`. In these cases we now use the same naming scheme as we do for for MINIMAL_RUNTIME.
1 parent 15f7632 commit 34ed67a

File tree

7 files changed

+20
-21
lines changed

7 files changed

+20
-21
lines changed

ChangeLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ See docs/process.md for more on how version tagging works.
2020

2121
3.1.33 (in development)
2222
-----------------------
23+
- File names of the files output by `--emit-symbol-map` and `--memory-init-file`
24+
no longer contains the file extension of the output file. This matches the
25+
behaivour of `-sMINIMAL_RUNTIME`. e.g `a.out.js.mem` -> `a.out.js` and
26+
`a.out.js.symbols` -> `a.out.symbols`.
27+
- When targetting `node` (i.e. when node is included in `ENVIRONMENT`) the
28+
output file is now marked as executable and includes a !# line by default.
29+
This can be disabled explictly via `-sEXECUTABLE_OUTPUT=0`.
2330
- Removed `sys/sysctl.h` compatibility header. We don't implement the function
2431
it defines. (#18863)
2532
- Update SDL2_ttf port to 2.20.2 (#18804)

emcc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,7 +3116,7 @@ def phase_post_link(options, state, in_wasm, wasm_target, target):
31163116
if settings.MEM_INIT_IN_WASM:
31173117
memfile = None
31183118
else:
3119-
memfile = shared.replace_or_append_suffix(target, '.mem')
3119+
memfile = shared.replace_suffix(target, '.mem')
31203120

31213121
phase_emscript(options, in_wasm, wasm_target, memfile)
31223122

@@ -3757,7 +3757,7 @@ def preprocess_wasm2js_script():
37573757

37583758
symbols_file = None
37593759
if options.emit_symbol_map:
3760-
symbols_file = shared.replace_or_append_suffix(target, '.symbols')
3760+
symbols_file = shared.replace_suffix(target, '.symbols')
37613761

37623762
if settings.WASM2JS:
37633763
symbols_file_js = None
@@ -3766,11 +3766,11 @@ def preprocess_wasm2js_script():
37663766
write_file(wasm2js_template, preprocess_wasm2js_script())
37673767
# generate secondary file for JS symbols
37683768
if options.emit_symbol_map:
3769-
symbols_file_js = shared.replace_or_append_suffix(wasm2js_template, '.symbols')
3769+
symbols_file_js = shared.replace_suffix(wasm2js_template, '.symbols')
37703770
else:
37713771
wasm2js_template = final_js
37723772
if options.emit_symbol_map:
3773-
symbols_file_js = shared.replace_or_append_suffix(target, '.symbols')
3773+
symbols_file_js = shared.replace_suffix(target, '.symbols')
37743774

37753775
wasm2js = building.wasm2js(wasm2js_template,
37763776
wasm_target,

site/source/docs/tools_reference/emcc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Options that are modified or new in *emcc* are listed below:
222222
can still reconstruct meaningful stack traces by translating the indexes back
223223
to the names.
224224

225-
.. note:: When used with ``-sWASM=2``, two symbol files are created. ``[name].js.symbols`` (with WASM symbols) and ``[name].wasm.js.symbols`` (with ASM.js symbols)
225+
.. note:: When used with ``-sWASM=2``, two symbol files are created. ``[name].symbols`` (with WASM symbols) and ``[name].wasm.symbols`` (with wasm2js symbols)
226226

227227
.. _emcc-lto:
228228

test/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7426,7 +7426,7 @@ def test_demangle_stacks_symbol_map(self):
74267426
# make sure the shortened name is the right one
74277427
full_aborter = None
74287428
short_aborter = None
7429-
for line in open('test_demangle_stacks.js.symbols').readlines():
7429+
for line in open('test_demangle_stacks.symbols').readlines():
74307430
if ':' not in line:
74317431
continue
74327432
# split by the first ':' (wasm backend demangling may include more :'s later on)

test/test_other.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4315,7 +4315,7 @@ def guess_symbols_file_type(symbols_file):
43154315
cmd.append(f'-sWASM={wasm}')
43164316
self.run_process(cmd)
43174317

4318-
minified_middle = get_minified_middle('a.out.js.symbols')
4318+
minified_middle = get_minified_middle('a.out.symbols')
43194319
self.assertNotEqual(minified_middle, None, "Missing minified 'middle' function")
43204320
if wasm:
43214321
# stack traces are standardized enough that we can easily check that the
@@ -4330,15 +4330,15 @@ def guess_symbols_file_type(symbols_file):
43304330

43314331
# Ensure symbols file type according to `-sWASM=` mode
43324332
if wasm == 0:
4333-
self.assertEqual(guess_symbols_file_type('a.out.js.symbols'), 'js', 'Primary symbols file should store JS mappings')
4333+
self.assertEqual(guess_symbols_file_type('a.out.symbols'), 'js', 'Primary symbols file should store JS mappings')
43344334
elif wasm == 1:
4335-
self.assertEqual(guess_symbols_file_type('a.out.js.symbols'), 'wasm', 'Primary symbols file should store Wasm mappings')
4335+
self.assertEqual(guess_symbols_file_type('a.out.symbols'), 'wasm', 'Primary symbols file should store Wasm mappings')
43364336
elif wasm == 2:
43374337
# special case when both JS and Wasm targets are created
4338-
minified_middle_2 = get_minified_middle('a.out.wasm.js.symbols')
4338+
minified_middle_2 = get_minified_middle('a.out.wasm.symbols')
43394339
self.assertNotEqual(minified_middle_2, None, "Missing minified 'middle' function")
4340-
self.assertEqual(guess_symbols_file_type('a.out.js.symbols'), 'wasm', 'Primary symbols file should store Wasm mappings')
4341-
self.assertEqual(guess_symbols_file_type('a.out.wasm.js.symbols'), 'js', 'Secondary symbols file should store JS mappings')
4340+
self.assertEqual(guess_symbols_file_type('a.out.symbols'), 'wasm', 'Primary symbols file should store Wasm mappings')
4341+
self.assertEqual(guess_symbols_file_type('a.out.wasm.symbols'), 'js', 'Secondary symbols file should store JS mappings')
43424342

43434343
# check we don't keep unnecessary debug info with wasm2js when emitting
43444344
# a symbol map

tools/emdump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def read_symbol_map(filename):
631631
return symbol_map
632632

633633

634-
# Locates foo.js to foo.js.symbols or foo.html.symbols based on default output name rules for Emscripten compiler
634+
# Locates foo.js to foo.symbols or foo.html.symbols based on default output name rules for Emscripten compiler
635635
def guess_symbol_map_file_location(sources, symbol_map_file):
636636
if os.path.isfile(symbol_map_file):
637637
return symbol_map_file

tools/shared.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -535,14 +535,6 @@ def replace_suffix(filename, new_suffix):
535535
return os.path.splitext(filename)[0] + new_suffix
536536

537537

538-
# In MINIMAL_RUNTIME mode, keep suffixes of generated files simple
539-
# ('.mem' instead of '.js.mem'; .'symbols' instead of '.js.symbols' etc)
540-
# Retain the original naming scheme in traditional runtime.
541-
def replace_or_append_suffix(filename, new_suffix):
542-
assert new_suffix[0] == '.'
543-
return replace_suffix(filename, new_suffix) if settings.MINIMAL_RUNTIME else filename + new_suffix
544-
545-
546538
# Temp dir. Create a random one, unless EMCC_DEBUG is set, in which case use the canonical
547539
# temp directory (TEMP_DIR/emscripten_temp).
548540
@memoize

0 commit comments

Comments
 (0)