Browse Source

* start the data at offset 1024 instead of 0, just like the LLVM linker

Nikolay Nikolov 1 year ago
parent
commit
5eb5fdabad
1 changed files with 4 additions and 2 deletions
  1. 4 2
      compiler/ogwasm.pas

+ 4 - 2
compiler/ogwasm.pas

@@ -4681,9 +4681,11 @@ implementation
     procedure TWasmExeOutput.MemPos_ExeSection(const aname: string);
     procedure TWasmExeOutput.MemPos_ExeSection(const aname: string);
       begin
       begin
         { WebAssembly is a Harvard architecture.
         { 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
         if aname='.rodata' then
-          CurrMemPos:=0;
+          CurrMemPos:=1024;
         inherited MemPos_ExeSection(aname);
         inherited MemPos_ExeSection(aname);
       end;
       end;