diff --git a/lld/test/wasm/alias.s b/lld/test/wasm/alias.s index 83f40a8369921..427f0bbc17d68 100644 --- a/lld/test/wasm/alias.s +++ b/lld/test/wasm/alias.s @@ -25,14 +25,6 @@ _start: # CHECK-NEXT: - Type: MEMORY # CHECK-NEXT: Memories: # CHECK-NEXT: - Minimum: 0x1 -# CHECK-NEXT: - Type: GLOBAL -# CHECK-NEXT: Globals: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Type: I32 -# CHECK-NEXT: Mutable: true -# CHECK-NEXT: InitExpr: -# CHECK-NEXT: Opcode: I32_CONST -# CHECK-NEXT: Value: 65536 # CHECK-NEXT: - Type: EXPORT # CHECK-NEXT: Exports: # CHECK-NEXT: - Name: memory @@ -54,7 +46,4 @@ _start: # CHECK-NEXT: FunctionNames: # CHECK-NEXT: - Index: 0 # CHECK-NEXT: Name: _start -# CHECK-NEXT: GlobalNames: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Name: __stack_pointer # CHECK-NEXT: ... diff --git a/lld/test/wasm/build-id.test b/lld/test/wasm/build-id.test index 5fafd21d32240..8d0fb0293f551 100644 --- a/lld/test/wasm/build-id.test +++ b/lld/test/wasm/build-id.test @@ -43,18 +43,18 @@ foo: # DEFAULT: Contents of section build_id: -# DEFAULT-NEXT: 0079 103f86e6 3bb81959 2e99ffa9 acfed331 .?..;..Y.......1 -# DEFAULT-NEXT: 0089 3a +# DEFAULT-NEXT: 005b 104d7593 76cce050 6db31eff 76e5f762 .Mu.v..Pm...v..b +# DEFAULT-NEXT: 006b e0 . # SHA1: Contents of section build_id: -# SHA1-NEXT: 0079 1410ade4 e75d1c9d 71023465 03b7572f .....]..q.4e..W/ -# SHA1-NEXT: 0089 c06c5ae0 74 .lZ.t +# SHA1-NEXT: 005b 14b1ac8d 72e31051 2facff88 ff9b81cc ....r..Q/....... +# SHA1-NEXT: 006b f332c211 7e .2..~ # UUID: Contents of section build_id: -# UUID-NEXT: 0079 10 +# UUID-NEXT: 005b 10 # HEX: Contents of section build_id: -# HEX-NEXT: 0079 04123456 78 ..4Vx +# HEX-NEXT: 005b 04123456 78 ..4Vx # NONE-NOT: Contents of section build_id: diff --git a/lld/test/wasm/ctor-return-value.s b/lld/test/wasm/ctor-return-value.s index 1943306c88f90..067de0b700917 100644 --- a/lld/test/wasm/ctor-return-value.s +++ b/lld/test/wasm/ctor-return-value.s @@ -45,7 +45,4 @@ _start: # CHECK-NEXT: Name: myctor # CHECK-NEXT: - Index: 2 # CHECK-NEXT: Name: _start -# CHECK-NEXT: GlobalNames: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Name: __stack_pointer # CHECK-NEXT: ... diff --git a/lld/test/wasm/duplicate-global-imports.s b/lld/test/wasm/duplicate-global-imports.s index 8f057cd4f19e1..49f0ae7726105 100644 --- a/lld/test/wasm/duplicate-global-imports.s +++ b/lld/test/wasm/duplicate-global-imports.s @@ -65,5 +65,3 @@ _start: # CHECK-NEXT: Name: g3 # CHECK-NEXT: - Index: 2 # CHECK-NEXT: Name: g4 -# CHECK-NEXT: - Index: 3 -# CHECK-NEXT: Name: __stack_pointer diff --git a/lld/test/wasm/export-optional.s b/lld/test/wasm/export-optional.s index 1509715238312..f82a393730724 100644 --- a/lld/test/wasm/export-optional.s +++ b/lld/test/wasm/export-optional.s @@ -29,4 +29,4 @@ foo: # CHECK-NEXT: Index: 0 # CHECK-NEXT: - Name: __start_foo # CHECK-NEXT: Kind: GLOBAL -# CHECK-NEXT: Index: 1 +# CHECK-NEXT: Index: 0 diff --git a/lld/test/wasm/externref.s b/lld/test/wasm/externref.s index 1443e5f7fda5f..d64441fe54b97 100644 --- a/lld/test/wasm/externref.s +++ b/lld/test/wasm/externref.s @@ -31,12 +31,6 @@ _start: # CHECK: - Type: GLOBAL # CHECK-NEXT: Globals: # CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Type: I32 -# CHECK-NEXT: Mutable: true -# CHECK-NEXT: InitExpr: -# CHECK-NEXT: Opcode: I32_CONST -# CHECK-NEXT: Value: 65536 -# CHECK-NEXT: - Index: 1 # CHECK-NEXT: Type: EXTERNREF # CHECK-NEXT: Mutable: true # CHECK-NEXT: InitExpr: diff --git a/lld/test/wasm/function-imports-first.ll b/lld/test/wasm/function-imports-first.ll index b4e984092f82d..3a503cbe06371 100644 --- a/lld/test/wasm/function-imports-first.ll +++ b/lld/test/wasm/function-imports-first.ll @@ -41,7 +41,4 @@ declare i32 @ret32(float) local_unnamed_addr #1 ; CHECK-NEXT: Name: _start ; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Name: ret32 -; CHECK-NEXT: GlobalNames: -; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: Name: __stack_pointer ; CHECK-NEXT: ... diff --git a/lld/test/wasm/function-imports.s b/lld/test/wasm/function-imports.s index 825747849fff2..e303fbf820077 100644 --- a/lld/test/wasm/function-imports.s +++ b/lld/test/wasm/function-imports.s @@ -36,7 +36,4 @@ _start: # CHECK-NEXT: Name: ret32 # CHECK-NEXT: - Index: 1 # CHECK-NEXT: Name: _start -# CHECK-NEXT: GlobalNames: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Name: __stack_pointer # CHECK-NEXT: ... diff --git a/lld/test/wasm/gc-imports.s b/lld/test/wasm/gc-imports.s index 4e6053b5caf2c..69a0ae11eee95 100644 --- a/lld/test/wasm/gc-imports.s +++ b/lld/test/wasm/gc-imports.s @@ -48,8 +48,6 @@ _start: # CHECK-NEXT: GlobalNames: # CHECK-NEXT: - Index: 0 # CHECK-NEXT: Name: used_undef_global -# CHECK-NEXT: - Index: 1 -# CHECK-NEXT: Name: __stack_pointer # CHECK-NEXT: ... # RUN: wasm-ld --no-gc-sections --allow-undefined \ diff --git a/lld/test/wasm/gc-sections.ll b/lld/test/wasm/gc-sections.ll index 69d7ed2105cf7..b7322b55a19e1 100644 --- a/lld/test/wasm/gc-sections.ll +++ b/lld/test/wasm/gc-sections.ll @@ -53,15 +53,9 @@ entry: ; CHECK: - Type: GLOBAL ; CHECK-NEXT: Globals: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: Type: I32 +; CHECK-NEXT: Type: I64 ; CHECK-NEXT: Mutable: true ; CHECK-NEXT: InitExpr: -; CHECK-NEXT: Opcode: I32_CONST -; CHECK-NEXT: Value: 65536 -; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: Type: I64 -; CHECK-NEXT: Mutable: true -; CHECK-NEXT: InitExpr: ; CHECK-NEXT: Opcode: I64_CONST ; CHECK-NEXT: Value: 456 @@ -84,8 +78,6 @@ entry: ; CHECK-NEXT: Name: use_global ; CHECK-NEXT: GlobalNames: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: Name: __stack_pointer -; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Name: used_global ; CHECK-NEXT: DataSegmentNames: ; CHECK-NEXT: - Index: 0 diff --git a/lld/test/wasm/global-base.test b/lld/test/wasm/global-base.test index d94446a7638bf..490a4db782500 100644 --- a/lld/test/wasm/global-base.test +++ b/lld/test/wasm/global-base.test @@ -16,17 +16,11 @@ CHECK-1024: - Type: GLOBAL CHECK-1024-NEXT: Globals: CHECK-1024-NEXT: - Index: 0 CHECK-1024-NEXT: Type: I32 -CHECK-1024-NEXT: Mutable: true -CHECK-1024-NEXT: InitExpr: -CHECK-1024-NEXT: Opcode: I32_CONST -CHECK-1024-NEXT: Value: 65536 -CHECK-1024-NEXT: - Index: 1 -CHECK-1024-NEXT: Type: I32 CHECK-1024-NEXT: Mutable: false CHECK-1024-NEXT: InitExpr: CHECK-1024-NEXT: Opcode: I32_CONST CHECK-1024-NEXT: Value: 65536 -CHECK-1024-NEXT: - Index: 2 +CHECK-1024-NEXT: - Index: 1 CHECK-1024-NEXT: Type: I32 CHECK-1024-NEXT: Mutable: false CHECK-1024-NEXT: InitExpr: @@ -36,10 +30,10 @@ CHECK-1024-NEXT: Value: 65536 CHECK-1024: - Type: EXPORT CHECK-1024: - Name: __data_end CHECK-1024-NEXT: Kind: GLOBAL -CHECK-1024-NEXT: Index: 1 +CHECK-1024-NEXT: Index: 0 CHECK-1024-NEXT: - Name: __global_base CHECK-1024-NEXT: Kind: GLOBAL -CHECK-1024-NEXT: Index: 2 +CHECK-1024-NEXT: Index: 1 RUN: wasm-ld --export=__global_base --export=__data_end --allow-undefined --global-base=16777216 -o %t.wasm %t.o RUN: obj2yaml %t.wasm | FileCheck %s -check-prefix=CHECK-16777216 @@ -47,17 +41,11 @@ CHECK-16777216: - Type: GLOBAL CHECK-16777216-NEXT: Globals: CHECK-16777216-NEXT: - Index: 0 CHECK-16777216-NEXT: Type: I32 -CHECK-16777216-NEXT: Mutable: true -CHECK-16777216-NEXT: InitExpr: -CHECK-16777216-NEXT: Opcode: I32_CONST -CHECK-16777216-NEXT: Value: 65536 -CHECK-16777216-NEXT: - Index: 1 -CHECK-16777216-NEXT: Type: I32 CHECK-16777216-NEXT: Mutable: false CHECK-16777216-NEXT: InitExpr: CHECK-16777216-NEXT: Opcode: I32_CONST CHECK-16777216-NEXT: Value: 16777216 -CHECK-16777216-NEXT: - Index: 2 +CHECK-16777216-NEXT: - Index: 1 CHECK-16777216-NEXT: Type: I32 CHECK-16777216-NEXT: Mutable: false CHECK-16777216-NEXT: InitExpr: @@ -67,7 +55,7 @@ CHECK-16777216-NEXT: Value: 16777216 CHECK-16777216: - Type: EXPORT CHECK-16777216: - Name: __data_end CHECK-16777216-NEXT: Kind: GLOBAL -CHECK-16777216-NEXT: Index: 1 +CHECK-16777216-NEXT: Index: 0 CHECK-16777216-NEXT: - Name: __global_base CHECK-16777216-NEXT: Kind: GLOBAL -CHECK-16777216-NEXT: Index: 2 +CHECK-16777216-NEXT: Index: 1 diff --git a/lld/test/wasm/globals.s b/lld/test/wasm/globals.s index 47d9ba82818b7..dbeebcc85584d 100644 --- a/lld/test/wasm/globals.s +++ b/lld/test/wasm/globals.s @@ -39,23 +39,17 @@ immutable_global: # CHECK-NEXT: Globals: # CHECK-NEXT: - Index: 0 # CHECK-NEXT: Type: I32 -# CHECK-NEXT: Mutable: true +# CHECK-NEXT: Mutable: false # CHECK-NEXT: InitExpr: # CHECK-NEXT: Opcode: I32_CONST -# CHECK-NEXT: Value: 65536 -# CHECK-NEXT: - Index: 1 -# CHECK-NEXT: Type: I32 -# CHECK-NEXT: Mutable: false -# CHECK-NEXT: InitExpr: -# CHECK-NEXT: Opcode: I32_CONST -# CHECK-NEXT: Value: 0 -# CHECK-NEXT: - Index: 2 +# CHECK-NEXT: Value: 0 +# CHECK-NEXT: - Index: 1 # CHECK-NEXT: Type: I32 # CHECK-NEXT: Mutable: true # CHECK-NEXT: InitExpr: # CHECK-NEXT: Opcode: I32_CONST # CHECK-NEXT: Value: 0 -# CHECK-NEXT: - Index: 3 +# CHECK-NEXT: - Index: 2 # CHECK-NEXT: Type: F32 # CHECK-NEXT: Mutable: true # CHECK-NEXT: InitExpr: diff --git a/lld/test/wasm/lto/tls.ll b/lld/test/wasm/lto/tls.ll index 9c1642eb84535..d2bc2979b7f78 100644 --- a/lld/test/wasm/lto/tls.ll +++ b/lld/test/wasm/lto/tls.ll @@ -27,12 +27,6 @@ attributes #0 = { noinline nounwind optnone "target-features"="+atomics,+bulk-me ; CHECK-NEXT: Globals: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Type: I32 -; CHECK-NEXT: Mutable: true -; CHECK-NEXT: InitExpr: -; CHECK-NEXT: Opcode: I32_CONST -; CHECK-NEXT: Value: 65536 -; CHECK-NEXT: - Index: 1 -; CHECK-NEXT: Type: I32 ; CHECK-NEXT: Mutable: false ; CHECK-NEXT: InitExpr: ; CHECK-NEXT: Opcode: I32_CONST @@ -40,6 +34,4 @@ attributes #0 = { noinline nounwind optnone "target-features"="+atomics,+bulk-me ; CHECK: GlobalNames: ; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: Name: __stack_pointer -; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Name: __tls_base diff --git a/lld/test/wasm/map-file.s b/lld/test/wasm/map-file.s index 380ab57ca8ee4..ade851e73838d 100644 --- a/lld/test/wasm/map-file.s +++ b/lld/test/wasm/map-file.s @@ -47,27 +47,26 @@ somezeroes: # CHECK-NEXT: - 16 6 FUNCTION # CHECK-NEXT: - 1c 7 TABLE # CHECK-NEXT: - 23 5 MEMORY -# CHECK-NEXT: - 28 f GLOBAL -# CHECK-NEXT: 0 0 0 __stack_pointer -# CHECK-NEXT: 1 0 0 wasm_global -# CHECK-NEXT: - 37 15 EXPORT -# CHECK-NEXT: - 4c 9 ELEM -# CHECK-NEXT: - 55 2d CODE -# CHECK-NEXT: - 56 10 {{.*}}{{/|\\}}map-file.s.tmp1.o:(bar) -# CHECK-NEXT: - 56 10 bar -# CHECK-NEXT: - 66 b {{.*}}{{/|\\}}map-file.s.tmp1.o:(write_global) -# CHECK-NEXT: - 66 b write_global -# CHECK-NEXT: - 71 f {{.*}}{{/|\\}}map-file.s.tmp1.o:(_start) -# CHECK-NEXT: - 71 f _start -# CHECK-NEXT: - 82 12 DATA -# CHECK-NEXT: 10000 83 8 .data -# CHECK-NEXT: 10000 8a 8 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.data.somedata) -# CHECK-NEXT: 10000 8a 8 somedata -# CHECK-NEXT: 10008 82 4 .bss +# CHECK-NEXT: - 28 8 GLOBAL +# CHECK-NEXT: 0 0 0 wasm_global +# CHECK-NEXT: - 30 15 EXPORT +# CHECK-NEXT: - 45 9 ELEM +# CHECK-NEXT: - 4e 2d CODE +# CHECK-NEXT: - 4f 10 {{.*}}{{/|\\}}map-file.s.tmp1.o:(bar) +# CHECK-NEXT: - 4f 10 bar +# CHECK-NEXT: - 5f b {{.*}}{{/|\\}}map-file.s.tmp1.o:(write_global) +# CHECK-NEXT: - 5f b write_global +# CHECK-NEXT: - 6a f {{.*}}{{/|\\}}map-file.s.tmp1.o:(_start) +# CHECK-NEXT: - 6a f _start +# CHECK-NEXT: - 7b 12 DATA +# CHECK-NEXT: 10000 7c 8 .data +# CHECK-NEXT: 10000 83 8 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.data.somedata) +# CHECK-NEXT: 10000 83 8 somedata +# CHECK-NEXT: 10008 7b 4 .bss # CHECK-NEXT: 10008 0 4 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.bss.somezeroes) # CHECK-NEXT: 10008 0 4 somezeroes -# CHECK-NEXT: - 94 12 CUSTOM(.debug_info) -# CHECK-NEXT: - a6 61 CUSTOM(name) +# CHECK-NEXT: - 8d 12 CUSTOM(.debug_info) +# CHECK-NEXT: - 9f 50 CUSTOM(name) # RUN: not wasm-ld %t1.o -o /dev/null -Map=/ 2>&1 \ # RUN: | FileCheck -check-prefix=FAIL %s diff --git a/lld/test/wasm/merge-string-debug.s b/lld/test/wasm/merge-string-debug.s index 0075a834e0647..adf40205a6592 100644 --- a/lld/test/wasm/merge-string-debug.s +++ b/lld/test/wasm/merge-string-debug.s @@ -29,13 +29,13 @@ # CHECK: Hex dump of section '.debug_str': -# CHECK-O0: 0x00000025 636c616e 67207665 7273696f 6e203133 clang version 13 -# CHECK-O0: 0x00000035 2e302e30 00666f6f 62617200 636c616e .0.0.foobar.clan -# CHECK-O0: 0x00000045 67207665 7273696f 6e203133 2e302e30 g version 13.0.0 -# CHECK-O0: 0x00000055 00626172 00666f6f 00 .bar.foo. +# CHECK-O0: 0x0000001b 636c616e 67207665 7273696f 6e203133 clang version 13 +# CHECK-O0: 0x0000002b 2e302e30 00666f6f 62617200 636c616e .0.0.foobar.clan +# CHECK-O0: 0x0000003b 67207665 7273696f 6e203133 2e302e30 g version 13.0.0 +# CHECK-O0: 0x0000004b 00626172 00666f6f 00 .bar.foo. -# CHECK-O1: 0x00000025 666f6f62 61720066 6f6f0063 6c616e67 foobar.foo.clang -# CHECK-O1: 0x00000035 20766572 73696f6e 2031332e 302e3000 version 13.0.0. +# CHECK-O1: 0x0000001b 666f6f62 61720066 6f6f0063 6c616e67 foobar.foo.clang +# CHECK-O1: 0x0000002b 20766572 73696f6e 2031332e 302e3000 version 13.0.0. # CHECK-OFFSETS: Hex dump of section '.debug_str_offsets': -# CHECK-OFFSETS: 0x0000007e 00000000 00000000 00000000 ............ +# CHECK-OFFSETS: 0x00000074 00000000 00000000 00000000 ............ diff --git a/lld/test/wasm/mutable-global-exports.s b/lld/test/wasm/mutable-global-exports.s index 3cf1ae746b30a..76541aaf986ef 100644 --- a/lld/test/wasm/mutable-global-exports.s +++ b/lld/test/wasm/mutable-global-exports.s @@ -49,7 +49,7 @@ _start: # CHECK-NEXT: Index: 0 # CHECK-NEXT: - Name: foo_global # CHECK-NEXT: Kind: GLOBAL -# CHECK-NEXT: Index: 1 +# CHECK-NEXT: Index: 0 # CHECK-NEXT: - Type: CODE # CHECK-SP: - Type: EXPORT diff --git a/lld/test/wasm/name-section-mangling.s b/lld/test/wasm/name-section-mangling.s index a24fbc747d76e..6b2982d0ad658 100644 --- a/lld/test/wasm/name-section-mangling.s +++ b/lld/test/wasm/name-section-mangling.s @@ -58,7 +58,4 @@ _start: # CHECK-NEXT: - Index: 2 # DEMANGLE-NEXT: Name: 'foo(int)' # MANGLE-NEXT: Name: _Z3fooi -# CHECK-NEXT: GlobalNames: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Name: __stack_pointer # CHECK-NEXT: ... diff --git a/lld/test/wasm/signature-mismatch-export.ll b/lld/test/wasm/signature-mismatch-export.ll index b77b5092a092a..997449bfdbeb9 100644 --- a/lld/test/wasm/signature-mismatch-export.ll +++ b/lld/test/wasm/signature-mismatch-export.ll @@ -27,7 +27,4 @@ entry: ; CHECK-NEXT: Name: _start ; CHECK-NEXT: - Index: 2 ; CHECK-NEXT: Name: ret32 -; CHECK-NEXT: GlobalNames: -; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: Name: __stack_pointer ; CHECK-NEXT: ... diff --git a/lld/test/wasm/signature-mismatch.s b/lld/test/wasm/signature-mismatch.s index 89915dbdb30ce..9c9e81c29fa66 100644 --- a/lld/test/wasm/signature-mismatch.s +++ b/lld/test/wasm/signature-mismatch.s @@ -74,9 +74,6 @@ ret32_address_main: # YAML-NEXT: Name: ret32 # YAML-NEXT: - Index: 3 # YAML-NEXT: Name: call_ret32 -# YAML-NEXT: GlobalNames: -# YAML-NEXT: - Index: 0 -# YAML-NEXT: Name: __stack_pointer # YAML-NEXT: DataSegmentNames: # YAML-NEXT: - Index: 0 # YAML-NEXT: Name: .data diff --git a/lld/test/wasm/stack-first.test b/lld/test/wasm/stack-first.test index 91f06a47070a0..5cfd11ee9d965 100644 --- a/lld/test/wasm/stack-first.test +++ b/lld/test/wasm/stack-first.test @@ -23,23 +23,17 @@ CHECK: - Type: GLOBAL CHECK-NEXT: Globals: CHECK-NEXT: - Index: 0 CHECK-NEXT: Type: I32 -CHECK-NEXT: Mutable: true -CHECK-NEXT: InitExpr: -CHECK-NEXT: Opcode: I32_CONST -CHECK-NEXT: Value: 512 -CHECK-NEXT: - Index: 1 -CHECK-NEXT: Type: I32 CHECK-NEXT: Mutable: false CHECK-NEXT: InitExpr: CHECK-NEXT: Opcode: I32_CONST CHECK-NEXT: Value: 512 -CHECK-NEXT: - Index: 2 +CHECK-NEXT: - Index: 1 CHECK-NEXT: Type: I32 CHECK-NEXT: Mutable: false CHECK-NEXT: InitExpr: CHECK-NEXT: Opcode: I32_CONST CHECK-NEXT: Value: 513 -CHECK-NEXT: - Index: 3 +CHECK-NEXT: - Index: 2 CHECK-NEXT: Type: I32 CHECK-NEXT: Mutable: false CHECK-NEXT: InitExpr: @@ -55,24 +49,18 @@ CHECK-NEXT: Kind: FUNCTION CHECK-NEXT: Index: 0 CHECK-NEXT: - Name: someByte CHECK-NEXT: Kind: GLOBAL -CHECK-NEXT: Index: 1 +CHECK-NEXT: Index: 0 CHECK-NEXT: - Name: __data_end CHECK-NEXT: Kind: GLOBAL -CHECK-NEXT: Index: 2 +CHECK-NEXT: Index: 1 CHECK-NEXT: - Name: __heap_base CHECK-NEXT: Kind: GLOBAL -CHECK-NEXT: Index: 3 +CHECK-NEXT: Index: 2 NOT-FIRST: - Type: GLOBAL NOT-FIRST-NEXT: Globals: NOT-FIRST-NEXT: - Index: 0 NOT-FIRST-NEXT: Type: I32 -NOT-FIRST-NEXT: Mutable: true -NOT-FIRST-NEXT: InitExpr: -NOT-FIRST-NEXT: Opcode: I32_CONST -NOT-FIRST-NEXT: Value: 1552 -NOT-FIRST-NEXT: - Index: 1 -NOT-FIRST-NEXT: Type: I32 NOT-FIRST-NEXT: Mutable: false NOT-FIRST-NEXT: InitExpr: NOT-FIRST-NEXT: Opcode: I32_CONST diff --git a/lld/test/wasm/stack-pointer-abi.s b/lld/test/wasm/stack-pointer-abi.s index 6bfe0d4a8daa8..869f972710991 100644 --- a/lld/test/wasm/stack-pointer-abi.s +++ b/lld/test/wasm/stack-pointer-abi.s @@ -1,7 +1,7 @@ # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s -# RUN: wasm-ld --libcall-thread-context -o %t.libcall.wasm %t.o +# RUN: wasm-ld --libcall-thread-context --no-gc-sections -o %t.libcall.wasm %t.o # RUN: obj2yaml %t.libcall.wasm | FileCheck %s --check-prefix=LIBCALL -# RUN: wasm-ld -o %t.global.wasm %t.o +# RUN: wasm-ld --no-gc-sections -o %t.global.wasm %t.o # RUN: obj2yaml %t.global.wasm | FileCheck %s --check-prefix=GLOBAL .globl _start diff --git a/lld/test/wasm/startstop.ll b/lld/test/wasm/startstop.ll index c22956f2759e4..cad43abf04ca1 100644 --- a/lld/test/wasm/startstop.ll +++ b/lld/test/wasm/startstop.ll @@ -34,12 +34,12 @@ entry: ; CHECK-NEXT: Value: 65536 ; CHECK-NEXT: Content: 03000000040000002A0000002B000000 -; ASM: 00000070 : +; ASM: 00000069 : ; ASM-EMPTY: -; ASM-NEXT: 72: i32.const 65536 -; ASM-NEXT: 78: end +; ASM-NEXT: 6b: i32.const 65536 +; ASM-NEXT: 71: end -; ASM: 00000079 : +; ASM: 00000072 : ; ASM-EMPTY: -; ASM-NEXT: 7b: i32.const 65552 -; ASM-NEXT: 81: end +; ASM-NEXT: 74: i32.const 65552 +; ASM-NEXT: 7a: end diff --git a/lld/test/wasm/table-base.s b/lld/test/wasm/table-base.s index 92156c49cd538..bf814ed829b20 100644 --- a/lld/test/wasm/table-base.s +++ b/lld/test/wasm/table-base.s @@ -26,12 +26,6 @@ _start: # CHECK-DEFAULT-NEXT: Globals: # CHECK-DEFAULT-NEXT: - Index: 0 # CHECK-DEFAULT-NEXT: Type: I32 -# CHECK-DEFAULT-NEXT: Mutable: true -# CHECK-DEFAULT-NEXT: InitExpr: -# CHECK-DEFAULT-NEXT: Opcode: I32_CONST -# CHECK-DEFAULT-NEXT: Value: 65536 -# CHECK-DEFAULT-NEXT: - Index: 1 -# CHECK-DEFAULT-NEXT: Type: I32 # CHECK-DEFAULT-NEXT: Mutable: false # CHECK-DEFAULT-NEXT: InitExpr: # CHECK-DEFAULT-NEXT: Opcode: I32_CONST @@ -40,7 +34,7 @@ _start: # CHECK-DEFAULT: - Type: EXPORT # CHECK-DEFAULT: - Name: __table_base # CHECK-DEFAULT-NEXT: Kind: GLOBAL -# CHECK-DEFAULT-NEXT: Index: 1 +# CHECK-DEFAULT-NEXT: Index: 0 # CHECK-100: - Type: TABLE # CHECK-100-NEXT: Tables: @@ -55,12 +49,6 @@ _start: # CHECK-100-NEXT: Globals: # CHECK-100-NEXT: - Index: 0 # CHECK-100-NEXT: Type: I32 -# CHECK-100-NEXT: Mutable: true -# CHECK-100-NEXT: InitExpr: -# CHECK-100-NEXT: Opcode: I32_CONST -# CHECK-100-NEXT: Value: 65536 -# CHECK-100-NEXT: - Index: 1 -# CHECK-100-NEXT: Type: I32 # CHECK-100-NEXT: Mutable: false # CHECK-100-NEXT: InitExpr: # CHECK-100-NEXT: Opcode: I32_CONST @@ -69,4 +57,4 @@ _start: # CHECK-100: - Type: EXPORT # CHECK-100: - Name: __table_base # CHECK-100-NEXT: Kind: GLOBAL -# CHECK-100-NEXT: Index: 1 +# CHECK-100-NEXT: Index: 0 diff --git a/lld/test/wasm/tag-section.ll b/lld/test/wasm/tag-section.ll index 86c891d3bb78d..2692588ced971 100644 --- a/lld/test/wasm/tag-section.ll +++ b/lld/test/wasm/tag-section.ll @@ -4,7 +4,7 @@ ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section1.ll -o %t1.o ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %p/Inputs/tag-section2.ll -o %t2.o ; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %s -o %t.o -; RUN: wasm-ld -o %t.wasm %t.o %t1.o %t2.o %t_tags.o +; RUN: wasm-ld --export=my_global -o %t.wasm %t.o %t1.o %t2.o %t_tags.o ; RUN: wasm-ld --export-all -o %t-export-all.wasm %t.o %t1.o %t2.o %t_tags.o ; RUN: obj2yaml %t.wasm | FileCheck %s --check-prefix=NOPIC ; RUN: obj2yaml %t-export-all.wasm | FileCheck %s --check-prefix=NOPIC-EXPORT-ALL @@ -19,6 +19,8 @@ target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-emscripten" +@my_global = global i32 42 + declare void @foo(ptr) declare void @bar(ptr) diff --git a/lld/test/wasm/tls-base-non-shared-memory.s b/lld/test/wasm/tls-base-non-shared-memory.s index df027e520a649..8a739a97f22b0 100644 --- a/lld/test/wasm/tls-base-non-shared-memory.s +++ b/lld/test/wasm/tls-base-non-shared-memory.s @@ -19,12 +19,6 @@ _start: # CHECK-NEXT: Globals: # CHECK-NEXT: - Index: 0 # CHECK-NEXT: Type: I32 -# CHECK-NEXT: Mutable: true -# CHECK-NEXT: InitExpr: -# CHECK-NEXT: Opcode: I32_CONST -# CHECK-NEXT: Value: 65536 -# CHECK-NEXT: - Index: 1 -# CHECK-NEXT: Type: I32 # CHECK-NEXT: Mutable: false # CHECK-NEXT: InitExpr: # CHECK-NEXT: Opcode: I32_CONST @@ -32,6 +26,4 @@ _start: # CHECK: GlobalNames: # CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Name: __stack_pointer -# CHECK-NEXT: - Index: 1 # CHECK-NEXT: Name: __tls_base diff --git a/lld/test/wasm/undefined-weak-call.s b/lld/test/wasm/undefined-weak-call.s index 47775c86f28ea..4b805d861ab03 100644 --- a/lld/test/wasm/undefined-weak-call.s +++ b/lld/test/wasm/undefined-weak-call.s @@ -62,14 +62,6 @@ callWeakFuncs: # CHECK-NEXT: - Type: MEMORY # CHECK-NEXT: Memories: # CHECK-NEXT: - Minimum: 0x1 -# CHECK-NEXT: - Type: GLOBAL -# CHECK-NEXT: Globals: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Type: I32 -# CHECK-NEXT: Mutable: true -# CHECK-NEXT: InitExpr: -# CHECK-NEXT: Opcode: I32_CONST -# CHECK-NEXT: Value: 65536 # CHECK-NEXT: - Type: EXPORT # CHECK-NEXT: Exports: # CHECK-NEXT: - Name: memory @@ -103,7 +95,4 @@ callWeakFuncs: # CHECK-NEXT: Name: 'undefined_weak:weakFunc3' # CHECK-NEXT: - Index: 3 # CHECK-NEXT: Name: callWeakFuncs -# CHECK-NEXT: GlobalNames: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Name: __stack_pointer # CHECK-NEXT: ... diff --git a/lld/test/wasm/unresolved-symbols-dynamic.s b/lld/test/wasm/unresolved-symbols-dynamic.s index 501c30defc7ff..c7efbed74b7fd 100644 --- a/lld/test/wasm/unresolved-symbols-dynamic.s +++ b/lld/test/wasm/unresolved-symbols-dynamic.s @@ -75,8 +75,6 @@ data_ptr: # CHECK-NEXT: Name: undef # CHECK-NEXT: - Index: 2 # CHECK-NEXT: Name: data_external -# CHECK-NEXT: - Index: 3 -# CHECK-NEXT: Name: __stack_pointer # CHECK-NEXT: DataSegmentNames: # CHECK-NEXT: - Index: 0 # CHECK-NEXT: Name: .data diff --git a/lld/test/wasm/weak-undefined-pic.s b/lld/test/wasm/weak-undefined-pic.s index 66232878be8af..93862d46cf179 100644 --- a/lld/test/wasm/weak-undefined-pic.s +++ b/lld/test/wasm/weak-undefined-pic.s @@ -40,16 +40,10 @@ _start: # CHECK: - Type: GLOBAL # CHECK-NEXT: Globals: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Type: I32 -# CHECK-NEXT: Mutable: true -# CHECK-NEXT: InitExpr: -# CHECK-NEXT: Opcode: I32_CONST -# CHECK-NEXT: Value: 65536 # Global 'undefined_weak:foo' representing the GOT entry for foo # Unlike other internal GOT entries that need to be mutable this one # is immutable and not updated by `__wasm_apply_global_relocs` -# CHECK-NEXT: - Index: 1 +# CHECK-NEXT: - Index: 0 # CHECK-NEXT: Type: I32 # CHECK-NEXT: Mutable: false # CHECK-NEXT: InitExpr: @@ -67,8 +61,6 @@ _start: # CHECK-NEXT: Name: _start # CHECK-NEXT: GlobalNames: # CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Name: __stack_pointer -# CHECK-NEXT: - Index: 1 # CHECK-NEXT: Name: 'GOT.func.internal.undefined_weak:foo' # With `-pie` or `-shared` the resolution should be deferred to the dynamic diff --git a/lld/test/wasm/weak-undefined.s b/lld/test/wasm/weak-undefined.s index 558cac527d702..abbdbf5b1baa2 100644 --- a/lld/test/wasm/weak-undefined.s +++ b/lld/test/wasm/weak-undefined.s @@ -68,14 +68,6 @@ _start: # CHECK-NEXT: - Type: MEMORY # CHECK-NEXT: Memories: # CHECK-NEXT: - Minimum: 0x1 -# CHECK-NEXT: - Type: GLOBAL -# CHECK-NEXT: Globals: -# CHECK-NEXT: - Index: 0 -# CHECK-NEXT: Type: I32 -# CHECK-NEXT: Mutable: true -# CHECK-NEXT: InitExpr: -# CHECK-NEXT: Opcode: I32_CONST -# CHECK-NEXT: Value: 65536 # CHECK-NEXT: - Type: EXPORT # CHECK-NEXT: Exports: # CHECK-NEXT: - Name: memory diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index f2eec055f65b2..fe1e2eec95037 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -962,7 +962,6 @@ static void createSyntheticSymbols() { // For non-PIC code ctx.sym.stackPointer = createGlobalVariable(stack_pointer_name, !ctx.arg.libcallThreadContext); - ctx.sym.stackPointer->markLive(); } if (ctx.arg.sharedMemory) {