|
@@ -57,6 +57,9 @@ interface
|
|
|
{ TWasmObjRelocation }
|
|
|
|
|
|
TWasmObjRelocation = class(TObjRelocation)
|
|
|
+ public
|
|
|
+ TypeIndex: Integer;
|
|
|
+ constructor CreateTypeIndex(ADataOffset:TObjSectionOfs; ATypeIndex: Integer);
|
|
|
end;
|
|
|
|
|
|
{ TWasmObjSymbolExtraData }
|
|
@@ -273,6 +276,21 @@ implementation
|
|
|
WriteUleb5(d,q);
|
|
|
end;
|
|
|
|
|
|
+{****************************************************************************
|
|
|
+ TWasmObjRelocation
|
|
|
+****************************************************************************}
|
|
|
+
|
|
|
+ constructor TWasmObjRelocation.CreateTypeIndex(ADataOffset: TObjSectionOfs; ATypeIndex: Integer);
|
|
|
+ begin
|
|
|
+ DataOffset:=ADataOffset;
|
|
|
+ Symbol:=nil;
|
|
|
+ OrgSize:=0;
|
|
|
+ Group:=nil;
|
|
|
+ ObjSection:=nil;
|
|
|
+ ftype:=ord(RELOC_TYPE_INDEX_LEB);
|
|
|
+ TypeIndex:=ATypeIndex;
|
|
|
+ end;
|
|
|
+
|
|
|
{****************************************************************************
|
|
|
TWasmObjSymbol
|
|
|
****************************************************************************}
|
|
@@ -558,6 +576,16 @@ implementation
|
|
|
Data:=NtoLE(Data);
|
|
|
writebytes(Data,4);
|
|
|
end;
|
|
|
+ RELOC_TYPE_INDEX_LEB:
|
|
|
+ begin
|
|
|
+ if len<>5 then
|
|
|
+ internalerror(2021092612);
|
|
|
+ if assigned(p) then
|
|
|
+ internalerror(2021092613);
|
|
|
+ objreloc:=TWasmObjRelocation.CreateTypeIndex(CurrObjSec.Size,Data);
|
|
|
+ CurrObjSec.ObjRelocations.Add(objreloc);
|
|
|
+ WriteUleb5(CurrObjSec,Data);
|
|
|
+ end;
|
|
|
else
|
|
|
internalerror(2021092501);
|
|
|
end;
|
|
@@ -903,6 +931,8 @@ implementation
|
|
|
end;
|
|
|
RELOC_ABSOLUTE:
|
|
|
;
|
|
|
+ RELOC_TYPE_INDEX_LEB:
|
|
|
+ ;
|
|
|
else
|
|
|
internalerror(2021092510);
|
|
|
end;
|
|
@@ -978,6 +1008,13 @@ implementation
|
|
|
else
|
|
|
internalerror(2021092609);
|
|
|
end;
|
|
|
+ RELOC_TYPE_INDEX_LEB:
|
|
|
+ begin
|
|
|
+ Inc(relcount^);
|
|
|
+ WriteByte(relout,Ord(R_WASM_TYPE_INDEX_LEB));
|
|
|
+ WriteUleb(relout,objrel.DataOffset+objsec.FileSectionOfs);
|
|
|
+ WriteUleb(relout,objrel.TypeIndex);
|
|
|
+ end;
|
|
|
else
|
|
|
internalerror(2021092507);
|
|
|
end;
|