From 5eb5fdabadb5d025613443b09f4b5cafab1cdf9d Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Mon, 1 Jan 2024 22:38:03 +0200 Subject: [PATCH] * start the data at offset 1024 instead of 0, just like the LLVM linker --- compiler/ogwasm.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/ogwasm.pas b/compiler/ogwasm.pas index 439db51e8d..b66260b437 100644 --- a/compiler/ogwasm.pas +++ b/compiler/ogwasm.pas @@ -4681,9 +4681,11 @@ implementation procedure TWasmExeOutput.MemPos_ExeSection(const aname: string); begin { WebAssembly is a Harvard architecture. - Data lives in a separate address space, so start addressing back from 0. } + Data lives in a separate address space, so start addressing back from 0 + (the LLVM leaves the first 1024 bytes in the data segment empty, so we + start at 1024). } if aname='.rodata' then - CurrMemPos:=0; + CurrMemPos:=1024; inherited MemPos_ExeSection(aname); end;