[lld] [lld][Webassembly] Avoid a signed overflow on large sections (PR #178287)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 27 13:47:58 PST 2026


================
@@ -0,0 +1,34 @@
+# RUN: split-file %s %t
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %t/chunk1.s -o %t/chunk1.o
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %t/chunk2.s -o %t/chunk2.o
+# --no-gc-sections to prevent the linker from optimizing the chunk away, otherwise it produces a tiny output
+# RUN: wasm-ld --no-entry --no-gc-sections %t/chunk1.o %t/chunk2.o -o %t/combined.wasm
+# RUN: llvm-readobj --sections %t/combined.wasm | FileCheck %s
+
+# Just making sure the linker doesn't crash for now and it has the combined, gigantic section, may need a better check
+# CHECK: Size: 2348810260
----------------
sbc100 wrote:

Doesn't the offset (not just the size) need to be huge?  i.e. do you need to another data segment that follows the huge one?

https://github.com/llvm/llvm-project/pull/178287


More information about the llvm-commits mailing list