Skip to content

Commit 739e14f

Browse files
authored
Fix --post-link combined with -s flags (#24270)
Fixes: #24250
1 parent 4730aa9 commit 739e14f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

emcc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,8 @@ def parse_args(newargs): # noqa: C901, PLR0912, PLR0915
10471047
# because that next arg could, for example, start with `-o` and we don't want
10481048
# to confuse that with a normal `-o` flag.
10491049
skip = True
1050+
elif arg == '-s' and is_dash_s_for_emcc(newargs, i):
1051+
skip = True
10501052

10511053
def check_flag(value):
10521054
# Check for and consume a flag

test/test_other.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13417,7 +13417,9 @@ def test_closure_safe(self, args):
1341713417
def test_post_link(self):
1341813418
err = self.run_process([EMCC, test_file('hello_world.c'), '--oformat=bare', '-o', 'bare.wasm'], stderr=PIPE).stderr
1341913419
self.assertContained('--oformat=bare/--post-link are experimental and subject to change', err)
13420-
err = self.run_process([EMCC, '--post-link', 'bare.wasm'], stderr=PIPE).stderr
13420+
# Explicitly test with `-s RUNTIME_DEBUG`, including the space, to verify parsing of `-s` flags
13421+
# See https://github.com/emscripten-core/emscripten/issues/24250
13422+
err = self.run_process([EMCC, '--post-link', 'bare.wasm', '-s', 'RUNTIME_DEBUG'], stderr=PIPE).stderr
1342113423
self.assertContained('--oformat=bare/--post-link are experimental and subject to change', err)
1342213424
err = self.assertContained('hello, world!', self.run_js('a.out.js'))
1342313425

0 commit comments

Comments
 (0)