Explorar o código

* 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 hai 1 ano
pai
achega
7e938ffafc
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      compiler/ogwasm.pas

+ 6 - 1
compiler/ogwasm.pas

@@ -5099,12 +5099,17 @@ implementation
         ExeSec: TExeSection;
         i: Integer;
         objsec: TObjSection;
+        firstdatasec: string;
       begin
         { WebAssembly is a Harvard architecture.
           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 ts_wasm_threads in current_settings.targetswitches then
+          firstdatasec:='.tbss'
+        else
+          firstdatasec:='.rodata';
+        if aname=firstdatasec then
           begin
             CurrMemPos:=1024;
             inherited;