summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lld/main_module_table.wat9
-rw-r--r--test/lld/main_module_table.wat.out106
-rw-r--r--test/lld/main_module_table_2.wat10
-rw-r--r--test/lld/main_module_table_2.wat.out106
-rw-r--r--test/lld/main_module_table_3.wat11
-rw-r--r--test/lld/main_module_table_3.wat.out106
-rw-r--r--test/lld/main_module_table_4.wat12
-rw-r--r--test/lld/main_module_table_4.wat.out108
-rw-r--r--test/lld/main_module_table_5.wat16
-rw-r--r--test/lld/main_module_table_5.wat.out114
10 files changed, 598 insertions, 0 deletions
diff --git a/test/lld/main_module_table.wat b/test/lld/main_module_table.wat
new file mode 100644
index 000000000..b63b4d8fe
--- /dev/null
+++ b/test/lld/main_module_table.wat
@@ -0,0 +1,9 @@
+(module
+ (import "env" "__stack_pointer" (global $sp (mut i32)))
+ (import "GOT.func" "__stdio_write" (global $gimport$9 (mut i32)))
+ (global $global i32 (i32.const 42))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (func $__stdio_write
+ )
+)
diff --git a/test/lld/main_module_table.wat.out b/test/lld/main_module_table.wat.out
new file mode 100644
index 000000000..fd292809f
--- /dev/null
+++ b/test/lld/main_module_table.wat.out
@@ -0,0 +1,106 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_none (func (param i32)))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (import "env" "__stack_pointer" (global $sp_import i32))
+ (table $0 1 funcref)
+ (elem (i32.const 0) $__stdio_write)
+ (global $gimport$9 (mut i32) (i32.const 0))
+ (global $global i32 (i32.const 42))
+ (global $sp (mut i32) (global.get $sp_import))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (export "__growWasmMemory" (func $__growWasmMemory))
+ (export "__assign_got_enties" (func $__assign_got_enties))
+ (export "dynCall_v" (func $dynCall_v))
+ (func $__stdio_write (; 0 ;)
+ (nop)
+ )
+ (func $stackSave (; 1 ;) (result i32)
+ (global.get $sp)
+ )
+ (func $stackAlloc (; 2 ;) (param $0 i32) (result i32)
+ (local $1 i32)
+ (global.set $sp
+ (local.tee $1
+ (i32.and
+ (i32.sub
+ (global.get $sp)
+ (local.get $0)
+ )
+ (i32.const -16)
+ )
+ )
+ )
+ (local.get $1)
+ )
+ (func $stackRestore (; 3 ;) (param $0 i32)
+ (global.set $sp
+ (local.get $0)
+ )
+ )
+ (func $__growWasmMemory (; 4 ;) (param $newSize i32) (result i32)
+ (memory.grow
+ (local.get $newSize)
+ )
+ )
+ (func $__assign_got_enties (; 5 ;)
+ (global.set $gimport$9
+ (i32.add
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ )
+ (func $dynCall_v (; 6 ;) (param $fptr i32)
+ (call_indirect (type $none_=>_none)
+ (local.get $fptr)
+ )
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "staticBump": 4294966770,
+ "tableSize": 1,
+ "initializers": [
+ "__assign_got_enties"
+ ],
+ "declares": [
+ ],
+ "externs": [
+ "___stack_pointer"
+ ],
+ "implementedFunctions": [
+ "___stdio_write",
+ "_stackSave",
+ "_stackAlloc",
+ "_stackRestore",
+ "___growWasmMemory",
+ "___assign_got_enties",
+ "_dynCall_v"
+ ],
+ "exports": [
+ "__stdio_write",
+ "stackSave",
+ "stackAlloc",
+ "stackRestore",
+ "__growWasmMemory",
+ "__assign_got_enties",
+ "dynCall_v"
+ ],
+ "namedGlobals": {
+ "__data_end" : "42"
+ },
+ "invokeFuncs": [
+ ],
+ "features": [
+ ],
+ "mainReadsParams": 0
+}
+-- END METADATA --
+;)
diff --git a/test/lld/main_module_table_2.wat b/test/lld/main_module_table_2.wat
new file mode 100644
index 000000000..2ccc1fbcc
--- /dev/null
+++ b/test/lld/main_module_table_2.wat
@@ -0,0 +1,10 @@
+(module
+ (import "env" "__stack_pointer" (global $sp (mut i32)))
+ (import "GOT.func" "__stdio_write" (global $gimport$9 (mut i32)))
+ (import "env" "table" (table $timport$9 1 funcref))
+ (global $global i32 (i32.const 42))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (func $__stdio_write
+ )
+)
diff --git a/test/lld/main_module_table_2.wat.out b/test/lld/main_module_table_2.wat.out
new file mode 100644
index 000000000..92a40d5f2
--- /dev/null
+++ b/test/lld/main_module_table_2.wat.out
@@ -0,0 +1,106 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_none (func (param i32)))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (import "env" "table" (table $0 2 funcref))
+ (elem (i32.const 0) $__stdio_write)
+ (import "env" "__stack_pointer" (global $sp_import i32))
+ (global $gimport$9 (mut i32) (i32.const 0))
+ (global $global i32 (i32.const 42))
+ (global $sp (mut i32) (global.get $sp_import))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (export "__growWasmMemory" (func $__growWasmMemory))
+ (export "__assign_got_enties" (func $__assign_got_enties))
+ (export "dynCall_v" (func $dynCall_v))
+ (func $__stdio_write (; 0 ;)
+ (nop)
+ )
+ (func $stackSave (; 1 ;) (result i32)
+ (global.get $sp)
+ )
+ (func $stackAlloc (; 2 ;) (param $0 i32) (result i32)
+ (local $1 i32)
+ (global.set $sp
+ (local.tee $1
+ (i32.and
+ (i32.sub
+ (global.get $sp)
+ (local.get $0)
+ )
+ (i32.const -16)
+ )
+ )
+ )
+ (local.get $1)
+ )
+ (func $stackRestore (; 3 ;) (param $0 i32)
+ (global.set $sp
+ (local.get $0)
+ )
+ )
+ (func $__growWasmMemory (; 4 ;) (param $newSize i32) (result i32)
+ (memory.grow
+ (local.get $newSize)
+ )
+ )
+ (func $__assign_got_enties (; 5 ;)
+ (global.set $gimport$9
+ (i32.add
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ )
+ (func $dynCall_v (; 6 ;) (param $fptr i32)
+ (call_indirect (type $none_=>_none)
+ (local.get $fptr)
+ )
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "staticBump": 4294966770,
+ "tableSize": 2,
+ "initializers": [
+ "__assign_got_enties"
+ ],
+ "declares": [
+ ],
+ "externs": [
+ "___stack_pointer"
+ ],
+ "implementedFunctions": [
+ "___stdio_write",
+ "_stackSave",
+ "_stackAlloc",
+ "_stackRestore",
+ "___growWasmMemory",
+ "___assign_got_enties",
+ "_dynCall_v"
+ ],
+ "exports": [
+ "__stdio_write",
+ "stackSave",
+ "stackAlloc",
+ "stackRestore",
+ "__growWasmMemory",
+ "__assign_got_enties",
+ "dynCall_v"
+ ],
+ "namedGlobals": {
+ "__data_end" : "42"
+ },
+ "invokeFuncs": [
+ ],
+ "features": [
+ ],
+ "mainReadsParams": 0
+}
+-- END METADATA --
+;)
diff --git a/test/lld/main_module_table_3.wat b/test/lld/main_module_table_3.wat
new file mode 100644
index 000000000..2f7d92ebf
--- /dev/null
+++ b/test/lld/main_module_table_3.wat
@@ -0,0 +1,11 @@
+(module
+ (import "env" "__stack_pointer" (global $sp (mut i32)))
+ (import "GOT.func" "__stdio_write" (global $gimport$9 (mut i32)))
+ (import "env" "table" (table $timport$9 1 funcref))
+ (elem (i32.const 0))
+ (global $global i32 (i32.const 42))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (func $__stdio_write
+ )
+)
diff --git a/test/lld/main_module_table_3.wat.out b/test/lld/main_module_table_3.wat.out
new file mode 100644
index 000000000..92a40d5f2
--- /dev/null
+++ b/test/lld/main_module_table_3.wat.out
@@ -0,0 +1,106 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_none (func (param i32)))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (import "env" "table" (table $0 2 funcref))
+ (elem (i32.const 0) $__stdio_write)
+ (import "env" "__stack_pointer" (global $sp_import i32))
+ (global $gimport$9 (mut i32) (i32.const 0))
+ (global $global i32 (i32.const 42))
+ (global $sp (mut i32) (global.get $sp_import))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (export "__growWasmMemory" (func $__growWasmMemory))
+ (export "__assign_got_enties" (func $__assign_got_enties))
+ (export "dynCall_v" (func $dynCall_v))
+ (func $__stdio_write (; 0 ;)
+ (nop)
+ )
+ (func $stackSave (; 1 ;) (result i32)
+ (global.get $sp)
+ )
+ (func $stackAlloc (; 2 ;) (param $0 i32) (result i32)
+ (local $1 i32)
+ (global.set $sp
+ (local.tee $1
+ (i32.and
+ (i32.sub
+ (global.get $sp)
+ (local.get $0)
+ )
+ (i32.const -16)
+ )
+ )
+ )
+ (local.get $1)
+ )
+ (func $stackRestore (; 3 ;) (param $0 i32)
+ (global.set $sp
+ (local.get $0)
+ )
+ )
+ (func $__growWasmMemory (; 4 ;) (param $newSize i32) (result i32)
+ (memory.grow
+ (local.get $newSize)
+ )
+ )
+ (func $__assign_got_enties (; 5 ;)
+ (global.set $gimport$9
+ (i32.add
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ )
+ (func $dynCall_v (; 6 ;) (param $fptr i32)
+ (call_indirect (type $none_=>_none)
+ (local.get $fptr)
+ )
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "staticBump": 4294966770,
+ "tableSize": 2,
+ "initializers": [
+ "__assign_got_enties"
+ ],
+ "declares": [
+ ],
+ "externs": [
+ "___stack_pointer"
+ ],
+ "implementedFunctions": [
+ "___stdio_write",
+ "_stackSave",
+ "_stackAlloc",
+ "_stackRestore",
+ "___growWasmMemory",
+ "___assign_got_enties",
+ "_dynCall_v"
+ ],
+ "exports": [
+ "__stdio_write",
+ "stackSave",
+ "stackAlloc",
+ "stackRestore",
+ "__growWasmMemory",
+ "__assign_got_enties",
+ "dynCall_v"
+ ],
+ "namedGlobals": {
+ "__data_end" : "42"
+ },
+ "invokeFuncs": [
+ ],
+ "features": [
+ ],
+ "mainReadsParams": 0
+}
+-- END METADATA --
+;)
diff --git a/test/lld/main_module_table_4.wat b/test/lld/main_module_table_4.wat
new file mode 100644
index 000000000..a991de4bb
--- /dev/null
+++ b/test/lld/main_module_table_4.wat
@@ -0,0 +1,12 @@
+(module
+ (import "env" "__stack_pointer" (global $sp (mut i32)))
+ (import "GOT.func" "__stdio_write" (global $gimport$9 (mut i32)))
+ (import "env" "__table_base" (global $tb i32))
+ (import "env" "table" (table $timport$9 1 funcref))
+ (elem (global.get $tb))
+ (global $global i32 (i32.const 42))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (func $__stdio_write
+ )
+)
diff --git a/test/lld/main_module_table_4.wat.out b/test/lld/main_module_table_4.wat.out
new file mode 100644
index 000000000..db2ef3cd8
--- /dev/null
+++ b/test/lld/main_module_table_4.wat.out
@@ -0,0 +1,108 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_none (func (param i32)))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (import "env" "table" (table $0 2 funcref))
+ (elem (global.get $tb) $__stdio_write)
+ (import "env" "__stack_pointer" (global $sp_import i32))
+ (import "env" "__table_base" (global $tb i32))
+ (global $gimport$9 (mut i32) (i32.const 0))
+ (global $global i32 (i32.const 42))
+ (global $sp (mut i32) (global.get $sp_import))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (export "__growWasmMemory" (func $__growWasmMemory))
+ (export "__assign_got_enties" (func $__assign_got_enties))
+ (export "dynCall_v" (func $dynCall_v))
+ (func $__stdio_write (; 0 ;)
+ (nop)
+ )
+ (func $stackSave (; 1 ;) (result i32)
+ (global.get $sp)
+ )
+ (func $stackAlloc (; 2 ;) (param $0 i32) (result i32)
+ (local $1 i32)
+ (global.set $sp
+ (local.tee $1
+ (i32.and
+ (i32.sub
+ (global.get $sp)
+ (local.get $0)
+ )
+ (i32.const -16)
+ )
+ )
+ )
+ (local.get $1)
+ )
+ (func $stackRestore (; 3 ;) (param $0 i32)
+ (global.set $sp
+ (local.get $0)
+ )
+ )
+ (func $__growWasmMemory (; 4 ;) (param $newSize i32) (result i32)
+ (memory.grow
+ (local.get $newSize)
+ )
+ )
+ (func $__assign_got_enties (; 5 ;)
+ (global.set $gimport$9
+ (i32.add
+ (global.get $tb)
+ (i32.const 0)
+ )
+ )
+ )
+ (func $dynCall_v (; 6 ;) (param $fptr i32)
+ (call_indirect (type $none_=>_none)
+ (local.get $fptr)
+ )
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "staticBump": 4294966770,
+ "tableSize": 2,
+ "initializers": [
+ "__assign_got_enties"
+ ],
+ "declares": [
+ ],
+ "externs": [
+ "___stack_pointer",
+ "___table_base"
+ ],
+ "implementedFunctions": [
+ "___stdio_write",
+ "_stackSave",
+ "_stackAlloc",
+ "_stackRestore",
+ "___growWasmMemory",
+ "___assign_got_enties",
+ "_dynCall_v"
+ ],
+ "exports": [
+ "__stdio_write",
+ "stackSave",
+ "stackAlloc",
+ "stackRestore",
+ "__growWasmMemory",
+ "__assign_got_enties",
+ "dynCall_v"
+ ],
+ "namedGlobals": {
+ "__data_end" : "42"
+ },
+ "invokeFuncs": [
+ ],
+ "features": [
+ ],
+ "mainReadsParams": 0
+}
+-- END METADATA --
+;)
diff --git a/test/lld/main_module_table_5.wat b/test/lld/main_module_table_5.wat
new file mode 100644
index 000000000..ee15deee5
--- /dev/null
+++ b/test/lld/main_module_table_5.wat
@@ -0,0 +1,16 @@
+(module
+ (import "env" "__stack_pointer" (global $sp (mut i32)))
+ (import "GOT.func" "__stdio_write" (global $gimport$9 (mut i32)))
+ (import "env" "__table_base" (global $tb i32))
+ (import "env" "table" (table $timport$9 1 funcref))
+ (elem (global.get $tb) $other $stuff)
+ (global $global i32 (i32.const 42))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (func $__stdio_write
+ )
+ (func $other
+ )
+ (func $stuff
+ )
+)
diff --git a/test/lld/main_module_table_5.wat.out b/test/lld/main_module_table_5.wat.out
new file mode 100644
index 000000000..590164b0f
--- /dev/null
+++ b/test/lld/main_module_table_5.wat.out
@@ -0,0 +1,114 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_none (func (param i32)))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (import "env" "table" (table $0 2 funcref))
+ (elem (global.get $tb) $other $stuff $__stdio_write)
+ (import "env" "__stack_pointer" (global $sp_import i32))
+ (import "env" "__table_base" (global $tb i32))
+ (global $gimport$9 (mut i32) (i32.const 0))
+ (global $global i32 (i32.const 42))
+ (global $sp (mut i32) (global.get $sp_import))
+ (export "__stdio_write" (func $__stdio_write))
+ (export "__data_end" (global $global))
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (export "__growWasmMemory" (func $__growWasmMemory))
+ (export "__assign_got_enties" (func $__assign_got_enties))
+ (export "dynCall_v" (func $dynCall_v))
+ (func $__stdio_write (; 0 ;)
+ (nop)
+ )
+ (func $other (; 1 ;)
+ (nop)
+ )
+ (func $stuff (; 2 ;)
+ (nop)
+ )
+ (func $stackSave (; 3 ;) (result i32)
+ (global.get $sp)
+ )
+ (func $stackAlloc (; 4 ;) (param $0 i32) (result i32)
+ (local $1 i32)
+ (global.set $sp
+ (local.tee $1
+ (i32.and
+ (i32.sub
+ (global.get $sp)
+ (local.get $0)
+ )
+ (i32.const -16)
+ )
+ )
+ )
+ (local.get $1)
+ )
+ (func $stackRestore (; 5 ;) (param $0 i32)
+ (global.set $sp
+ (local.get $0)
+ )
+ )
+ (func $__growWasmMemory (; 6 ;) (param $newSize i32) (result i32)
+ (memory.grow
+ (local.get $newSize)
+ )
+ )
+ (func $__assign_got_enties (; 7 ;)
+ (global.set $gimport$9
+ (i32.add
+ (global.get $tb)
+ (i32.const 2)
+ )
+ )
+ )
+ (func $dynCall_v (; 8 ;) (param $fptr i32)
+ (call_indirect (type $none_=>_none)
+ (local.get $fptr)
+ )
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "staticBump": 4294966770,
+ "tableSize": 2,
+ "initializers": [
+ "__assign_got_enties"
+ ],
+ "declares": [
+ ],
+ "externs": [
+ "___stack_pointer",
+ "___table_base"
+ ],
+ "implementedFunctions": [
+ "___stdio_write",
+ "_stackSave",
+ "_stackAlloc",
+ "_stackRestore",
+ "___growWasmMemory",
+ "___assign_got_enties",
+ "_dynCall_v"
+ ],
+ "exports": [
+ "__stdio_write",
+ "stackSave",
+ "stackAlloc",
+ "stackRestore",
+ "__growWasmMemory",
+ "__assign_got_enties",
+ "dynCall_v"
+ ],
+ "namedGlobals": {
+ "__data_end" : "42"
+ },
+ "invokeFuncs": [
+ ],
+ "features": [
+ ],
+ "mainReadsParams": 0
+}
+-- END METADATA --
+;)