Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/tools/wasm-merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,11 +697,13 @@ Input source maps can be specified by adding an -ism option right after the modu
"",
"Write a wasm-split manifest to the specified file. This manifest can "
"be given to wasm-split to split the merged module along the lines of "
"the original modules.",
"the original modules. Implies --debuginfo to preserve function names "
"in the output module.",
WasmMergeOption,
Options::Arguments::One,
[&manifestFile](Options* o, const std::string& argument) {
[&](Options* o, const std::string& argument) {
manifestFile = argument;
debugInfo = true;
})
.add("--rename-export-conflicts",
"-rec",
Expand Down
3 changes: 2 additions & 1 deletion test/lit/help/wasm-merge.test
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
;; CHECK-NEXT: specified file. This manifest can be
;; CHECK-NEXT: given to wasm-split to split the merged
;; CHECK-NEXT: module along the lines of the original
;; CHECK-NEXT: modules.
;; CHECK-NEXT: modules. Implies --debuginfo to preserve
;; CHECK-NEXT: function names in the output module.
;; CHECK-NEXT:
;; CHECK-NEXT: --rename-export-conflicts,-rec Rename exports to avoid conflicts (rather
;; CHECK-NEXT: than error)
Expand Down
27 changes: 26 additions & 1 deletion test/lit/merge/manifest.wat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
;; RUN: wasm-merge %s first %s.second second %s.third third --output-manifest %t.manifest -S -o %t.wasm
;; RUN: wasm-merge %s first %s.second second %s.third third --output-manifest %t.manifest -o %t.wasm
;; RUN: cat %t.manifest | filecheck %s
;; RUN: wasm-dis %t.wasm -o - | filecheck %s --check-prefix MERGED

;; The first module is the primary module and does not appear in the manifest.
;; CHECK-NOT: first
Expand All @@ -12,6 +13,30 @@
;; CHECK-NEXT: third
;; CHECK-NEXT: qux

;; The binary should contain the original function names.
;; MERGED: (module
;; MERGED-NEXT: (type $0 (func))
;; MERGED-NEXT: (import "env" "imported_first" (func $imported_first))
;; MERGED-NEXT: (import "env" "imported_second" (func $imported_second))
;; MERGED-NEXT: (import "env" "imported_third" (func $imported_third))
;; MERGED-NEXT: (export "foo" (func $foo))
;; MERGED-NEXT: (export "bar" (func $bar))
;; MERGED-NEXT: (export "baz" (func $baz))
;; MERGED-NEXT: (export "qux" (func $qux))
;; MERGED-NEXT: (func $foo
;; MERGED-NEXT: (call $imported_first)
;; MERGED-NEXT: )
;; MERGED-NEXT: (func $bar
;; MERGED-NEXT: (nop)
;; MERGED-NEXT: )
;; MERGED-NEXT: (func $baz
;; MERGED-NEXT: (call $imported_second)
;; MERGED-NEXT: )
;; MERGED-NEXT: (func $qux
;; MERGED-NEXT: (call $imported_third)
;; MERGED-NEXT: )
;; MERGED-NEXT: )

(module
(import "env" "imported_first" (func $imported_first))
(func $foo (export "foo")
Expand Down
Loading