|
@@ -76,7 +76,14 @@ interface
|
|
public
|
|
public
|
|
TypeIndex: Integer;
|
|
TypeIndex: Integer;
|
|
Addend: LongInt;
|
|
Addend: LongInt;
|
|
|
|
+
|
|
|
|
+ { used during linking }
|
|
|
|
+ FuncType: TWasmFuncType;
|
|
|
|
+ ExeTypeIndex: Integer;
|
|
|
|
+
|
|
constructor CreateTypeIndex(ADataOffset:TObjSectionOfs; ATypeIndex: Integer);
|
|
constructor CreateTypeIndex(ADataOffset:TObjSectionOfs; ATypeIndex: Integer);
|
|
|
|
+ constructor CreateFuncType(ADataOffset:TObjSectionOfs; AFuncType: TWasmFuncType);
|
|
|
|
+ destructor Destroy;override;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TWasmObjSymbolExtraData }
|
|
{ TWasmObjSymbolExtraData }
|
|
@@ -518,6 +525,27 @@ implementation
|
|
ObjSection:=nil;
|
|
ObjSection:=nil;
|
|
ftype:=ord(RELOC_TYPE_INDEX_LEB);
|
|
ftype:=ord(RELOC_TYPE_INDEX_LEB);
|
|
TypeIndex:=ATypeIndex;
|
|
TypeIndex:=ATypeIndex;
|
|
|
|
+ FuncType:=nil;
|
|
|
|
+ ExeTypeIndex:=-1;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ constructor TWasmObjRelocation.CreateFuncType(ADataOffset: TObjSectionOfs; AFuncType: TWasmFuncType);
|
|
|
|
+ begin
|
|
|
|
+ DataOffset:=ADataOffset;
|
|
|
|
+ Symbol:=nil;
|
|
|
|
+ OrgSize:=0;
|
|
|
|
+ Group:=nil;
|
|
|
|
+ ObjSection:=nil;
|
|
|
|
+ ftype:=ord(RELOC_TYPE_INDEX_LEB);
|
|
|
|
+ TypeIndex:=-1;
|
|
|
|
+ ExeTypeIndex:=-1;
|
|
|
|
+ FuncType:=TWasmFuncType.Create(AFuncType);
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ destructor TWasmObjRelocation.Destroy;
|
|
|
|
+ begin
|
|
|
|
+ FuncType.Free;
|
|
|
|
+ inherited Destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
{****************************************************************************
|
|
{****************************************************************************
|
|
@@ -4017,7 +4045,7 @@ implementation
|
|
InputError('Type index in relocation too high');
|
|
InputError('Type index in relocation too high');
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
- ObjSec.ObjRelocations.Add(TWasmObjRelocation.CreateTypeIndex(RelocOffset-BaseSectionOffset,RelocIndex));
|
|
|
|
|
|
+ ObjSec.ObjRelocations.Add(TWasmObjRelocation.CreateFuncType(RelocOffset-BaseSectionOffset,FFuncTypes[RelocIndex]));
|
|
end;
|
|
end;
|
|
R_WASM_FUNCTION_OFFSET_I32:
|
|
R_WASM_FUNCTION_OFFSET_I32:
|
|
begin
|
|
begin
|
|
@@ -4157,6 +4185,12 @@ implementation
|
|
Writeln('Symbol relocation not yet implemented! ', objreloc.typ);
|
|
Writeln('Symbol relocation not yet implemented! ', objreloc.typ);
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
|
|
+ else if objreloc.typ=RELOC_TYPE_INDEX_LEB then
|
|
|
|
+ begin
|
|
|
|
+ objreloc.ExeTypeIndex:=FFuncTypes.AddOrGetFuncType(objreloc.FuncType);
|
|
|
|
+ objsec.Data.seek(objreloc.DataOffset);
|
|
|
|
+ WriteUleb5(objsec.Data,objreloc.ExeTypeIndex);
|
|
|
|
+ end
|
|
else
|
|
else
|
|
Writeln('Non-symbol relocation not yet implemented! ', objreloc.typ);
|
|
Writeln('Non-symbol relocation not yet implemented! ', objreloc.typ);
|
|
end;
|
|
end;
|