mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 13:11:06 +02:00
+ wasm internal object reader: support relocations for debug sections
This commit is contained in:
parent
dfdc4a4d78
commit
39c3d5d035
@ -2453,7 +2453,7 @@ implementation
|
|||||||
{ meaning of first index: }
|
{ meaning of first index: }
|
||||||
{ table 0 is code relocs }
|
{ table 0 is code relocs }
|
||||||
{ table 1 is data relocs }
|
{ table 1 is data relocs }
|
||||||
{ tables 2.. are custom section relocs }
|
{ tables 2.. are custom section relocs for debug sections }
|
||||||
RelocationTable: array of array of record
|
RelocationTable: array of array of record
|
||||||
RelocType: Byte;
|
RelocType: Byte;
|
||||||
RelocOffset: uint32;
|
RelocOffset: uint32;
|
||||||
@ -2579,6 +2579,7 @@ implementation
|
|||||||
TargetSection, RelocCount: uint32;
|
TargetSection, RelocCount: uint32;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
RelocTableIndex: Integer;
|
RelocTableIndex: Integer;
|
||||||
|
ds: TWasmCustomDebugSectionType;
|
||||||
begin
|
begin
|
||||||
Result:=False;
|
Result:=False;
|
||||||
if not ReadUleb32(TargetSection) then
|
if not ReadUleb32(TargetSection) then
|
||||||
@ -2592,10 +2593,18 @@ implementation
|
|||||||
RelocTableIndex:=1
|
RelocTableIndex:=1
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Writeln('Warning! Relocation section ignored!');
|
RelocTableIndex:=-1;
|
||||||
Result:=True;
|
for ds:=Low(DebugSectionIndex) to High(DebugSectionIndex) do
|
||||||
//InputError('Relocation for custom sections not supported, yet');
|
if DebugSectionIndex[ds]=TargetSection then
|
||||||
exit;
|
begin
|
||||||
|
RelocTableIndex:=2+(Ord(ds)-Ord(Low(TWasmCustomDebugSectionType)));
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
if RelocTableIndex=-1 then
|
||||||
|
begin
|
||||||
|
InputError('Relocation found for a custom section, that is not supported');
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if not ReadUleb32(RelocCount) then
|
if not ReadUleb32(RelocCount) then
|
||||||
begin
|
begin
|
||||||
@ -3942,7 +3951,7 @@ implementation
|
|||||||
DataSegments:=nil;
|
DataSegments:=nil;
|
||||||
SymbolTable:=nil;
|
SymbolTable:=nil;
|
||||||
RelocationTable:=nil;
|
RelocationTable:=nil;
|
||||||
SetLength(RelocationTable,2);
|
SetLength(RelocationTable,2+(Ord(High(TWasmCustomDebugSectionType))-Ord(Low(TWasmCustomDebugSectionType))+1));
|
||||||
FuncTypes:=nil;
|
FuncTypes:=nil;
|
||||||
FuncTypeImportsCount:=0;
|
FuncTypeImportsCount:=0;
|
||||||
TableTypes:=nil;
|
TableTypes:=nil;
|
||||||
@ -4179,7 +4188,12 @@ implementation
|
|||||||
end;
|
end;
|
||||||
BaseSectionOffset:=DataSegments[SegI].DataSectionOffset;
|
BaseSectionOffset:=DataSegments[SegI].DataSectionOffset;
|
||||||
ObjSec:=TObjSection(ObjData.ObjSectionList[FirstDataSegmentIdx+SegI]);
|
ObjSec:=TObjSection(ObjData.ObjSectionList[FirstDataSegmentIdx+SegI]);
|
||||||
end
|
end;
|
||||||
|
2..2+(Ord(High(TWasmCustomDebugSectionType))-Ord(Low(TWasmCustomDebugSectionType))):
|
||||||
|
begin
|
||||||
|
BaseSectionOffset:=0;
|
||||||
|
ObjSec:=ObjData.findsection(WasmCustomSectionName[TWasmCustomSectionType((j-2)+Ord(Low(TWasmCustomDebugSectionType)))]);
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
internalerror(2023122801);
|
internalerror(2023122801);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user