Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Nov 7, 2025

The really painful part of this PR was updating all the test files. I had some help from Gemini GLI there
which did a pretty good job (got maybe 80% of the updates done).

Fixes: #151015

@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2025

@llvm/pr-subscribers-lld-wasm

@llvm/pr-subscribers-lld

Author: Sam Clegg (sbc100)

Changes

Fixes: #151015


Patch is 64.35 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/166998.diff

51 Files Affected:

  • (modified) lld/docs/ReleaseNotesTemplate.txt (+3)
  • (modified) lld/test/wasm/alias.s (+2-2)
  • (modified) lld/test/wasm/bss-only.s (+2-2)
  • (modified) lld/test/wasm/build-id.test (+4-4)
  • (modified) lld/test/wasm/call-indirect.s (+6-6)
  • (modified) lld/test/wasm/comdats.ll (+5-5)
  • (modified) lld/test/wasm/compress-relocs.s (+6-6)
  • (modified) lld/test/wasm/compress-relocs64.s (+6-6)
  • (modified) lld/test/wasm/custom-section-name.ll (+8-8)
  • (modified) lld/test/wasm/data-layout.s (+7-7)
  • (modified) lld/test/wasm/data-segment-merging.ll (+8-8)
  • (modified) lld/test/wasm/data-segments.ll (+14-14)
  • (modified) lld/test/wasm/debuginfo.test (+1-1)
  • (modified) lld/test/wasm/dylink-non-pie.s (+1-1)
  • (modified) lld/test/wasm/emit-relocs.s (+3-3)
  • (modified) lld/test/wasm/externref.s (+1-1)
  • (modified) lld/test/wasm/gc-sections.ll (+6-6)
  • (modified) lld/test/wasm/global-base.test (+4-4)
  • (modified) lld/test/wasm/globals.s (+1-1)
  • (modified) lld/test/wasm/import-memory.test (+1-1)
  • (modified) lld/test/wasm/init-fini.ll (+1-1)
  • (modified) lld/test/wasm/large-memory.test (+1-1)
  • (modified) lld/test/wasm/local-symbols.ll (+5-5)
  • (modified) lld/test/wasm/locals-duplicate.test (+12-12)
  • (modified) lld/test/wasm/lto/tls.ll (+2-2)
  • (modified) lld/test/wasm/lto/used.ll (+2-2)
  • (modified) lld/test/wasm/map-file.s (+9-9)
  • (modified) lld/test/wasm/memory-naming.test (+3-3)
  • (modified) lld/test/wasm/merge-string.s (+7-7)
  • (modified) lld/test/wasm/multi-table.s (+4-4)
  • (modified) lld/test/wasm/no-strip-segment.s (+4-4)
  • (modified) lld/test/wasm/no-tls.s (+1-1)
  • (modified) lld/test/wasm/page-size.s (+2-2)
  • (modified) lld/test/wasm/pic-static.ll (+4-4)
  • (modified) lld/test/wasm/reloc-relative.s (+12-12)
  • (modified) lld/test/wasm/shared-memory-no-atomics.yaml (+1-1)
  • (modified) lld/test/wasm/shared-memory.yaml (+6-6)
  • (modified) lld/test/wasm/stack-first.test (+7-6)
  • (modified) lld/test/wasm/startstop.ll (+8-8)
  • (modified) lld/test/wasm/table-base.s (+2-2)
  • (modified) lld/test/wasm/tls-align.s (+1-1)
  • (modified) lld/test/wasm/tls-non-shared-memory-basic.s (+2-2)
  • (modified) lld/test/wasm/tls-non-shared-memory.s (+7-7)
  • (modified) lld/test/wasm/tls.s (+1-1)
  • (modified) lld/test/wasm/undefined-weak-call.s (+2-2)
  • (modified) lld/test/wasm/weak-alias-overide.ll (+2-2)
  • (modified) lld/test/wasm/weak-alias.ll (+2-2)
  • (modified) lld/test/wasm/weak-symbols.s (+4-4)
  • (modified) lld/test/wasm/weak-undefined-pic.s (+1-1)
  • (modified) lld/test/wasm/weak-undefined.s (+2-2)
  • (modified) lld/wasm/Driver.cpp (+1-1)
diff --git a/lld/docs/ReleaseNotesTemplate.txt b/lld/docs/ReleaseNotesTemplate.txt
index cc1628f48bb0e..ba56c121eaf76 100644
--- a/lld/docs/ReleaseNotesTemplate.txt
+++ b/lld/docs/ReleaseNotesTemplate.txt
@@ -44,5 +44,8 @@ MachO Improvements
 WebAssembly Improvements
 ------------------------
 
+- The `--stack-first` flag is now enabled by default. The old
+  behaviour can be enabled used `--no-stack-first`.
+
 Fixes
 #####
diff --git a/lld/test/wasm/alias.s b/lld/test/wasm/alias.s
index 0bb035b92f29c..83f40a8369921 100644
--- a/lld/test/wasm/alias.s
+++ b/lld/test/wasm/alias.s
@@ -24,7 +24,7 @@ _start:
 # CHECK-NEXT:     FunctionTypes:   [ 0 ]
 # CHECK-NEXT:   - Type:            MEMORY
 # CHECK-NEXT:     Memories:
-# CHECK-NEXT:       - Minimum:         0x2
+# CHECK-NEXT:       - Minimum:         0x1
 # CHECK-NEXT:   - Type:            GLOBAL
 # CHECK-NEXT:     Globals:
 # CHECK-NEXT:       - Index:           0
@@ -32,7 +32,7 @@ _start:
 # CHECK-NEXT:         Mutable:         true
 # CHECK-NEXT:         InitExpr:
 # CHECK-NEXT:           Opcode:          I32_CONST
-# CHECK-NEXT:           Value:           66560
+# CHECK-NEXT:           Value:           65536
 # CHECK-NEXT:   - Type:            EXPORT
 # CHECK-NEXT:     Exports:
 # CHECK-NEXT:       - Name:            memory
diff --git a/lld/test/wasm/bss-only.s b/lld/test/wasm/bss-only.s
index 1c0500f172ca4..bec7592129e7b 100644
--- a/lld/test/wasm/bss-only.s
+++ b/lld/test/wasm/bss-only.s
@@ -26,13 +26,13 @@ b:
 # CHECK-NEXT:         Mutable:         true
 # CHECK-NEXT:         InitExpr:
 # CHECK-NEXT:           Opcode:          I32_CONST
-# CHECK-NEXT:           Value:           67568
+# 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:           2028
+# CHECK-NEXT:           Value:           66540
 # CHECK-NEXT:   - Type:            EXPORT
 # CHECK-NEXT:     Exports:
 # CHECK-NEXT:       - Name:            memory
diff --git a/lld/test/wasm/build-id.test b/lld/test/wasm/build-id.test
index dd6e2237108f3..5fafd21d32240 100644
--- a/lld/test/wasm/build-id.test
+++ b/lld/test/wasm/build-id.test
@@ -43,12 +43,12 @@ foo:
 
 
 # DEFAULT:      Contents of section build_id:
-# DEFAULT-NEXT: 0079 10299168 1e3c845a 3c8f80ae 2f16cc22  .).h.<.Z<.../.."
-# DEFAULT-NEXT: 0089 2d
+# DEFAULT-NEXT: 0079 103f86e6 3bb81959 2e99ffa9 acfed331 .?..;..Y.......1
+# DEFAULT-NEXT: 0089 3a
 
 # SHA1:      Contents of section build_id:
-# SHA1-NEXT: 0079 145abdda 387a9bc4 e3aed3c3 3319cd37  .Z..8z......3..7
-# SHA1-NEXT: 0089 0212237c e4                          ..#|.
+# SHA1-NEXT: 0079 1410ade4 e75d1c9d 71023465 03b7572f .....]..q.4e..W/
+# SHA1-NEXT: 0089 c06c5ae0 74                          .lZ.t
 
 # UUID:      Contents of section build_id:
 # UUID-NEXT: 0079 10
diff --git a/lld/test/wasm/call-indirect.s b/lld/test/wasm/call-indirect.s
index 7bf39a9f5aec9..64eaa593731be 100644
--- a/lld/test/wasm/call-indirect.s
+++ b/lld/test/wasm/call-indirect.s
@@ -82,13 +82,13 @@ indirect_func:
 # CHECK-NEXT:         Mutable:         true
 # CHECK-NEXT:         InitExpr:
 # CHECK-NEXT:           Opcode:          I32_CONST
-# CHECK-NEXT:           Value:           66576
+# 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:           1032
+# CHECK-NEXT:           Value:           65544
 # CHECK-NEXT:   - Type:            EXPORT
 # CHECK-NEXT:     Exports:
 # CHECK-NEXT:       - Name:            memory
@@ -125,23 +125,23 @@ indirect_func:
 # CHECK-NEXT:         Body:            42010B
 # CHECK-NEXT:       - Index:           1
 # CHECK-NEXT:         Locals:
-# CHECK-NEXT:         Body:            410028028088808000118080808000001A410028028488808000118180808000001A0B
+# CHECK-NEXT:         Body:            410028028080848000118080808000001A410028028480848000118180808000001A0B
 # CHECK-NEXT:       - Index:           2
 # CHECK-NEXT:         Locals:
 # CHECK-NEXT:         Body:            41020B
 # CHECK-NEXT:       - Index:           3
 # CHECK-NEXT:         Locals:
-# CHECK-NEXT:         Body:            410028028888808000118180808000001A0B
+# CHECK-NEXT:         Body:            410028028880848000118180808000001A0B
 # CHECK-NEXT:       - Index:           4
 # CHECK-NEXT:         Locals:
 # CHECK-NEXT:         Body:            42012000118280808000001A0B
 # CHECK-NEXT:   - Type:            DATA
 # CHECK-NEXT:     Segments:
-# CHECK-NEXT:       - SectionOffset:    7
+# CHECK-NEXT:       - SectionOffset:    8
 # CHECK-NEXT:         InitFlags:        0
 # CHECK-NEXT:         Offset:
 # CHECK-NEXT:           Opcode:          I32_CONST
-# CHECK-NEXT:           Value:           1024
+# CHECK-NEXT:           Value:           65536
 # CHECK-NEXT:         Content:         '010000000200000002000000'
 # CHECK-NEXT:   - Type:            CUSTOM
 # CHECK-NEXT:     Name:            name
diff --git a/lld/test/wasm/comdats.ll b/lld/test/wasm/comdats.ll
index 2dd687fbad1ef..1662a983698ac 100644
--- a/lld/test/wasm/comdats.ll
+++ b/lld/test/wasm/comdats.ll
@@ -23,13 +23,13 @@ entry:
 ; CHECK-NEXT:        Mutable:         true
 ; CHECK-NEXT:        InitExpr:
 ; CHECK-NEXT:          Opcode:          I32_CONST
-; CHECK-NEXT:          Value:           66576
+; 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:           1024
+; CHECK-NEXT:          Value:           65536
 ; CHECK-NEXT:  - Type:            EXPORT
 ; CHECK-NEXT:    Exports:
 ; CHECK-NEXT:      - Name:            memory
@@ -69,7 +69,7 @@ entry:
 ; CHECK-NEXT:        Body:            1080808080001082808080001A0B
 ; CHECK-NEXT:      - Index:           2
 ; CHECK-NEXT:        Locals:
-; CHECK-NEXT:        Body:            4180888080000B
+; CHECK-NEXT:        Body:            4180808480000B
 ; CHECK-NEXT:      - Index:           3
 ; CHECK-NEXT:        Locals:
 ; CHECK-NEXT:        Body:            0B
@@ -81,9 +81,9 @@ entry:
 ; CHECK-NEXT:        Body:            4181808080000B
 ; CHECK-NEXT:  - Type:            DATA
 ; CHECK-NEXT:    Segments:
-; CHECK-NEXT:      - SectionOffset:   7
+; CHECK-NEXT:      - SectionOffset:   8
 ; CHECK-NEXT:        InitFlags:       0
 ; CHECK-NEXT:        Offset:
 ; CHECK-NEXT:          Opcode:          I32_CONST
-; CHECK-NEXT:          Value:           1024
+; CHECK-NEXT:          Value:           65536
 ; CHECK-NEXT:        Content:         '616263'
diff --git a/lld/test/wasm/compress-relocs.s b/lld/test/wasm/compress-relocs.s
index 41d4ff567d501..37f1b3b170ff7 100644
--- a/lld/test/wasm/compress-relocs.s
+++ b/lld/test/wasm/compress-relocs.s
@@ -47,16 +47,16 @@ test_memory_and_indirect_call_relocs:
   end_function
 
 # CHECK:    test_memory_and_indirect_call_relocs
-# CHECK:      41 90 88 80 80 00                 i32.const      1040
+# CHECK:      41 90 80 84 80 00                 i32.const      65552
 # CHECK:      11 80 80 80 80 00 80 80 80 80 00  call_indirect  0
-# CHECK:      28 02 94 88 80 80 00              i32.load       1044
+# CHECK:      28 02 94 80 84 80 00              i32.load       65556
 # CHECK:      11 81 80 80 80 00 80 80 80 80 00  call_indirect  1
 # CHECK:      41 81 80 80 80 00                 i32.const      1
 # CHECK:      11 80 80 80 80 00 80 80 80 80 00  call_indirect  0
 # COMPRESS: test_memory_and_indirect_call_relocs
-# COMPRESS:   41 90 08                          i32.const      1040
+# COMPRESS:   41 90 80 04                       i32.const      65552
 # COMPRESS:   11 00 00                          call_indirect  0
-# COMPRESS:   28 02 94 08                       i32.load       1044
+# COMPRESS:   28 02 94 80 04                    i32.load       65556
 # COMPRESS:   11 01 00                          call_indirect  1
 # COMPRESS:   41 01                             i32.const      1
 # COMPRESS:   11 00 00                          call_indirect  0
@@ -91,11 +91,11 @@ test_relative_relocs:
   end_function
 
 # CHECK:    test_relative_relocs
-# CHECK:      41 90 88 80 80 00  i32.const  1040
+# CHECK:      41 90 80 84 80 00  i32.const  65552
 # CHECK:      41 81 80 80 80 00  i32.const  1
 # CHECK:      41 83 80 80 80 00  i32.const  3
 # COMPRESS: test_relative_relocs
-# COMPRESS:   41 90 08           i32.const  1040
+# COMPRESS:   41 90 80 04        i32.const  65552
 # COMPRESS:   41 01              i32.const  1
 # COMPRESS:   41 03              i32.const  3
 
diff --git a/lld/test/wasm/compress-relocs64.s b/lld/test/wasm/compress-relocs64.s
index 44e7a089275bb..f3ff646cc3b1c 100644
--- a/lld/test/wasm/compress-relocs64.s
+++ b/lld/test/wasm/compress-relocs64.s
@@ -36,12 +36,12 @@ test_memory_and_indirect_call_relocs:
   end_function
 
 # CHECK:    test_memory_and_indirect_call_relocs
-# CHECK:      42 90 88 80 80 80 80 80 80 80 00     i64.const 1040
-# CHECK:      29 03 98 88 80 80 80 80 80 80 80 00  i64.load  1048
+# CHECK:      42 90 80 84 80 80 80 80 80 80 00     i64.const 65552
+# CHECK:      29 03 98 80 84 80 80 80 80 80 80 00  i64.load  65560
 # CHECK:      42 81 80 80 80 80 80 80 80 80 00     i64.const 1
 # COMPRESS: test_memory_and_indirect_call_relocs
-# COMPRESS:   42 90 08                             i64.const 1040
-# COMPRESS:   29 03 98 08                          i64.load  1048
+# COMPRESS:   42 90 80 04                          i64.const 65552
+# COMPRESS:   29 03 98 80 04                       i64.load  65560
 # COMPRESS:   42 01                                i64.const 1
 
   .globl test_relative_relocs
@@ -56,11 +56,11 @@ test_relative_relocs:
   end_function
 
 # CHECK:    test_relative_relocs
-# CHECK:      42 90 88 80 80 80 80 80 80 80 00  i64.const 1040
+# CHECK:      42 90 80 84 80 80 80 80 80 80 00  i64.const 65552
 # CHECK:      42 81 80 80 80 80 80 80 80 80 00  i64.const 1
 # CHECK:      42 83 80 80 80 80 80 80 80 80 00  i64.const 3
 # COMPRESS: test_relative_relocs
-# COMPRESS:   42 90 08                          i64.const 1040
+# COMPRESS:   42 90 80 04                       i64.const 65552
 # COMPRESS:   42 01                             i64.const 1
 # COMPRESS:   42 03                             i64.const 3
 
diff --git a/lld/test/wasm/custom-section-name.ll b/lld/test/wasm/custom-section-name.ll
index 8799fbf36056d..89cb72fe3cf99 100644
--- a/lld/test/wasm/custom-section-name.ll
+++ b/lld/test/wasm/custom-section-name.ll
@@ -16,29 +16,29 @@ target triple = "wasm32-unknown-unknown"
 
 ; CHECK-LABEL: - Type:            DATA
 ; CHECK-NEXT:    Segments:
-; CHECK-NEXT:      - SectionOffset:   7
+; CHECK-NEXT:      - SectionOffset:   8
 ; CHECK-NEXT:        InitFlags:       0
 ; CHECK-NEXT:        Offset:
 ; CHECK-NEXT:          Opcode:          I32_CONST
-; CHECK-NEXT:          Value:           1024
+; CHECK-NEXT:          Value:           65536
 ; CHECK-NEXT:        Content:         '00000000'
-; CHECK-NEXT:      - SectionOffset:   17
+; CHECK-NEXT:      - SectionOffset:   19
 ; CHECK-NEXT:        InitFlags:       0
 ; CHECK-NEXT:        Offset:
 ; CHECK-NEXT:          Opcode:          I32_CONST
-; CHECK-NEXT:          Value:           1028
+; CHECK-NEXT:          Value:           65540
 ; CHECK-NEXT:        Content:         2A000000
-; CHECK-NEXT:      - SectionOffset:   27
+; CHECK-NEXT:      - SectionOffset:   30
 ; CHECK-NEXT:        InitFlags:       0
 ; CHECK-NEXT:        Offset:
 ; CHECK-NEXT:          Opcode:          I32_CONST
-; CHECK-NEXT:          Value:           1032
+; CHECK-NEXT:          Value:           65544
 ; CHECK-NEXT:        Content:         '07000000'
-; BSS-NEXT:        - SectionOffset:   37
+; BSS-NEXT:        - SectionOffset:   41
 ; BSS-NEXT:          InitFlags:       0
 ; BSS-NEXT:          Offset:
 ; BSS-NEXT:            Opcode:          I32_CONST
-; BSS-NEXT:            Value:           1036
+; BSS-NEXT:            Value:           65548
 ; BSS-NEXT:          Content:         '00000000'
 ; NO-BSS-NOT:      - SectionOffset:
 
diff --git a/lld/test/wasm/data-layout.s b/lld/test/wasm/data-layout.s
index a68bc032e4840..8df834d6ea8c4 100644
--- a/lld/test/wasm/data-layout.s
+++ b/lld/test/wasm/data-layout.s
@@ -63,33 +63,33 @@ local_struct_internal_ptr:
 # CHECK-NEXT:         Mutable:         true
 # CHECK-NEXT:         InitExpr:
 # CHECK-NEXT:           Opcode:          [[PTR]]_CONST
-# CHECK-NEXT:           Value:           66624
+# CHECK-NEXT:           Value:           65536
 # CHECK-NEXT:       - Index:           1
 # CHECK-NEXT:         Type:            [[PTR]]
 # CHECK-NEXT:         Mutable:         false
 # CHECK-NEXT:         InitExpr:
 # CHECK-NEXT:           Opcode:          [[PTR]]_CONST
-# CHECK-NEXT:           Value:           1080
+# CHECK-NEXT:           Value:           65592
 # CHECK-NEXT:       - Index:           2
 # CHECK-NEXT:         Type:            [[PTR]]
 # CHECK-NEXT:         Mutable:         false
 # CHECK-NEXT:         InitExpr:
 # CHECK-NEXT:           Opcode:          [[PTR]]_CONST
-# CHECK-NEXT:           Value:           66624
+# CHECK-NEXT:           Value:           65600
 
 # CHECK:        - Type:            DATA
 # CHECK-NEXT:     Segments:
-# CHECK-NEXT:       - SectionOffset:   7
+# CHECK-NEXT:       - SectionOffset:   8
 # CHECK-NEXT:         InitFlags:       0
 # CHECK-NEXT:         Offset:
 # CHECK-NEXT:           Opcode:          [[PTR]]_CONST
-# CHECK-NEXT:           Value:           1024
+# CHECK-NEXT:           Value:           65536
 # CHECK-NEXT:         Content:         68656C6C6F0A00
-# CHECK-NEXT:       - SectionOffset:   20
+# CHECK-NEXT:       - SectionOffset:   22
 # CHECK-NEXT:         InitFlags:       0
 # CHECK-NEXT:         Offset:
 # CHECK-NEXT:           Opcode:          [[PTR]]_CONST
-# CHECK-NEXT:           Value:           1040
+# CHECK-NEXT:           Value:           65552
 
 
 # RUN: wasm-ld -no-gc-sections --allow-undefined --no-entry \
diff --git a/lld/test/wasm/data-segment-merging.ll b/lld/test/wasm/data-segment-merging.ll
index e6f3c5ee469f2..34c49e8b901f6 100644
--- a/lld/test/wasm/data-segment-merging.ll
+++ b/lld/test/wasm/data-segment-merging.ll
@@ -15,11 +15,11 @@
 
 ; MERGE-LABEL: - Type:            DATA
 ; MERGE-NEXT:    Segments:
-; MERGE-NEXT:      - SectionOffset:   7
+; MERGE-NEXT:      - SectionOffset:   8
 ; MERGE-NEXT:        InitFlags:       0
 ; MERGE-NEXT:        Offset:
 ; MERGE:             Content:         636F6E7374616E74000000002B
-; MERGE-NEXT:      - SectionOffset:   26
+; MERGE-NEXT:      - SectionOffset:   28
 ; MERGE-NEXT:        InitFlags:       0
 ; MERGE-NEXT:        Offset:
 ; MERGE:             Content:         68656C6C6F00676F6F6462796500776861746576657200002A000000
@@ -41,27 +41,27 @@
 ; SEPARATE-NOT:                  DATACOUNT
 ; SEPARATE-LABEL: - Type:            DATA
 ; SEPARATE-NEXT:    Segments:
-; SEPARATE-NEXT:      - SectionOffset:   7
+; SEPARATE-NEXT:      - SectionOffset:   8
 ; SEPARATE-NEXT:        InitFlags:       0
 ; SEPARATE-NEXT:        Offset:
 ; SEPARATE:             Content:         636F6E7374616E7400
-; SEPARATE-NEXT:      - SectionOffset:   22
+; SEPARATE-NEXT: - SectionOffset: 24
 ; SEPARATE-NEXT:        InitFlags:       0
 ; SEPARATE-NEXT:        Offset:
 ; SEPARATE:             Content:         2B
-; SEPARATE-NEXT:      - SectionOffset:   29
+; SEPARATE-NEXT:      - SectionOffset:   32
 ; SEPARATE-NEXT:        InitFlags:       0
 ; SEPARATE-NEXT:        Offset:
 ; SEPARATE:             Content:         68656C6C6F00
-; SEPARATE-NEXT:      - SectionOffset:   41
+; SEPARATE-NEXT:      - SectionOffset:   45
 ; SEPARATE-NEXT:        InitFlags:       0
 ; SEPARATE-NEXT:        Offset:
 ; SEPARATE:             Content:         676F6F6462796500
-; SEPARATE-NEXT:      - SectionOffset:   55
+; SEPARATE-NEXT:      - SectionOffset:   60
 ; SEPARATE-NEXT:        InitFlags:       0
 ; SEPARATE-NEXT:        Offset:
 ; SEPARATE:             Content:         '776861746576657200'
-; SEPARATE-NEXT:      - SectionOffset:   70
+; SEPARATE-NEXT:      - SectionOffset:   76
 ; SEPARATE-NEXT:        InitFlags:       0
 ; SEPARATE-NEXT:        Offset:
 ; SEPARATE:             Content:         2A000000
diff --git a/lld/test/wasm/data-segments.ll b/lld/test/wasm/data-segments.ll
index 6c401c4873910..237f4285e3763 100644
--- a/lld/test/wasm/data-segments.ll
+++ b/lld/test/wasm/data-segments.ll
@@ -61,20 +61,20 @@
 ; ACTIVE-NEXT:        Body:            0B
 ; ACTIVE-NEXT:  - Type:            DATA
 ; ACTIVE-NEXT:    Segments:
-; ACTIVE-NEXT:      - SectionOffset:   7
+; ACTIVE-NEXT:      - SectionOffset:   8
 ; ACTIVE-NEXT:        InitFlags:       0
 ; ACTIVE-NEXT:        Offset:
 ; ACTIVE32-NEXT:        Opcode:          I32_CONST
 ; ACTIVE64-NEXT:        Opcode:          I64_CONST
-; ACTIVE-NEXT:          Value:           1024
+; ACTIVE-NEXT:          Value:           65536
 ; ACTIVE-NEXT:        Content:         636F6E7374616E74000000002B
-; ACTIVE-NEXT:      - SectionOffset:   26
+; ACTIVE-NEXT:      - SectionOffset:   28
 ; ACTIVE-NEXT:        InitFlags:       0
 ; ACTIVE-NEXT:        Offset:
 ; ACTIVE32-NEXT:        Opcode:          I32_CONST
 ; ACTIVE64-NEXT:        Opcode:          I64_CONST
-; ACTIVE-NEXT:          Value:           1040
-; ACTIVE-NEXT:        Content:         68656C6C6F00676F6F646279650000002A000000
+; ACTIVE-NEXT:          Value:           65552
+; ACTIVE-NEXT:        Content:         68656C6C6F00676F6F646279650000002A00000063000000
 ; ACTIVE-NEXT:  - Type:            CUSTOM
 ; ACTIVE-NEXT:    Name:            name
 ; ACTIVE-NEXT:    FunctionNames:
@@ -201,7 +201,7 @@
 ; DIS-NEXT:           block
 ; DIS-NEXT:            block
 
-; NOPIC-DIS-NEXT:       [[PTR]].const   11064
+; NOPIC-DIS-NEXT:       [[PTR]].const   75576
 ; PIC-DIS-NEXT:         local.get       0
 
 ; DIS-NEXT:             i32.const       0
@@ -211,8 +211,8 @@
 ; DIS-NEXT:                                            # 2:     down to label0
 ; DIS-NEXT:            end
 
-; NOPIC-DIS-NEXT:      [[PTR]].const   1024
-; NOPIC-DIS-NEXT:      [[PTR]].const   1024
+; NOPIC-DIS-NEXT:      [[PTR]].const   65536
+; NOPIC-DIS-NEXT:      [[PTR]].const   65536
 ; NOPIC-DIS-NEXT:      global.set      1
 ; PIC-DIS-NEXT:        [[PTR]].const   0
 ; PIC-DIS-NEXT:        global.get      1
@@ -224,7 +224,7 @@
 ; DIS-NEXT:            i32.const       4
 ; DIS-NEXT:            memory.init  0, 0
 
-; NOPIC-DIS-NEXT:      [[PTR]].const   1028
+; NOPIC-DIS-NEXT:      [[PTR]].const   65540
 ; PIC-DIS-NEXT:        [[PTR]].const   4
 ; PIC-DIS-NEXT:        global.get      1
 ; PIC-DIS-NEXT:        [[PTR]].add
@@ -233,7 +233,7 @@
 ; DIS-NEXT:            i32.const       13
 ; DIS-NEXT:            memory.init     1, 0
 
-; NOPIC-DIS-NEXT:      [[PTR]].const   1044
+; NOPIC-DIS-NEXT:      [[PTR]].const   65556
 ; PIC-DIS-NEXT:        [[PTR]].const   20
 ; PIC-DIS-NEXT:        global.get      1
 ; PIC-DIS-NEXT:        [[PTR]].add
@@ -241,7 +241,7 @@
 ; DIS-NEXT:            i32.const       0
 ; DIS-NEXT:            i32.const       20
 ; DIS-NEXT:            memory.init     2, 0
-; NOPIC-DIS-NEXT:      [[PTR]].const   1064
+; NOPIC-DIS-NEXT:      [[PTR]].const   65576
 ; PIC-DIS-NEXT:        [[PTR]].const   40
 ; PIC-DIS-NEXT:        global.get      1
 ; PIC-DIS-NEXT:        [[PTR]].add
@@ -249,13 +249,13 @@
 ; DIS-NEXT:            [[PTR]].const   10000
 ; DIS-NEXT:            memory.fill     0
 
-; NOPIC-DIS-NEXT:      [[PTR]].const   11064
+; NOPIC-DIS-NEXT:      [[PTR]].const   75576
 ; PIC-DIS-NEXT:        local.get       0
 
 ; DIS-NEXT:            i32.const       2
 ; DIS-NEXT:            i32.atomic.store        0
 
-; NOPIC-DIS-NEXT:      [[PTR]].const   11064
+; NOPIC-DIS-NEXT:      [[PTR]].const   75576
 ; PIC-DIS-NEXT:        local.get       0
 
 ; DIS-NEXT:            i32.const       -1
@@ -264,7 +264,7 @@
 ; DIS-NEXT:            br              1               # 1:     down to label1
 ; DIS-NEXT:           end
 
-; NOPIC-DIS-NEXT:     [[PTR]].const   11064
+; NOPIC-DIS-NEXT:     [[PTR]].const   75576
 ; PIC-DIS-NEXT:       local.get       0
 
...
[truncated]

@sbc100 sbc100 force-pushed the stack_first_default branch 2 times, most recently from b754215 to 8b893cc Compare November 8, 2025 00:17
@sbc100 sbc100 force-pushed the stack_first_default branch from 8b893cc to c99bf02 Compare November 8, 2025 00:19
@sbc100 sbc100 enabled auto-merge (squash) November 8, 2025 00:20
@sbc100 sbc100 merged commit 6c84dd7 into llvm:main Nov 8, 2025
9 of 10 checks passed
@sbc100 sbc100 deleted the stack_first_default branch November 8, 2025 00:27
vinay-deshmukh pushed a commit to vinay-deshmukh/llvm-project that referenced this pull request Nov 8, 2025
The really painful part of this PR was updating all the test files. I
had some help from Gemini GLI there
which did a pretty good job (got maybe 80% of the updates done).

Fixes: llvm#151015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[lld][WebAssembly] --stack-first should be the default for wasm-ld

3 participants