summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lld/duplicate_imports.wast.out8
-rw-r--r--test/lld/em_asm.wast.mem.out8
-rw-r--r--test/lld/em_asm.wast.out8
-rw-r--r--test/lld/em_asm_O0.wast.out8
-rw-r--r--test/lld/hello_world.wast.mem.out8
-rw-r--r--test/lld/hello_world.wast.out8
-rw-r--r--test/lld/init.wast.out8
-rw-r--r--test/lld/recursive.wast.out8
-rw-r--r--test/lld/reserved_func_ptr.wast.out8
-rw-r--r--test/lld/shared.c7
-rw-r--r--test/lld/shared.wast34
-rw-r--r--test/lld/shared.wast.out75
12 files changed, 152 insertions, 36 deletions
diff --git a/test/lld/duplicate_imports.wast.out b/test/lld/duplicate_imports.wast.out
index 3a9fa2474..f01f8bb96 100644
--- a/test/lld/duplicate_imports.wast.out
+++ b/test/lld/duplicate_imports.wast.out
@@ -20,7 +20,7 @@
(global $global$1 i32 (i32.const 66128))
(global $global$2 i32 (i32.const 581))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
@@ -107,7 +107,7 @@
"staticBump": 13,
"tableSize": 1,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
"puts"
@@ -115,7 +115,7 @@
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -124,7 +124,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"main",
"__heap_base",
"__data_end",
diff --git a/test/lld/em_asm.wast.mem.out b/test/lld/em_asm.wast.mem.out
index c1cd18ae5..08bca193e 100644
--- a/test/lld/em_asm.wast.mem.out
+++ b/test/lld/em_asm.wast.mem.out
@@ -14,7 +14,7 @@
(global $global$1 i32 (i32.const 66192))
(global $global$2 i32 (i32.const 652))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "main" (func $main))
@@ -233,14 +233,14 @@
"staticBump": 84,
"tableSize": 1,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
],
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -249,7 +249,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"__heap_base",
"__data_end",
"main",
diff --git a/test/lld/em_asm.wast.out b/test/lld/em_asm.wast.out
index b9e95d3ec..50d4628c9 100644
--- a/test/lld/em_asm.wast.out
+++ b/test/lld/em_asm.wast.out
@@ -15,7 +15,7 @@
(global $global$1 i32 (i32.const 66192))
(global $global$2 i32 (i32.const 652))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "main" (func $main))
@@ -234,14 +234,14 @@
"staticBump": 84,
"tableSize": 1,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
],
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -250,7 +250,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"__heap_base",
"__data_end",
"main",
diff --git a/test/lld/em_asm_O0.wast.out b/test/lld/em_asm_O0.wast.out
index cbc93c5cb..c45799980 100644
--- a/test/lld/em_asm_O0.wast.out
+++ b/test/lld/em_asm_O0.wast.out
@@ -17,7 +17,7 @@
(global $global$1 i32 (i32.const 66192))
(global $global$2 i32 (i32.const 652))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
@@ -94,14 +94,14 @@
"staticBump": 84,
"tableSize": 1,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
],
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -110,7 +110,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"main",
"__heap_base",
"__data_end",
diff --git a/test/lld/hello_world.wast.mem.out b/test/lld/hello_world.wast.mem.out
index dce3de59c..32f8ddc14 100644
--- a/test/lld/hello_world.wast.mem.out
+++ b/test/lld/hello_world.wast.mem.out
@@ -11,7 +11,7 @@
(global $global$1 i32 (i32.const 66128))
(global $global$2 i32 (i32.const 581))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "main" (func $main))
@@ -68,7 +68,7 @@
"staticBump": 13,
"tableSize": 1,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
"puts"
@@ -76,7 +76,7 @@
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -85,7 +85,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"__heap_base",
"__data_end",
"main",
diff --git a/test/lld/hello_world.wast.out b/test/lld/hello_world.wast.out
index a06e7b287..20ffaf2cd 100644
--- a/test/lld/hello_world.wast.out
+++ b/test/lld/hello_world.wast.out
@@ -12,7 +12,7 @@
(global $global$1 i32 (i32.const 66128))
(global $global$2 i32 (i32.const 581))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "main" (func $main))
@@ -69,7 +69,7 @@
"staticBump": 13,
"tableSize": 1,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
"puts"
@@ -77,7 +77,7 @@
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -86,7 +86,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"__heap_base",
"__data_end",
"main",
diff --git a/test/lld/init.wast.out b/test/lld/init.wast.out
index 35fda658b..90c95263b 100644
--- a/test/lld/init.wast.out
+++ b/test/lld/init.wast.out
@@ -9,7 +9,7 @@
(global $global$1 i32 (i32.const 66112))
(global $global$2 i32 (i32.const 576))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "main" (func $main))
@@ -81,14 +81,14 @@
"staticBump": 8,
"tableSize": 1,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
],
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -97,7 +97,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"__heap_base",
"__data_end",
"main",
diff --git a/test/lld/recursive.wast.out b/test/lld/recursive.wast.out
index fcb6c1333..95f82f767 100644
--- a/test/lld/recursive.wast.out
+++ b/test/lld/recursive.wast.out
@@ -11,7 +11,7 @@
(global $global$1 i32 (i32.const 66128))
(global $global$2 i32 (i32.const 587))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "main" (func $main))
@@ -126,7 +126,7 @@
"staticBump": 19,
"tableSize": 1,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
"printf"
@@ -134,7 +134,7 @@
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -143,7 +143,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"__heap_base",
"__data_end",
"main",
diff --git a/test/lld/reserved_func_ptr.wast.out b/test/lld/reserved_func_ptr.wast.out
index 5c8333d09..6afc10291 100644
--- a/test/lld/reserved_func_ptr.wast.out
+++ b/test/lld/reserved_func_ptr.wast.out
@@ -16,7 +16,7 @@
(global $global$1 i32 (i32.const 66112))
(global $global$2 i32 (i32.const 568))
(export "memory" (memory $0))
- (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "main" (func $main))
@@ -161,7 +161,7 @@
"staticBump": 0,
"tableSize": 3,
"initializers": [
- "__post_instantiate"
+ "__wasm_call_ctors"
],
"declares": [
"_Z4atoiPKc"
@@ -169,7 +169,7 @@
"externs": [
],
"implementedFunctions": [
- "___post_instantiate",
+ "___wasm_call_ctors",
"_main",
"_stackSave",
"_stackAlloc",
@@ -179,7 +179,7 @@
],
"exports": [
"memory",
- "__post_instantiate",
+ "__wasm_call_ctors",
"__heap_base",
"__data_end",
"main",
diff --git a/test/lld/shared.c b/test/lld/shared.c
new file mode 100644
index 000000000..1d98b068b
--- /dev/null
+++ b/test/lld/shared.c
@@ -0,0 +1,7 @@
+int puts(const char* str);
+extern int external_var;
+
+int print_message() {
+ puts("Hello, world");
+ return external_var;
+}
diff --git a/test/lld/shared.wast b/test/lld/shared.wast
new file mode 100644
index 000000000..f8b0a746c
--- /dev/null
+++ b/test/lld/shared.wast
@@ -0,0 +1,34 @@
+(module
+ (type $0 (func (param i32) (result i32)))
+ (type $1 (func))
+ (type $2 (func (result i32)))
+ (import "env" "memory" (memory $0 0))
+ (data (global.get $gimport$2) "Hello, world\00")
+ (import "env" "__indirect_function_table" (table $timport$1 0 funcref))
+ (import "env" "__memory_base" (global $gimport$2 i32))
+ (import "env" "__table_base" (global $gimport$3 i32))
+ (import "GOT.func" "puts" (global $gimport$5 (mut i32)))
+ (import "GOT.mem" "external_var" (global $gimport$6 (mut i32)))
+ (import "env" "puts" (func $puts (param i32) (result i32)))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
+ (export "print_message" (func $print_message))
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ )
+ (func $print_message (; 2 ;) (type $2) (result i32)
+ (drop
+ (i32.add
+ (global.get $gimport$2)
+ (i32.const 0)
+ )
+ )
+ (drop
+ (call $print_message)
+ )
+ (i32.load
+ (global.get $gimport$6)
+ )
+ )
+ ;; custom section "dylink", size 5
+ ;; custom section "producers", size 125
+)
+
diff --git a/test/lld/shared.wast.out b/test/lld/shared.wast.out
new file mode 100644
index 000000000..c4f110972
--- /dev/null
+++ b/test/lld/shared.wast.out
@@ -0,0 +1,75 @@
+(module
+ (type $0 (func (param i32) (result i32)))
+ (type $1 (func))
+ (type $2 (func (result i32)))
+ (type $FUNCSIG$ii (func (param i32) (result i32)))
+ (type $FUNCSIG$i (func (result i32)))
+ (import "env" "memory" (memory $0 0))
+ (data (global.get $gimport$2) "Hello, world\00")
+ (import "env" "table" (table $0 0 funcref))
+ (import "env" "__memory_base" (global $gimport$2 i32))
+ (import "env" "__table_base" (global $gimport$3 i32))
+ (import "env" "puts" (func $puts (param i32) (result i32)))
+ (import "env" "g$external_var" (func $g$external_var (result i32)))
+ (import "env" "f$puts$ii" (func $f$puts$ii (result i32)))
+ (global $gimport$5 (mut i32) (i32.const 0))
+ (global $gimport$6 (mut i32) (i32.const 0))
+ (export "print_message" (func $print_message))
+ (export "__post_instantiate" (func $__post_instantiate))
+ (func $__wasm_call_ctors (; 3 ;) (type $1)
+ (nop)
+ )
+ (func $print_message (; 4 ;) (type $2) (result i32)
+ (drop
+ (i32.add
+ (global.get $gimport$2)
+ (i32.const 0)
+ )
+ )
+ (drop
+ (call $print_message)
+ )
+ (i32.load
+ (global.get $gimport$6)
+ )
+ )
+ (func $__post_instantiate (; 5 ;)
+ (call $__assign_got_enties)
+ (call $__wasm_call_ctors)
+ )
+ (func $__assign_got_enties (; 6 ;)
+ (global.set $gimport$6
+ (call $g$external_var)
+ )
+ (global.set $gimport$5
+ (call $f$puts$ii)
+ )
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "staticBump": 0,
+ "tableSize": 0,
+ "declares": [
+ "puts",
+ "g$external_var",
+ "f$puts$ii"
+ ],
+ "externs": [
+ "___memory_base",
+ "___table_base"
+ ],
+ "implementedFunctions": [
+ "_print_message",
+ "___post_instantiate"
+ ],
+ "exports": [
+ "print_message",
+ "__post_instantiate"
+ ],
+ "invokeFuncs": [
+ ]
+}
+-- END METADATA --
+;)