Browse Source

* WebAssembly threads internal linker: ignore RELOC_GLOBAL_INDEX_LEB
relocations, pointing to AT_TLS entries, because the actual relocation is done
by another relocation, overlaid on top of this one, pointing to a WebAssembly
global. The reason we use two relocations, is to cause the smartlinker to keep
both the AT_TLS symbol, thus reserving data space in linear memory for the
threadvar, as well as the WebAssembly global variable, used for holding the
address of the threadvar.

Nikolay Nikolov 1 year ago
parent
commit
df4ef39762
1 changed files with 3 additions and 3 deletions
  1. 3 3
      compiler/ogwasm.pas

+ 3 - 3
compiler/ogwasm.pas

@@ -5015,9 +5015,9 @@ implementation
                     else if (ts_wasm_threads in current_settings.targetswitches) and
                     else if (ts_wasm_threads in current_settings.targetswitches) and
                             (objsym.typ=AT_TLS) then
                             (objsym.typ=AT_TLS) then
                       begin
                       begin
-                        Writeln('TODO! threadvar relocation: ', objsym.typ, ' ', objsym.objsection.MemPos, ' ', objsym.Name, ' ', objsym.objsection.Name);
-                        objsec.Data.seek(objreloc.DataOffset);
-                        WriteUleb5(objsec.Data,UInt32(objsym.offset+objsym.objsection.MemPos));
+                        { Nothing to do here. A second RELOC_GLOBAL_INDEX_LEB
+                          relocation, overlaid on top of this one, pointing to
+                          an AT_WASM_GLOBAL should have already done the job. }
                       end
                       end
                     else
                     else
                       internalerror(2024010111);
                       internalerror(2024010111);