summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/help/wasm-split.test5
-rw-r--r--test/lit/wasm-split/no-placeholders.wast54
2 files changed, 59 insertions, 0 deletions
diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test
index dc521a82f..4fa534e43 100644
--- a/test/lit/help/wasm-split.test
+++ b/test/lit/help/wasm-split.test
@@ -52,6 +52,11 @@
;; CHECK-NEXT: --symbolmap [split] Write a symbol map file for each
;; CHECK-NEXT: of the output modules.
;; CHECK-NEXT:
+;; CHECK-NEXT: --no-placeholders [split] Do not import placeholder
+;; CHECK-NEXT: functions. Calls to secondary functions
+;; CHECK-NEXT: will fail before the secondary module has
+;; CHECK-NEXT: been instantiated.
+;; CHECK-NEXT:
;; CHECK-NEXT: --placeholdermap [split] Write a file mapping placeholder
;; CHECK-NEXT: indices to the function names.
;; CHECK-NEXT:
diff --git a/test/lit/wasm-split/no-placeholders.wast b/test/lit/wasm-split/no-placeholders.wast
new file mode 100644
index 000000000..d3f8fd676
--- /dev/null
+++ b/test/lit/wasm-split/no-placeholders.wast
@@ -0,0 +1,54 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: wasm-split %s -all --no-placeholders --split-funcs=bar,baz -g -o1 %t.1.wasm -o2 %t.2.wasm
+;; RUN: wasm-dis %t.1.wasm | filecheck %s --check-prefix PRIMARY
+;; RUN: wasm-dis %t.2.wasm | filecheck %s --check-prefix SECONDARY
+
+(module
+ ;; PRIMARY: (type $0 (func))
+
+ ;; PRIMARY: (table $0 2 funcref)
+
+ ;; PRIMARY: (elem $0 (table $0) (i32.const 0) funcref (item (ref.null nofunc)) (item (ref.null nofunc)))
+
+ ;; PRIMARY: (export "foo" (func $foo))
+
+ ;; PRIMARY: (export "table" (table $0))
+
+ ;; PRIMARY: (func $foo
+ ;; PRIMARY-NEXT: (call_indirect (type $0)
+ ;; PRIMARY-NEXT: (i32.const 0)
+ ;; PRIMARY-NEXT: )
+ ;; PRIMARY-NEXT: (call_indirect (type $0)
+ ;; PRIMARY-NEXT: (i32.const 1)
+ ;; PRIMARY-NEXT: )
+ ;; PRIMARY-NEXT: )
+ (func $foo
+ (call $bar)
+ (call $baz)
+ )
+ ;; SECONDARY: (type $0 (func))
+
+ ;; SECONDARY: (import "primary" "table" (table $timport$0 2 funcref))
+
+ ;; SECONDARY: (import "primary" "foo" (func $foo))
+
+ ;; SECONDARY: (elem $0 (i32.const 0) $bar $baz)
+
+ ;; SECONDARY: (func $bar
+ ;; SECONDARY-NEXT: (call $foo)
+ ;; SECONDARY-NEXT: (call $baz)
+ ;; SECONDARY-NEXT: )
+ (func $bar
+ (call $foo)
+ (call $baz)
+ )
+ ;; SECONDARY: (func $baz
+ ;; SECONDARY-NEXT: (call $foo)
+ ;; SECONDARY-NEXT: (call $bar)
+ ;; SECONDARY-NEXT: )
+ (func $baz
+ (call $foo)
+ (call $bar)
+ )
+)