summaryrefslogtreecommitdiffstats
path: root/lld/test/wasm/import-table.test
diff options
context:
space:
mode:
authorNicholas Wilson <nicholas@nicholaswilson.me.uk>2018-03-27 17:38:51 +0000
committerNicholas Wilson <nicholas@nicholaswilson.me.uk>2018-03-27 17:38:51 +0000
commit874eedd779d9e447708d88529ea0beb77863328a (patch)
tree5712bde73430d3fb7f822efe0ec0d1e2d460c54a /lld/test/wasm/import-table.test
parentca1d849cd68e5db132e38cb9d9d80ba3afb8ca06 (diff)
downloadbcm5719-llvm-874eedd779d9e447708d88529ea0beb77863328a.tar.gz
bcm5719-llvm-874eedd779d9e447708d88529ea0beb77863328a.zip
[WebAssembly] Add export/import for function pointer table
This enables callback-style programming where the JavaScript environment can call back into the Wasm environment using a function pointer received from the module. Differential Revision: https://reviews.llvm.org/D44427 llvm-svn: 328643
Diffstat (limited to 'lld/test/wasm/import-table.test')
-rw-r--r--lld/test/wasm/import-table.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/lld/test/wasm/import-table.test b/lld/test/wasm/import-table.test
new file mode 100644
index 00000000000..98e07491ec4
--- /dev/null
+++ b/lld/test/wasm/import-table.test
@@ -0,0 +1,18 @@
+# RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.start.o
+# RUN: wasm-ld --check-signatures --import-table -o %t.wasm %t.start.o
+# RUN: obj2yaml %t.wasm | FileCheck %s
+
+# Verify the --import-table flag creates a table import
+
+# CHECK: - Type: IMPORT
+# CHECK-NEXT: Imports:
+# CHECK-NEXT: - Module: env
+# CHECK-NEXT: Field: __indirect_function_table
+# CHECK-NEXT: Kind: TABLE
+# CHECK-NEXT: Table:
+# CHECK-NEXT: ElemType: ANYFUNC
+# CHECK-NEXT: Limits:
+# CHECK-NEXT: Flags: [ HAS_MAX ]
+# CHECK-NEXT: Initial: 0x00000001
+# CHECK-NEXT: Maximum: 0x00000001
+
OpenPOWER on IntegriCloud