mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 05:49:12 +02:00
+ write the non-external functions to the symbol table as well
This commit is contained in:
parent
2805e44ccb
commit
ad8ed4b48d
@ -44,6 +44,7 @@ interface
|
||||
|
||||
TWasmObjSymbol = class(TObjSymbol)
|
||||
ImportIndex: Integer;
|
||||
FuncIndex: Integer;
|
||||
constructor create(AList:TFPHashObjectList;const AName:string);
|
||||
end;
|
||||
|
||||
@ -148,6 +149,7 @@ implementation
|
||||
begin
|
||||
inherited create(AList,AName);
|
||||
ImportIndex:=-1;
|
||||
FuncIndex:=-1;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
@ -668,7 +670,7 @@ implementation
|
||||
segment_count: Integer = 0;
|
||||
cur_seg_ofs: qword = 0;
|
||||
types_count,
|
||||
imports_count, NextImportFunctionIndex: Integer;
|
||||
imports_count, NextImportFunctionIndex, NextFunctionIndex: Integer;
|
||||
import_functions_count: Integer = 0;
|
||||
functions_count: Integer = 0;
|
||||
objsym: TWasmObjSymbol;
|
||||
@ -779,11 +781,14 @@ implementation
|
||||
|
||||
WriteUleb(FWasmSections[wsiFunction],functions_count);
|
||||
WriteUleb(FWasmSections[wsiCode],functions_count);
|
||||
NextFunctionIndex:=NextImportFunctionIndex;
|
||||
for i:=0 to Data.ObjSymbolList.Count-1 do
|
||||
begin
|
||||
objsym:=TWasmObjSymbol(Data.ObjSymbolList[i]);
|
||||
if objsym.typ=AT_FUNCTION then
|
||||
begin
|
||||
objsym.FuncIndex:=NextFunctionIndex;
|
||||
Inc(NextFunctionIndex);
|
||||
WriteUleb(FWasmSections[wsiFunction],TWasmObjSymbolExtraData(FData.FObjSymbolsExtraDataList.Find(objsym.Name)).TypeIdx);
|
||||
WriteFunctionCode(FWasmSections[wsiCode],objsym);
|
||||
end;
|
||||
@ -801,6 +806,11 @@ implementation
|
||||
end
|
||||
else if objsym.typ=AT_FUNCTION then
|
||||
begin
|
||||
Inc(FWasmSymbolTableEntriesCount);
|
||||
WriteByte(FWasmSymbolTable,Ord(SYMTAB_FUNCTION));
|
||||
WriteUleb(FWasmSymbolTable,0);
|
||||
WriteUleb(FWasmSymbolTable,objsym.FuncIndex);
|
||||
WriteName(FWasmSymbolTable,objsym.Name);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user