소스 검색

* an attempt to fix WebAssembly debug info section relocations

Nikolay Nikolov 3 년 전
부모
커밋
5604bd951e
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      compiler/ogwasm.pas

+ 6 - 3
compiler/ogwasm.pas

@@ -645,10 +645,13 @@ implementation
               if not assigned(p) then
                 internalerror(2021092608);
               if (p.objsection<>nil) and TWasmObjSection(p.objsection).IsDebug and
-                 (p.bind<>AB_COMMON) then
+                 (p.bind<>AB_COMMON) and (p.bind<>AB_EXTERNAL) then
                 begin
-                  CurrObjSec.addsectionreloc(CurrObjSec.mempos+CurrObjSec.Size,CurrObjSec,RELOC_ABSOLUTE);
-                  inc(data,p.address);
+                  objreloc:=TWasmObjRelocation.CreateSection(CurrObjSec.Size,p.objsection,RELOC_ABSOLUTE);
+                  objreloc.Addend:=Data+p.Address;
+                  CurrObjSec.ObjRelocations.Add(objreloc);
+                  {inc(data,p.address);}
+                  data:=0;
                   Data:=NtoLE(Data);
                   writebytes(Data,4);
                 end