mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 21:59:47 +02:00
+ handle the call instruction in the wasm binary writer
This commit is contained in:
parent
ab0d7697c3
commit
3e2a9b6ceb
@ -112,6 +112,9 @@ interface
|
||||
RELOC_ABSOLUTE_HI8,
|
||||
RELOC_ABSOLUTE_LO8,
|
||||
{$endif z80}
|
||||
{$ifdef WASM32}
|
||||
RELOC_FUNCTION_INDEX_LEB,
|
||||
{$endif WASM32}
|
||||
{ Relative relocation }
|
||||
RELOC_RELATIVE,
|
||||
{ PECoff (Windows) RVA relocation }
|
||||
|
@ -585,6 +585,22 @@ implementation
|
||||
internalerror(2021092017);
|
||||
end;
|
||||
end;
|
||||
a_call:
|
||||
begin
|
||||
if ops<>1 then
|
||||
internalerror(2021092021);
|
||||
with oper[0]^ do
|
||||
case typ of
|
||||
top_ref:
|
||||
begin
|
||||
if not assigned(ref^.symbol) or (ref^.base<>NR_NO) or (ref^.index<>NR_NO) or (ref^.offset<>0) then
|
||||
internalerror(2021092023);
|
||||
result:=6;
|
||||
end;
|
||||
else
|
||||
internalerror(2021092022);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Writeln('Warning! Not implemented opcode, pass1: ', opcode);
|
||||
end;
|
||||
@ -1037,6 +1053,23 @@ implementation
|
||||
internalerror(2021092017);
|
||||
end;
|
||||
end;
|
||||
a_call:
|
||||
begin
|
||||
if ops<>1 then
|
||||
internalerror(2021092021);
|
||||
with oper[0]^ do
|
||||
case typ of
|
||||
top_ref:
|
||||
begin
|
||||
if not assigned(ref^.symbol) or (ref^.base<>NR_NO) or (ref^.index<>NR_NO) or (ref^.offset<>0) then
|
||||
internalerror(2021092023);
|
||||
WriteByte($10);
|
||||
objdata.writeReloc(0,5,ObjData.symbolref(ref^.symbol),RELOC_FUNCTION_INDEX_LEB);
|
||||
end;
|
||||
else
|
||||
internalerror(2021092022);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
Writeln('Warning! Not implemented opcode, pass2: ', opcode);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user