Skip to content

Commit 67e7170

Browse files
authored
Re-run generate_lld_tests.py. NFC (#8388)
Also, update the script to run against modern emscripten/clang.
1 parent 5be11f3 commit 67e7170

25 files changed

Lines changed: 371 additions & 390 deletions

scripts/test/generate_lld_tests.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,9 @@ def generate_wat_files(llvm_bin, emscripten_sysroot):
5151
is_64 = '64' in src_file
5252

5353
compile_cmd = [
54-
os.path.join(llvm_bin, 'clang'), src_path, '-o', obj_path,
54+
os.path.join(llvm_bin, 'clang'), '-c', src_path, '-o', obj_path,
5555
'-mllvm', '-enable-emscripten-sjlj',
56-
'-c',
57-
'-nostdinc',
58-
'-Xclang', '-nobuiltininc',
59-
'-Xclang', '-nostdsysteminc',
60-
'-Xclang', f'-I{emscripten_sysroot}/include'
56+
'--sysroot', emscripten_sysroot,
6157
'-O1',
6258
]
6359

@@ -68,7 +64,6 @@ def generate_wat_files(llvm_bin, emscripten_sysroot):
6864
'--export', '__wasm_call_ctors',
6965
'--export', '__start_em_asm',
7066
'--export', '__stop_em_asm',
71-
'--global-base=568',
7267
]
7368
# We had a regression where this test only worked if debug names
7469
# were included.
@@ -79,10 +74,13 @@ def generate_wat_files(llvm_bin, emscripten_sysroot):
7974
compile_cmd.append('-fvisibility=default')
8075
link_cmd.append('-shared')
8176
link_cmd.append('--experimental-pic')
82-
elif 'reserved_func_ptr' in src_file:
83-
link_cmd.append('--entry=__main_argc_argv')
8477
else:
85-
link_cmd.append('--entry=main')
78+
link_cmd.append('--global-base=568')
79+
link_cmd.append('--no-stack-first')
80+
if 'reserved_func_ptr' in src_file:
81+
link_cmd.append('--entry=__main_argc_argv')
82+
else:
83+
link_cmd.append('--entry=main')
8684

8785
if is_64:
8886
compile_cmd.append('--target=wasm64-emscripten')

test/lld/basic_safe_stack.wat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
(module
2-
(type $none_=>_none (func))
3-
(type $i32_=>_none (func (param i32)))
4-
(type $i32_=>_i32 (func (param i32) (result i32)))
1+
(module $basic_safe_stack.wasm
2+
(type $0 (func))
3+
(type $1 (func (param i32)))
4+
(type $2 (func (param i32) (result i32)))
55
(global $__stack_pointer (mut i32) (i32.const 66112))
66
(memory $0 2)
77
(export "memory" (memory $0))

test/lld/basic_safe_stack.wat.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
(module
2-
(type $none_=>_none (func))
3-
(type $i32_=>_none (func (param i32)))
4-
(type $i32_=>_i32 (func (param i32) (result i32)))
1+
(module $basic_safe_stack.wasm
2+
(type $0 (func))
3+
(type $1 (func (param i32)))
4+
(type $2 (func (param i32) (result i32)))
55
(type $3 (func (param i32 i32)))
66
(import "env" "__handle_stack_overflow" (func $__handle_stack_overflow (param i32)))
77
(global $__stack_pointer (mut i32) (i32.const 66112))

test/lld/em_asm.wat

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
(module
2-
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
3-
(type $none_=>_none (func))
4-
(type $none_=>_i32 (func (result i32)))
5-
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
1+
(module $em_asm.wasm
2+
(type $0 (func (param i32 i32 i32) (result i32)))
3+
(type $1 (func))
4+
(type $2 (func (result i32)))
5+
(type $3 (func (param i32 i32) (result i32)))
66
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
77
(global $__stack_pointer (mut i32) (i32.const 66208))
88
(global $global$1 i32 (i32.const 574))
@@ -68,6 +68,7 @@
6868
(func $main (param $0 i32) (param $1 i32) (result i32)
6969
(call $__original_main)
7070
)
71-
;; custom section "producers", size 112
71+
;; custom section "producers", size 115
72+
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, reference-types, multivalue, bulk-memory-opt, call-indirect-overlong
7273
)
7374

test/lld/em_asm.wat.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
(module
2-
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
3-
(type $none_=>_none (func))
4-
(type $none_=>_i32 (func (result i32)))
5-
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
1+
(module $em_asm.wasm
2+
(type $0 (func (param i32 i32 i32) (result i32)))
3+
(type $1 (func))
4+
(type $2 (func (result i32)))
5+
(type $3 (func (param i32 i32) (result i32)))
66
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
77
(global $__stack_pointer (mut i32) (i32.const 66208))
88
(global $global$1 i32 (i32.const 574))

test/lld/em_asm64.wat

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
(module
2-
(type $i64_i64_i64_=>_i32 (func (param i64 i64 i64) (result i32)))
3-
(type $none_=>_none (func))
4-
(type $none_=>_i32 (func (result i32)))
5-
(type $i32_i64_=>_i32 (func (param i32 i64) (result i32)))
1+
(module $em_asm64.wasm
2+
(type $0 (func (param i64 i64 i64) (result i32)))
3+
(type $1 (func))
4+
(type $2 (func (result i32)))
5+
(type $3 (func (param i32 i64) (result i32)))
66
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i64 i64 i64) (result i32)))
77
(global $__stack_pointer (mut i64) (i64.const 66208))
88
(global $global$1 i64 (i64.const 574))
99
(global $global$2 i64 (i64.const 658))
1010
(memory $0 i64 2)
1111
(data $.rodata (i64.const 568) "\00ii\00i\00")
1212
(data $em_asm (i64.const 574) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
13-
(table $0 1 1 funcref)
13+
(table $0 i64 1 1 funcref)
1414
(export "memory" (memory $0))
1515
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
1616
(export "main" (func $main))
@@ -68,7 +68,7 @@
6868
(func $main (param $0 i32) (param $1 i64) (result i32)
6969
(call $__original_main)
7070
)
71-
;; custom section "producers", size 112
72-
;; features section: memory64
71+
;; custom section "producers", size 115
72+
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, reference-types, multivalue, memory64, bulk-memory-opt, call-indirect-overlong
7373
)
7474

test/lld/em_asm64.wat.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
(module
2-
(type $i64_i64_i64_=>_i32 (func (param i64 i64 i64) (result i32)))
3-
(type $none_=>_none (func))
4-
(type $none_=>_i32 (func (result i32)))
5-
(type $i32_i64_=>_i32 (func (param i32 i64) (result i32)))
1+
(module $em_asm64.wasm
2+
(type $0 (func (param i64 i64 i64) (result i32)))
3+
(type $1 (func))
4+
(type $2 (func (result i32)))
5+
(type $3 (func (param i32 i64) (result i32)))
66
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i64 i64 i64) (result i32)))
77
(global $__stack_pointer (mut i64) (i64.const 66208))
88
(global $global$1 i64 (i64.const 574))
99
(global $global$2 i64 (i64.const 658))
1010
(memory $0 i64 2)
1111
(data $.rodata (i64.const 568) "\00ii\00i\00")
1212
(data $em_asm (i64.const 574) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
13-
(table $0 1 1 funcref)
13+
(table $0 i64 1 1 funcref)
1414
(export "memory" (memory $0))
1515
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
1616
(export "main" (func $main))

test/lld/em_asm_O0.wat

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
(module
2-
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
3-
(type $none_=>_none (func))
4-
(type $none_=>_i32 (func (result i32)))
5-
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
1+
(module $em_asm_O0.wasm
2+
(type $0 (func (param i32 i32 i32) (result i32)))
3+
(type $1 (func))
4+
(type $2 (func (result i32)))
5+
(type $3 (func (param i32 i32) (result i32)))
66
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
77
(global $__stack_pointer (mut i32) (i32.const 66192))
88
(global $global$1 i32 (i32.const 568))
@@ -96,6 +96,7 @@
9696
(func $main (param $0 i32) (param $1 i32) (result i32)
9797
(call $__original_main)
9898
)
99-
;; custom section "producers", size 112
99+
;; custom section "producers", size 115
100+
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, reference-types, multivalue, bulk-memory-opt, call-indirect-overlong
100101
)
101102

test/lld/em_asm_O0.wat.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
(module
2-
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
3-
(type $none_=>_none (func))
4-
(type $none_=>_i32 (func (result i32)))
5-
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
1+
(module $em_asm_O0.wasm
2+
(type $0 (func (param i32 i32 i32) (result i32)))
3+
(type $1 (func))
4+
(type $2 (func (result i32)))
5+
(type $3 (func (param i32 i32) (result i32)))
66
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
77
(global $__stack_pointer (mut i32) (i32.const 66192))
88
(global $global$1 i32 (i32.const 568))

test/lld/em_asm_shared.wat

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
(module
2-
(type $none_=>_none (func))
3-
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
4-
(type $none_=>_i32 (func (result i32)))
5-
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
1+
(module $em_asm_shared.wasm
2+
(type $0 (func (param i32 i32 i32) (result i32)))
3+
(type $1 (func))
4+
(type $2 (func (result i32)))
5+
(type $3 (func (param i32 i32) (result i32)))
66
(import "env" "memory" (memory $mimport$0 1))
77
(import "env" "__indirect_function_table" (table $timport$0 0 funcref))
88
(import "env" "__stack_pointer" (global $__stack_pointer (mut i32)))
@@ -19,7 +19,6 @@
1919
(global $global$4 i32 (i32.const 90))
2020
(data $.data (global.get $__memory_base) "\00ii\00i\00{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
2121
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
22-
(export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs))
2322
(export "__original_main" (func $__original_main))
2423
(export "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJEEE6bufferE" (global $global$0))
2524
(export "_ZN20__em_asm_sig_builderI19__em_asm_type_tupleIJiiEEE6bufferE" (global $global$1))
@@ -29,8 +28,6 @@
2928
(export "__stop_em_asm" (global $global$4))
3029
(func $__wasm_call_ctors
3130
)
32-
(func $__wasm_apply_data_relocs
33-
)
3431
(func $__original_main (result i32)
3532
(local $0 i32)
3633
(local $1 i32)
@@ -98,7 +95,7 @@
9895
;; memoryalignment: 0
9996
;; tablesize: 0
10097
;; tablealignment: 0
101-
;; custom section "producers", size 112
102-
;; features section: mutable-globals
98+
;; custom section "producers", size 115
99+
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, reference-types, multivalue, bulk-memory-opt, call-indirect-overlong
103100
)
104101

0 commit comments

Comments
 (0)