|
@@ -48,7 +48,9 @@ interface
|
|
ImportModule: string;
|
|
ImportModule: string;
|
|
ImportName: string;
|
|
ImportName: string;
|
|
FuncType: TWasmFuncType;
|
|
FuncType: TWasmFuncType;
|
|
|
|
+ ExeFunctionIndex: Integer;
|
|
|
|
|
|
|
|
+ constructor Create;
|
|
destructor Destroy;override;
|
|
destructor Destroy;override;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -226,6 +228,13 @@ interface
|
|
private
|
|
private
|
|
FImports: TFPHashObjectList;
|
|
FImports: TFPHashObjectList;
|
|
FFuncTypes: TWasmFuncTypeTable;
|
|
FFuncTypes: TWasmFuncTypeTable;
|
|
|
|
+
|
|
|
|
+ FFunctionImports: array of record
|
|
|
|
+ ModName: ansistring;
|
|
|
|
+ Name: ansistring;
|
|
|
|
+ TypeIdx: uint32;
|
|
|
|
+ end;
|
|
|
|
+
|
|
protected
|
|
protected
|
|
function writeData:boolean;override;
|
|
function writeData:boolean;override;
|
|
procedure DoRelocationFixup(objsec:TObjSection);override;
|
|
procedure DoRelocationFixup(objsec:TObjSection);override;
|
|
@@ -403,6 +412,11 @@ implementation
|
|
TWasmObjSymbolLinkingData
|
|
TWasmObjSymbolLinkingData
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
|
|
+ constructor TWasmObjSymbolLinkingData.Create;
|
|
|
|
+ begin
|
|
|
|
+ ExeFunctionIndex:=-1;
|
|
|
|
+ end;
|
|
|
|
+
|
|
destructor TWasmObjSymbolLinkingData.Destroy;
|
|
destructor TWasmObjSymbolLinkingData.Destroy;
|
|
begin
|
|
begin
|
|
FuncType.Free;
|
|
FuncType.Free;
|
|
@@ -4083,6 +4097,21 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TWasmExeOutput.AfterUnusedSectionRemoval;
|
|
procedure TWasmExeOutput.AfterUnusedSectionRemoval;
|
|
|
|
+
|
|
|
|
+ function AddFunctionImport(const libname,symname:TCmdStr; functype: TWasmFuncType): Integer;
|
|
|
|
+ begin
|
|
|
|
+ if assigned(exemap) then
|
|
|
|
+ exemap.Add(' Importing Function ' + symname + functype.ToString);
|
|
|
|
+ SetLength(FFunctionImports,Length(FFunctionImports)+1);
|
|
|
|
+ Result:=High(FFunctionImports);
|
|
|
|
+ with FFunctionImports[Result] do
|
|
|
|
+ begin
|
|
|
|
+ ModName:=libname;
|
|
|
|
+ Name:=symname;
|
|
|
|
+ TypeIdx:=FFuncTypes.AddOrGetFuncType(functype);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+
|
|
var
|
|
var
|
|
i, j: Integer;
|
|
i, j: Integer;
|
|
ImportLibrary: TImportLibrary;
|
|
ImportLibrary: TImportLibrary;
|
|
@@ -4107,8 +4136,8 @@ implementation
|
|
exemap.Add('Importing from module '+ImportLibrary.Name);
|
|
exemap.Add('Importing from module '+ImportLibrary.Name);
|
|
end;
|
|
end;
|
|
newdll:=True;
|
|
newdll:=True;
|
|
- if assigned(exemap) then
|
|
|
|
- exemap.Add(' Importing Function ' + ImportSymbol.Name + TWasmObjSymbol(exesym.ObjSymbol).LinkingData.FuncType.ToString);
|
|
|
|
|
|
+ TWasmObjSymbol(exesym.ObjSymbol).LinkingData.ExeFunctionIndex:=
|
|
|
|
+ AddFunctionImport(ImportLibrary.Name,ImportSymbol.Name,TWasmObjSymbol(exesym.ObjSymbol).LinkingData.FuncType);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|