diff options
author | Sam Clegg <sbc@chromium.org> | 2022-08-02 15:41:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 15:41:06 -0700 |
commit | 3d3350d789d909445c8d8d03545c50bc0ae416ef (patch) | |
tree | b044afd8490166160889b14f5bd6406a0708f606 | |
parent | deb40b7cd6d02adc14c09782b2211e2d68c612b1 (diff) | |
download | binaryen-3d3350d789d909445c8d8d03545c50bc0ae416ef.tar.gz binaryen-3d3350d789d909445c8d8d03545c50bc0ae416ef.tar.bz2 binaryen-3d3350d789d909445c8d8d03545c50bc0ae416ef.zip |
Re-run scripts/test/generate_lld_tests.py. NFC (#4861)
-rwxr-xr-x | scripts/test/generate_lld_tests.py | 10 | ||||
-rw-r--r-- | test/lld/basic_safe_stack.wat | 2 | ||||
-rw-r--r-- | test/lld/em_asm.wat | 8 | ||||
-rw-r--r-- | test/lld/em_asm64.wat | 8 | ||||
-rw-r--r-- | test/lld/em_asm_O0.c | 2 | ||||
-rw-r--r-- | test/lld/em_asm_O0.wat | 53 | ||||
-rw-r--r-- | test/lld/em_asm_O0.wat.out | 49 | ||||
-rw-r--r-- | test/lld/em_asm_shared.wat | 24 | ||||
-rw-r--r-- | test/lld/em_asm_shared.wat.out | 16 | ||||
-rw-r--r-- | test/lld/hello_world.wat | 4 | ||||
-rw-r--r-- | test/lld/init.wat | 2 | ||||
-rw-r--r-- | test/lld/longjmp.wat | 12 | ||||
-rw-r--r-- | test/lld/recursive.wat | 2 | ||||
-rw-r--r-- | test/lld/reserved_func_ptr.wat | 6 | ||||
-rw-r--r-- | test/lld/reserved_func_ptr.wat.out | 4 | ||||
-rw-r--r-- | test/lld/shared.wat | 16 | ||||
-rw-r--r-- | test/lld/shared.wat.out | 8 | ||||
-rw-r--r-- | test/lld/shared_longjmp.wat | 16 | ||||
-rw-r--r-- | test/lld/shared_longjmp.wat.out | 4 |
19 files changed, 138 insertions, 108 deletions
diff --git a/scripts/test/generate_lld_tests.py b/scripts/test/generate_lld_tests.py index 1867d1d7b..254d73349 100755 --- a/scripts/test/generate_lld_tests.py +++ b/scripts/test/generate_lld_tests.py @@ -30,7 +30,7 @@ def files_with_extensions(path, extensions): yield file, ext -def generate_wat_files(llvm_bin, emscripten_root): +def generate_wat_files(llvm_bin, emscripten_sysroot): print('\n[ building wat files from C sources... ]\n') lld_path = os.path.join(shared.options.binaryen_test, 'lld') @@ -57,13 +57,12 @@ def generate_wat_files(llvm_bin, emscripten_root): '-nostdinc', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc', - '-Xclang', '-I%s/system/include' % emscripten_root, + '-Xclang', '-I%s/include' % emscripten_sysroot, '-O1', ] link_cmd = [ os.path.join(llvm_bin, 'wasm-ld'), '-flavor', 'wasm', - '-z', '-stack-size=1048576', obj_path, '-o', wasm_path, '--allow-undefined', '--export', '__wasm_call_ctors', @@ -81,7 +80,10 @@ def generate_wat_files(llvm_bin, emscripten_root): link_cmd.append('-shared') link_cmd.append('--experimental-pic') else: - link_cmd.append('--entry=main') + if 'reserved_func_ptr' in src_file: + link_cmd.append('--entry=__main_argc_argv') + else: + link_cmd.append('--entry=main') if is_64: compile_cmd.append('--target=wasm64-emscripten') diff --git a/test/lld/basic_safe_stack.wat b/test/lld/basic_safe_stack.wat index 9d1009529..e82d0a50f 100644 --- a/test/lld/basic_safe_stack.wat +++ b/test/lld/basic_safe_stack.wat @@ -2,8 +2,8 @@ (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (memory $0 2) (global $__stack_pointer (mut i32) (i32.const 66112)) + (memory $0 2) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "stackRestore" (func $stackRestore)) diff --git a/test/lld/em_asm.wat b/test/lld/em_asm.wat index 035030802..a18196e3a 100644 --- a/test/lld/em_asm.wat +++ b/test/lld/em_asm.wat @@ -1,16 +1,16 @@ (module + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32))) + (global $__stack_pointer (mut i32) (i32.const 66208)) + (global $global$1 i32 (i32.const 574)) + (global $global$2 i32 (i32.const 665)) (memory $0 2) (data $.rodata (i32.const 568) "\00ii\00i\00") (data $em_asm (i32.const 574) "{ Module.print(\"Hello \\\\ world\\t\\n\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00") (table $0 1 1 funcref) - (global $__stack_pointer (mut i32) (i32.const 66208)) - (global $global$1 i32 (i32.const 574)) - (global $global$2 i32 (i32.const 665)) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) diff --git a/test/lld/em_asm64.wat b/test/lld/em_asm64.wat index 739dab1fc..d4ef38506 100644 --- a/test/lld/em_asm64.wat +++ b/test/lld/em_asm64.wat @@ -1,16 +1,16 @@ (module + (type $i64_i64_i64_=>_i32 (func (param i64 i64 i64) (result i32))) (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) - (type $i64_i64_i64_=>_i32 (func (param i64 i64 i64) (result i32))) (import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i64 i64 i64) (result i32))) + (global $__stack_pointer (mut i64) (i64.const 66208)) + (global $global$1 i64 (i64.const 574)) + (global $global$2 i64 (i64.const 658)) (memory $0 i64 2) (data $.rodata (i64.const 568) "\00ii\00i\00") (data $em_asm (i64.const 574) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00") (table $0 1 1 funcref) - (global $__stack_pointer (mut i64) (i64.const 66208)) - (global $global$1 i64 (i64.const 574)) - (global $global$2 i64 (i64.const 658)) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) diff --git a/test/lld/em_asm_O0.c b/test/lld/em_asm_O0.c index 6351f81b5..352a8ed84 100644 --- a/test/lld/em_asm_O0.c +++ b/test/lld/em_asm_O0.c @@ -1,6 +1,6 @@ #include <emscripten.h> -int main(int argc, char** argv) { +int main() { EM_ASM({ Module.print("Hello world"); }); int ret = EM_ASM_INT({ return $0 + $1; }, 20, 30); EM_ASM({ Module.print("Got " + $0); }, 42); diff --git a/test/lld/em_asm_O0.wat b/test/lld/em_asm_O0.wat index f96564c54..1dba1e9ce 100644 --- a/test/lld/em_asm_O0.wat +++ b/test/lld/em_asm_O0.wat @@ -1,13 +1,15 @@ (module + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $none_=>_none (func)) + (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32))) - (memory $0 2) - (data $em_asm (i32.const 568) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00") (global $__stack_pointer (mut i32) (i32.const 66192)) (global $global$1 i32 (i32.const 568)) (global $global$2 i32 (i32.const 652)) + (memory $0 2) + (data $em_asm (i32.const 568) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00") + (table $0 1 1 funcref) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) @@ -15,11 +17,11 @@ (export "__stop_em_asm" (global $global$2)) (func $__wasm_call_ctors ) - (func $main (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) + (func $__original_main (result i32) + (local $0 i32) + (local $1 i32) (global.set $__stack_pointer - (local.tee $2 + (local.tee $0 (i32.sub (global.get $__stack_pointer) (i32.const 32) @@ -27,69 +29,72 @@ ) ) (i32.store8 offset=31 - (local.get $2) + (local.get $0) (i32.const 0) ) (drop (call $emscripten_asm_const_int (i32.const 568) (i32.add - (local.get $2) + (local.get $0) (i32.const 31) ) (i32.const 0) ) ) (i32.store8 offset=30 - (local.get $2) + (local.get $0) (i32.const 0) ) (i32.store16 offset=28 align=1 - (local.get $2) + (local.get $0) (i32.const 26985) ) (i64.store offset=16 - (local.get $2) + (local.get $0) (i64.const 128849018900) ) - (local.set $3 + (local.set $1 (call $emscripten_asm_const_int (i32.const 601) (i32.add - (local.get $2) + (local.get $0) (i32.const 28) ) (i32.add - (local.get $2) + (local.get $0) (i32.const 16) ) ) ) - (i32.store16 offset=26 align=1 - (local.get $2) - (i32.const 105) - ) (i32.store - (local.get $2) + (local.get $0) (i32.const 42) ) + (i32.store16 offset=26 align=1 + (local.get $0) + (i32.const 105) + ) (drop (call $emscripten_asm_const_int (i32.const 621) (i32.add - (local.get $2) + (local.get $0) (i32.const 26) ) - (local.get $2) + (local.get $0) ) ) (global.set $__stack_pointer (i32.add - (local.get $2) + (local.get $0) (i32.const 32) ) ) - (local.get $3) + (local.get $1) + ) + (func $main (param $0 i32) (param $1 i32) (result i32) + (call $__original_main) ) ;; custom section "producers", size 112 ) diff --git a/test/lld/em_asm_O0.wat.out b/test/lld/em_asm_O0.wat.out index e05e85757..910ae1a56 100644 --- a/test/lld/em_asm_O0.wat.out +++ b/test/lld/em_asm_O0.wat.out @@ -1,6 +1,7 @@ (module (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $none_=>_none (func)) + (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32))) (global $__stack_pointer (mut i32) (i32.const 66192)) @@ -8,17 +9,18 @@ (global $global$2 i32 (i32.const 652)) (memory $0 2) (data $em_asm (i32.const 568) "") + (table $0 1 1 funcref) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) (func $__wasm_call_ctors (nop) ) - (func $main (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) + (func $__original_main (result i32) + (local $0 i32) + (local $1 i32) (global.set $__stack_pointer - (local.tee $2 + (local.tee $0 (i32.sub (global.get $__stack_pointer) (i32.const 32) @@ -26,69 +28,72 @@ ) ) (i32.store8 offset=31 - (local.get $2) + (local.get $0) (i32.const 0) ) (drop (call $emscripten_asm_const_int (i32.const 568) (i32.add - (local.get $2) + (local.get $0) (i32.const 31) ) (i32.const 0) ) ) (i32.store8 offset=30 - (local.get $2) + (local.get $0) (i32.const 0) ) (i32.store16 offset=28 align=1 - (local.get $2) + (local.get $0) (i32.const 26985) ) (i64.store offset=16 - (local.get $2) + (local.get $0) (i64.const 128849018900) ) - (local.set $3 + (local.set $1 (call $emscripten_asm_const_int (i32.const 601) (i32.add - (local.get $2) + (local.get $0) (i32.const 28) ) (i32.add - (local.get $2) + (local.get $0) (i32.const 16) ) ) ) - (i32.store16 offset=26 align=1 - (local.get $2) - (i32.const 105) - ) (i32.store - (local.get $2) + (local.get $0) (i32.const 42) ) + (i32.store16 offset=26 align=1 + (local.get $0) + (i32.const 105) + ) (drop (call $emscripten_asm_const_int (i32.const 621) (i32.add - (local.get $2) + (local.get $0) (i32.const 26) ) - (local.get $2) + (local.get $0) ) ) (global.set $__stack_pointer (i32.add - (local.get $2) + (local.get $0) (i32.const 32) ) ) - (local.get $3) + (local.get $1) + ) + (func $main (param $0 i32) (param $1 i32) (result i32) + (call $__original_main) ) ) (; @@ -112,7 +117,7 @@ }, "invokeFuncs": [ ], - "mainReadsParams": 1, + "mainReadsParams": 0, "features": [ ] } diff --git a/test/lld/em_asm_shared.wat b/test/lld/em_asm_shared.wat index 39c23234c..e4374aa0a 100644 --- a/test/lld/em_asm_shared.wat +++ b/test/lld/em_asm_shared.wat @@ -1,24 +1,25 @@ (module (type $none_=>_none (func)) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (import "env" "memory" (memory $mimport$0 1)) - (data $.data (global.get $__memory_base) "\00ii\00i\00{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00") (import "env" "__indirect_function_table" (table $timport$0 0 funcref)) (import "env" "__stack_pointer" (global $__stack_pointer (mut i32))) (import "env" "__memory_base" (global $__memory_base i32)) (import "env" "__table_base" (global $__table_base i32)) - (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<>\20>::buffer (mut i32))) - (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiiEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<int\2c\20int>\20>::buffer (mut i32))) - (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<int>\20>::buffer (mut i32))) + (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<>>::buffer (mut i32))) + (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiiEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<int\2c\20int>>::buffer (mut i32))) + (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<int>>::buffer (mut i32))) (import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32))) (global $global$0 i32 (i32.const 0)) (global $global$1 i32 (i32.const 1)) (global $global$2 i32 (i32.const 4)) (global $global$3 i32 (i32.const 6)) (global $global$4 i32 (i32.const 90)) + (data $.data (global.get $__memory_base) "\00ii\00i\00{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00") (export "__wasm_call_ctors" (func $__wasm_call_ctors)) + (export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs)) (export "__original_main" (func $__original_main)) (export "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJEEE6bufferE" (global $global$0)) (export "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiiEEE6bufferE" (global $global$1)) @@ -27,7 +28,6 @@ (export "__start_em_asm" (global $global$3)) (export "__stop_em_asm" (global $global$4)) (func $__wasm_call_ctors - (call $__wasm_apply_data_relocs) ) (func $__wasm_apply_data_relocs ) @@ -50,7 +50,7 @@ ) (i32.const 6) ) - (global.get $__em_asm_sig_builder<__em_asm_type_tuple<>\20>::buffer) + (global.get $__em_asm_sig_builder<__em_asm_type_tuple<>>::buffer) (i32.const 0) ) ) @@ -65,7 +65,7 @@ (local.get $1) (i32.const 39) ) - (global.get $__em_asm_sig_builder<__em_asm_type_tuple<int\2c\20int>\20>::buffer) + (global.get $__em_asm_sig_builder<__em_asm_type_tuple<int\2c\20int>>::buffer) (i32.add (local.get $0) (i32.const 16) @@ -78,7 +78,7 @@ (local.get $1) (i32.const 59) ) - (global.get $__em_asm_sig_builder<__em_asm_type_tuple<int>\20>::buffer) + (global.get $__em_asm_sig_builder<__em_asm_type_tuple<int>>::buffer) (local.get $0) ) ) @@ -93,7 +93,11 @@ (func $main (param $0 i32) (param $1 i32) (result i32) (call $__original_main) ) - ;; custom section "dylink.0", size 6 + ;; dylink section + ;; memorysize: 90 + ;; memoryalignment: 0 + ;; tablesize: 0 + ;; tablealignment: 0 ;; custom section "producers", size 112 ;; features section: mutable-globals ) diff --git a/test/lld/em_asm_shared.wat.out b/test/lld/em_asm_shared.wat.out index 171f6b10c..d7d480866 100644 --- a/test/lld/em_asm_shared.wat.out +++ b/test/lld/em_asm_shared.wat.out @@ -8,9 +8,9 @@ (import "env" "__stack_pointer" (global $__stack_pointer (mut i32))) (import "env" "__memory_base" (global $__memory_base i32)) (import "env" "__table_base" (global $__table_base i32)) - (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<>\20>::buffer (mut i32))) - (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiiEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<int\2c\20int>\20>::buffer (mut i32))) - (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<int>\20>::buffer (mut i32))) + (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<>>::buffer (mut i32))) + (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiiEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<int\2c\20int>>::buffer (mut i32))) + (import "GOT.mem" "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiEEE6bufferE" (global $__em_asm_sig_builder<__em_asm_type_tuple<int>>::buffer (mut i32))) (import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32))) (global $global$0 i32 (i32.const 0)) (global $global$1 i32 (i32.const 1)) @@ -19,13 +19,14 @@ (global $global$4 i32 (i32.const 90)) (data $.data (global.get $__memory_base) "\00ii\00i\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (export "__wasm_call_ctors" (func $__wasm_call_ctors)) + (export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs)) (export "__original_main" (func $__original_main)) (export "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJEEE6bufferE" (global $global$0)) (export "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiiEEE6bufferE" (global $global$1)) (export "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiEEE6bufferE" (global $global$2)) (export "main" (func $main)) (func $__wasm_call_ctors - (call $__wasm_apply_data_relocs) + (nop) ) (func $__wasm_apply_data_relocs (nop) @@ -49,7 +50,7 @@ ) (i32.const 6) ) - (global.get $__em_asm_sig_builder<__em_asm_type_tuple<>\20>::buffer) + (global.get $__em_asm_sig_builder<__em_asm_type_tuple<>>::buffer) (i32.const 0) ) ) @@ -64,7 +65,7 @@ (local.get $1) (i32.const 39) ) - (global.get $__em_asm_sig_builder<__em_asm_type_tuple<int\2c\20int>\20>::buffer) + (global.get $__em_asm_sig_builder<__em_asm_type_tuple<int\2c\20int>>::buffer) (i32.add (local.get $0) (i32.const 16) @@ -77,7 +78,7 @@ (local.get $1) (i32.const 59) ) - (global.get $__em_asm_sig_builder<__em_asm_type_tuple<int>\20>::buffer) + (global.get $__em_asm_sig_builder<__em_asm_type_tuple<int>>::buffer) (local.get $0) ) ) @@ -114,6 +115,7 @@ ], "exports": [ "__wasm_call_ctors", + "__wasm_apply_data_relocs", "__original_main", "main" ], diff --git a/test/lld/hello_world.wat b/test/lld/hello_world.wat index 71f464ae6..335bcb865 100644 --- a/test/lld/hello_world.wat +++ b/test/lld/hello_world.wat @@ -1,13 +1,13 @@ (module + (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) - (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (import "env" "puts" (func $puts (param i32) (result i32))) + (global $__stack_pointer (mut i32) (i32.const 66128)) (memory $0 2) (data $.rodata (i32.const 568) "Hello, world\00") (table $0 1 1 funcref) - (global $__stack_pointer (mut i32) (i32.const 66128)) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) diff --git a/test/lld/init.wat b/test/lld/init.wat index 3d088e743..ea81a12a5 100644 --- a/test/lld/init.wat +++ b/test/lld/init.wat @@ -2,9 +2,9 @@ (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (global $__stack_pointer (mut i32) (i32.const 66112)) (memory $0 2) (table $0 1 1 funcref) - (global $__stack_pointer (mut i32) (i32.const 66112)) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) diff --git a/test/lld/longjmp.wat b/test/lld/longjmp.wat index f20134c5c..122b6bbc6 100644 --- a/test/lld/longjmp.wat +++ b/test/lld/longjmp.wat @@ -1,13 +1,13 @@ (module - (type $i32_=>_none (func (param i32))) (type $none_=>_i32 (func (result i32))) - (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) + (type $none_=>_none (func)) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (import "env" "malloc" (func $malloc (param i32) (result i32))) (import "env" "saveSetjmp" (func $saveSetjmp (param i32 i32 i32 i32) (result i32))) (import "env" "getTempRet0" (func $getTempRet0 (result i32))) @@ -16,10 +16,10 @@ (import "env" "testSetjmp" (func $testSetjmp (param i32 i32 i32) (result i32))) (import "env" "setTempRet0" (func $setTempRet0 (param i32))) (import "env" "free" (func $free (param i32))) + (global $__stack_pointer (mut i32) (i32.const 66112)) (memory $0 2) (table $0 2 2 funcref) (elem (i32.const 1) $emscripten_longjmp) - (global $__stack_pointer (mut i32) (i32.const 66112)) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) diff --git a/test/lld/recursive.wat b/test/lld/recursive.wat index 96be1d10c..c9d30aabe 100644 --- a/test/lld/recursive.wat +++ b/test/lld/recursive.wat @@ -3,10 +3,10 @@ (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) (import "env" "iprintf" (func $iprintf (param i32 i32) (result i32))) + (global $__stack_pointer (mut i32) (i32.const 66128)) (memory $0 2) (data $.rodata (i32.const 568) "%d:%d\n\00Result: %d\n\00") (table $0 1 1 funcref) - (global $__stack_pointer (mut i32) (i32.const 66128)) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) (export "main" (func $main)) diff --git a/test/lld/reserved_func_ptr.wat b/test/lld/reserved_func_ptr.wat index cee65a380..38a7b8605 100644 --- a/test/lld/reserved_func_ptr.wat +++ b/test/lld/reserved_func_ptr.wat @@ -2,18 +2,18 @@ (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $f32_f32_i32_=>_f32 (func (param f32 f32 i32) (result f32))) (type $f64_i32_=>_f64 (func (param f64 i32) (result f64))) (import "env" "_Z4atoiPKc" (func $atoi\28char\20const*\29 (param i32) (result i32))) + (global $__stack_pointer (mut i32) (i32.const 66112)) (memory $0 2) (table $0 3 3 funcref) (elem (i32.const 1) $address_taken_func\28int\2c\20int\2c\20int\29 $address_taken_func2\28int\2c\20int\2c\20int\29) - (global $__stack_pointer (mut i32) (i32.const 66112)) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) - (export "main" (func $main)) + (export "__main_argc_argv" (func $main)) (func $__wasm_call_ctors ) (func $address_taken_func\28int\2c\20int\2c\20int\29 (param $0 i32) (param $1 i32) (param $2 i32) diff --git a/test/lld/reserved_func_ptr.wat.out b/test/lld/reserved_func_ptr.wat.out index a661989ba..373800dbc 100644 --- a/test/lld/reserved_func_ptr.wat.out +++ b/test/lld/reserved_func_ptr.wat.out @@ -14,7 +14,7 @@ (elem (i32.const 1) $address_taken_func\28int\2c\20int\2c\20int\29 $address_taken_func2\28int\2c\20int\2c\20int\29) (export "memory" (memory $0)) (export "__wasm_call_ctors" (func $__wasm_call_ctors)) - (export "main" (func $main)) + (export "__main_argc_argv" (func $main)) (export "dynCall_viii" (func $dynCall_viii)) (func $__wasm_call_ctors (nop) @@ -128,7 +128,7 @@ ], "exports": [ "__wasm_call_ctors", - "main", + "__main_argc_argv", "dynCall_viii" ], "namedGlobals": { diff --git a/test/lld/shared.wat b/test/lld/shared.wat index 5a403aa23..5b7574bed 100644 --- a/test/lld/shared.wat +++ b/test/lld/shared.wat @@ -1,9 +1,8 @@ (module (type $none_=>_none (func)) - (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $none_=>_i32 (func (result i32))) (import "env" "memory" (memory $mimport$0 1)) - (data $.data (global.get $__memory_base) "Hello, world\00\00\00\00\00\00\00\00\00\00\00\00") (import "env" "__indirect_function_table" (table $timport$0 0 funcref)) (import "env" "__memory_base" (global $__memory_base i32)) (import "env" "__table_base" (global $__table_base i32)) @@ -13,25 +12,26 @@ (import "env" "puts" (func $puts (param i32) (result i32))) (global $global$0 i32 (i32.const 16)) (global $global$1 i32 (i32.const 20)) + (data $.data (global.get $__memory_base) "Hello, world\00\00\00\00\00\00\00\00\00\00\00\00") (export "__wasm_call_ctors" (func $__wasm_call_ctors)) + (export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs)) (export "_Z13print_messagev" (func $print_message\28\29)) (export "ptr_puts" (global $global$0)) (export "ptr_local_func" (global $global$1)) (func $__wasm_call_ctors - (call $__wasm_apply_data_relocs) ) (func $__wasm_apply_data_relocs (i32.store (i32.add - (global.get $__memory_base) (i32.const 16) + (global.get $__memory_base) ) (global.get $puts) ) (i32.store (i32.add - (global.get $__memory_base) (i32.const 20) + (global.get $__memory_base) ) (global.get $print_message\28\29) ) @@ -49,7 +49,11 @@ (global.get $external_var) ) ) - ;; custom section "dylink.0", size 6 + ;; dylink section + ;; memorysize: 24 + ;; memoryalignment: 2 + ;; tablesize: 0 + ;; tablealignment: 0 ;; custom section "producers", size 112 ;; features section: mutable-globals ) diff --git a/test/lld/shared.wat.out b/test/lld/shared.wat.out index 66000827d..b152d52b8 100644 --- a/test/lld/shared.wat.out +++ b/test/lld/shared.wat.out @@ -14,24 +14,25 @@ (global $global$1 i32 (i32.const 20)) (data $.data (global.get $__memory_base) "Hello, world\00\00\00\00\00\00\00\00\00\00\00\00") (export "__wasm_call_ctors" (func $__wasm_call_ctors)) + (export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs)) (export "_Z13print_messagev" (func $print_message\28\29)) (export "ptr_puts" (global $global$0)) (export "ptr_local_func" (global $global$1)) (func $__wasm_call_ctors - (call $__wasm_apply_data_relocs) + (nop) ) (func $__wasm_apply_data_relocs (i32.store (i32.add - (global.get $__memory_base) (i32.const 16) + (global.get $__memory_base) ) (global.get $puts) ) (i32.store (i32.add - (global.get $__memory_base) (i32.const 20) + (global.get $__memory_base) ) (global.get $print_message\28\29) ) @@ -65,6 +66,7 @@ ], "exports": [ "__wasm_call_ctors", + "__wasm_apply_data_relocs", "_Z13print_messagev" ], "namedGlobals": { diff --git a/test/lld/shared_longjmp.wat b/test/lld/shared_longjmp.wat index c7d657794..d217e6d96 100644 --- a/test/lld/shared_longjmp.wat +++ b/test/lld/shared_longjmp.wat @@ -1,14 +1,13 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) + (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $none_=>_i32 (func (result i32))) - (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) (import "env" "memory" (memory $mimport$0 1)) - (data $.bss (global.get $__memory_base) "\00\00\00\00\00\00\00\00") (import "env" "__indirect_function_table" (table $timport$0 0 funcref)) (import "env" "__memory_base" (global $__memory_base i32)) (import "env" "__table_base" (global $__table_base i32)) @@ -25,12 +24,13 @@ (import "env" "free" (func $free (param i32))) (global $global$0 i32 (i32.const 0)) (global $global$1 i32 (i32.const 4)) + (data $.bss (global.get $__memory_base) "\00\00\00\00\00\00\00\00") (export "__wasm_call_ctors" (func $__wasm_call_ctors)) + (export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs)) (export "_start" (func $_start)) (export "__THREW__" (global $global$0)) (export "__threwValue" (global $global$1)) (func $__wasm_call_ctors - (call $__wasm_apply_data_relocs) ) (func $__wasm_apply_data_relocs ) @@ -140,7 +140,11 @@ ) (unreachable) ) - ;; custom section "dylink.0", size 6 + ;; dylink section + ;; memorysize: 8 + ;; memoryalignment: 2 + ;; tablesize: 0 + ;; tablealignment: 0 ;; custom section "producers", size 112 ;; features section: mutable-globals ) diff --git a/test/lld/shared_longjmp.wat.out b/test/lld/shared_longjmp.wat.out index 400af5af0..65d6b088c 100644 --- a/test/lld/shared_longjmp.wat.out +++ b/test/lld/shared_longjmp.wat.out @@ -26,12 +26,13 @@ (global $global$1 i32 (i32.const 4)) (data $.bss (global.get $__memory_base) "\00\00\00\00\00\00\00\00") (export "__wasm_call_ctors" (func $__wasm_call_ctors)) + (export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs)) (export "_start" (func $_start)) (export "__THREW__" (global $global$0)) (export "__threwValue" (global $global$1)) (export "dynCall_vii" (func $dynCall_vii)) (func $__wasm_call_ctors - (call $__wasm_apply_data_relocs) + (nop) ) (func $__wasm_apply_data_relocs (nop) @@ -171,6 +172,7 @@ ], "exports": [ "__wasm_call_ctors", + "__wasm_apply_data_relocs", "_start", "dynCall_vii" ], |