mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 05:19:17 +02:00
* fix generation of addend for R_WASM_FUNCTION_OFFSET_I32 relocations. This
improves code address accuracy for WebAssembly debug line info information.
This commit is contained in:
parent
c8e4a52428
commit
d81170ab23
@ -131,6 +131,7 @@ interface
|
|||||||
SegSymIdx: Integer;
|
SegSymIdx: Integer;
|
||||||
SegOfs: qword;
|
SegOfs: qword;
|
||||||
FileSectionOfs: qword;
|
FileSectionOfs: qword;
|
||||||
|
EncodedLocalsSize: qword;
|
||||||
MainFuncSymbol: TWasmObjSymbol;
|
MainFuncSymbol: TWasmObjSymbol;
|
||||||
CustomSectionIdx: Integer;
|
CustomSectionIdx: Integer;
|
||||||
constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:longint;Aoptions:TObjSectionOptions);override;
|
constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:longint;Aoptions:TObjSectionOptions);override;
|
||||||
@ -1326,6 +1327,7 @@ implementation
|
|||||||
encoded_locals.seek(0);
|
encoded_locals.seek(0);
|
||||||
CopyDynamicArray(encoded_locals,dest,encoded_locals.size);
|
CopyDynamicArray(encoded_locals,dest,encoded_locals.size);
|
||||||
ObjSection.FileSectionOfs:=dest.size-objsym.offset;
|
ObjSection.FileSectionOfs:=dest.size-objsym.offset;
|
||||||
|
ObjSection.EncodedLocalsSize:=encoded_locals.size;
|
||||||
CopyDynamicArray(ObjSection.Data,dest,codeexprlen);
|
CopyDynamicArray(ObjSection.Data,dest,codeexprlen);
|
||||||
WriteByte(dest,$0B);
|
WriteByte(dest,$0B);
|
||||||
encoded_locals.Free;
|
encoded_locals.Free;
|
||||||
@ -1607,7 +1609,10 @@ implementation
|
|||||||
message1(asmw_e_illegal_unset_index,FuncSym.Name)
|
message1(asmw_e_illegal_unset_index,FuncSym.Name)
|
||||||
else
|
else
|
||||||
WriteUleb(relout,FuncSym.SymbolIndex);
|
WriteUleb(relout,FuncSym.SymbolIndex);
|
||||||
WriteSleb(relout,objrel.Addend+objrel.symbol.address); { addend to add to the address }
|
if (objrel.Addend+objrel.symbol.address)=0 then
|
||||||
|
WriteSleb(relout,objrel.Addend+objrel.symbol.address) { addend to add to the address }
|
||||||
|
else
|
||||||
|
WriteSleb(relout,objrel.Addend+objrel.symbol.address+TWasmObjSection(objrel.symbol.objsection).EncodedLocalsSize); { addend to add to the address }
|
||||||
end
|
end
|
||||||
else if assigned(objrel.symbol) and (objrel.symbol.typ=AT_WASM_GLOBAL) then
|
else if assigned(objrel.symbol) and (objrel.symbol.typ=AT_WASM_GLOBAL) then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user