Browse Source

+ implemented R_WASM_MEMORY_ADDR_I32 relocations in the wasm internal linker

Nikolay Nikolov 1 year ago
parent
commit
1b2d29ea1a
1 changed files with 16 additions and 0 deletions
  1. 16 0
      compiler/ogwasm.pas

+ 16 - 0
compiler/ogwasm.pas

@@ -4235,6 +4235,22 @@ implementation
                       objsec.Data.seek(objreloc.DataOffset);
                       objsec.Data.seek(objreloc.DataOffset);
                       WriteUleb5(objsec.Data,objsym.LinkingData.ExeFunctionIndex);
                       WriteUleb5(objsec.Data,objsym.LinkingData.ExeFunctionIndex);
                     end;
                     end;
+                  RELOC_ABSOLUTE:
+                    begin
+                      case objsym.typ of
+                        AT_FUNCTION:
+                          begin
+                            Writeln('TODO: function table index');
+                          end;
+                        AT_DATA:
+                          begin
+                            objsec.Data.seek(objreloc.DataOffset);
+                            objsec.writeUInt32LE(UInt32((objsym.offset+objsym.objsection.MemPos)+objreloc.Addend));
+                          end;
+                        else
+                          internalerror(2024010108);
+                      end;
+                    end;
                   else
                   else
                     Writeln('Symbol relocation not yet implemented! ', objreloc.typ);
                     Writeln('Symbol relocation not yet implemented! ', objreloc.typ);
                 end;
                 end;