From afdeea97a787082b40b878bc8e7b7eb0ffa95a2f Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 27 Oct 2025 14:53:44 +0000 Subject: [PATCH 1/4] [empath-split] End module names with : in manfests This makes better distinction of module names and function lists. Suggested by by @sbc100 (https://github.com/emscripten-core/emscripten/pull/25577#discussion_r2456521570). This has to land after https://github.com/WebAssembly/binaryen/pull/8003. --- tools/empath-split.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/empath-split.py b/tools/empath-split.py index d92e1c98c536d..bd86f4d76ab98 100755 --- a/tools/empath-split.py +++ b/tools/empath-split.py @@ -337,7 +337,7 @@ def main(): print(' ' + func) print() - f.write(f'{module}\n') + f.write(f'{module}:\n') for func in funcs: f.write(func + '\n') f.close() From af3b6548448e990f65ce465d875d14714ba61ca3 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 27 Oct 2025 15:02:38 +0000 Subject: [PATCH 2/4] Update test --- test/test_other.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_other.py b/test/test_other.py index e71660697e280..199f12c9bdd01 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -15078,14 +15078,14 @@ def test_empath_split(self): void foo() { std::cout << "foo" << std::endl; } ''') create_file('path_list.txt', r''' - myapp + myapp: main.cpp foo.cpp - lib1 + lib1: /emsdk/emscripten/system - lib2 + lib2: /emsdk/emscripten/system/lib/libc/musl /emsdk/emscripten/system/lib/libcxx ''') From 093116883ed2ce666c3ac2f3f36805044721b0ff Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 27 Oct 2025 15:19:00 +0000 Subject: [PATCH 3/4] Update paths file parsing --- tools/empath-split.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/empath-split.py b/tools/empath-split.py index bd86f4d76ab98..4a475e0fea8d2 100755 --- a/tools/empath-split.py +++ b/tools/empath-split.py @@ -276,7 +276,9 @@ def parse_paths_file(paths_file_content): continue if not cur_module: - cur_module = line + cur_module = line[:-1] + if not cur_module: + exit_with_error("Module name is empty") else: path = normalize_path(line) if path in path_to_module: From 1e7b8688450b8464db02b4a4e728b6182b10092d Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 28 Oct 2025 21:54:10 +0000 Subject: [PATCH 4/4] More error handling + comment fix --- tools/empath-split.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/empath-split.py b/tools/empath-split.py index 4a475e0fea8d2..3b66d02f7c8a5 100755 --- a/tools/empath-split.py +++ b/tools/empath-split.py @@ -25,12 +25,13 @@ to split modules. The format is similar to the manifest file for wasm-split, but with paths instead of function names. A module is defined by a name on a line, followed by paths on subsequent lines. Modules are separated by empty lines. +Module names be written with a colon (:). For example: -module1 +module1: path/to/a path/to/b -module2 +module2: path/to/c This will create two modules, 'module1' and 'module2'. 'module1' will contain @@ -276,9 +277,11 @@ def parse_paths_file(paths_file_content): continue if not cur_module: - cur_module = line[:-1] - if not cur_module: + if line[-1] != ':': + exit_with_error(f"Module name should end with a colon: {line}") + if len(line) == 1: exit_with_error("Module name is empty") + cur_module = line[:-1] else: path = normalize_path(line) if path in path_to_module: