Skip to content

Commit 1488804

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 b020474 commit 1488804

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

ChangeLog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ See docs/process.md for more on how version tagging works.
144144
-----------------
145145
- Initial support for C++20 modules. We have added a very simple test in form
146146
of `other.test_cpp_module`. (#18915)
147+
of `other.test_cpp_module`. (#)
148+
- File names of the files output by `--emit-symbol-map` and `--memory-init-file`
149+
no longer contains the file extension of the output file. This matches the
150+
behaivour of `-sMINIMAL_RUNTIME`. e.g `a.out.js.mem` -> `a.out.js` and
151+
`a.out.js.symbols` -> `a.out.symbols`.
152+
- When targetting `node` (i.e. when node is included in `ENVIRONMENT`) the
153+
output file is now marked as executable and includes a !# line by default.
154+
This can be disabled explictly via `-sEXECUTABLE_OUTPUT=0`.
147155
- Removed `sys/sysctl.h` compatibility header. We don't implement the function
148156
it defines. (#18863)
149157
- 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
@@ -3142,7 +3142,7 @@ def phase_post_link(options, state, in_wasm, wasm_target, target, js_syms):
31423142
if settings.MEM_INIT_IN_WASM:
31433143
memfile = None
31443144
else:
3145-
memfile = shared.replace_or_append_suffix(target, '.mem')
3145+
memfile = shared.replace_suffix(target, '.mem')
31463146

31473147
phase_emscript(options, in_wasm, wasm_target, memfile, js_syms)
31483148

@@ -3760,7 +3760,7 @@ def phase_binaryen(target, options, wasm_target):
37603760

37613761
symbols_file = None
37623762
if options.emit_symbol_map:
3763-
symbols_file = shared.replace_or_append_suffix(target, '.symbols')
3763+
symbols_file = shared.replace_suffix(target, '.symbols')
37643764

37653765
if settings.WASM2JS:
37663766
symbols_file_js = None
@@ -3772,11 +3772,11 @@ def phase_binaryen(target, options, wasm_target):
37723772
write_file(wasm2js_template, wasm2js_polyfill)
37733773
# generate secondary file for JS symbols
37743774
if options.emit_symbol_map:
3775-
symbols_file_js = shared.replace_or_append_suffix(wasm2js_template, '.symbols')
3775+
symbols_file_js = shared.replace_suffix(wasm2js_template, '.symbols')
37763776
else:
37773777
wasm2js_template = final_js
37783778
if options.emit_symbol_map:
3779-
symbols_file_js = shared.replace_or_append_suffix(target, '.symbols')
3779+
symbols_file_js = shared.replace_suffix(target, '.symbols')
37803780

37813781
wasm2js = building.wasm2js(wasm2js_template,
37823782
wasm_target,

site/source/docs/tools_reference/emcc.rst

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

232-
.. 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)
232+
.. note:: When used with ``-sWASM=2``, two symbol files are created. ``[name].symbols`` (with WASM symbols) and ``[name].wasm.symbols`` (with wasm2js symbols)
233233

234234
.. _emcc-lto:
235235

test/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7443,7 +7443,7 @@ def test_demangle_stacks_symbol_map(self):
74437443
# make sure the shortened name is the right one
74447444
full_aborter = None
74457445
short_aborter = None
7446-
for line in open('test_demangle_stacks.js.symbols').readlines():
7446+
for line in open('test_demangle_stacks.symbols').readlines():
74477447
if ':' not in line:
74487448
continue
74497449
# 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
@@ -4450,7 +4450,7 @@ def guess_symbols_file_type(symbols_file):
44504450
cmd.append(f'-sWASM={wasm}')
44514451
self.run_process(cmd)
44524452

4453-
minified_middle = get_minified_middle('a.out.js.symbols')
4453+
minified_middle = get_minified_middle('a.out.symbols')
44544454
self.assertNotEqual(minified_middle, None, "Missing minified 'middle' function")
44554455
if wasm:
44564456
# stack traces are standardized enough that we can easily check that the
@@ -4465,15 +4465,15 @@ def guess_symbols_file_type(symbols_file):
44654465

44664466
# Ensure symbols file type according to `-sWASM=` mode
44674467
if wasm == 0:
4468-
self.assertEqual(guess_symbols_file_type('a.out.js.symbols'), 'js', 'Primary symbols file should store JS mappings')
4468+
self.assertEqual(guess_symbols_file_type('a.out.symbols'), 'js', 'Primary symbols file should store JS mappings')
44694469
elif wasm == 1:
4470-
self.assertEqual(guess_symbols_file_type('a.out.js.symbols'), 'wasm', 'Primary symbols file should store Wasm mappings')
4470+
self.assertEqual(guess_symbols_file_type('a.out.symbols'), 'wasm', 'Primary symbols file should store Wasm mappings')
44714471
elif wasm == 2:
44724472
# special case when both JS and Wasm targets are created
4473-
minified_middle_2 = get_minified_middle('a.out.wasm.js.symbols')
4473+
minified_middle_2 = get_minified_middle('a.out.wasm.symbols')
44744474
self.assertNotEqual(minified_middle_2, None, "Missing minified 'middle' function")
4475-
self.assertEqual(guess_symbols_file_type('a.out.js.symbols'), 'wasm', 'Primary symbols file should store Wasm mappings')
4476-
self.assertEqual(guess_symbols_file_type('a.out.wasm.js.symbols'), 'js', 'Secondary symbols file should store JS mappings')
4475+
self.assertEqual(guess_symbols_file_type('a.out.symbols'), 'wasm', 'Primary symbols file should store Wasm mappings')
4476+
self.assertEqual(guess_symbols_file_type('a.out.wasm.symbols'), 'js', 'Secondary symbols file should store JS mappings')
44774477

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

tools/emdump.py

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

607607

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

tools/shared.py

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

538538

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

0 commit comments

Comments
 (0)