From ff8e0ed9308c45d23572f0726abf652b295de56b Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 4 Jan 2023 11:28:55 -0800 Subject: [PATCH] [lld][WebAssembly] Fix memory.fill argument in 64-bit mode This only effects folks building with wasm64 + shared memory which is not currently a supported configuration in emscripten or any other wasm toolchain. Differential Revision: https://reviews.llvm.org/D141005 --- lld/test/wasm/data-segments.ll | 2 +- lld/wasm/Writer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lld/test/wasm/data-segments.ll b/lld/test/wasm/data-segments.ll index cc97698..7ff9497 100644 --- a/lld/test/wasm/data-segments.ll +++ b/lld/test/wasm/data-segments.ll @@ -222,7 +222,7 @@ ; PIC-DIS-NEXT: global.get 1 ; PIC-DIS-NEXT: [[PTR]].add ; DIS-NEXT: i32.const 0 -; DIS-NEXT: i32.const 10000 +; DIS-NEXT: [[PTR]].const 10000 ; DIS-NEXT: memory.fill 0 ; NOPIC-DIS-NEXT: [[PTR]].const 11064 diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index 06bf458..3600503 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -1226,7 +1226,7 @@ void Writer::createInitMemoryFunction() { if (s->isBss) { writeI32Const(os, 0, "fill value"); - writeI32Const(os, s->size, "memory region size"); + writePtrConst(os, s->size, is64, "memory region size"); writeU8(os, WASM_OPCODE_MISC_PREFIX, "bulk-memory prefix"); writeUleb128(os, WASM_OPCODE_MEMORY_FILL, "memory.fill"); writeU8(os, 0, "memory index immediate"); -- 2.7.4