浏览代码

* WebAssembly threads internal linker: set MemPos for data sections correctly
when threads are enabled (take into account that the first data section with
threads enabled is .tbss, instead of .rodata)

Nikolay Nikolov 1 年之前
父节点
当前提交
7e938ffafc
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      compiler/ogwasm.pas

+ 6 - 1
compiler/ogwasm.pas

@@ -5099,12 +5099,17 @@ implementation
         ExeSec: TExeSection;
         ExeSec: TExeSection;
         i: Integer;
         i: Integer;
         objsec: TObjSection;
         objsec: TObjSection;
+        firstdatasec: 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
           (the LLVM leaves the first 1024 bytes in the data segment empty, so we
           start at 1024). }
           start at 1024). }
-        if aname='.rodata' then
+        if ts_wasm_threads in current_settings.targetswitches then
+          firstdatasec:='.tbss'
+        else
+          firstdatasec:='.rodata';
+        if aname=firstdatasec then
           begin
           begin
             CurrMemPos:=1024;
             CurrMemPos:=1024;
             inherited;
             inherited;