mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 12:20:19 +02:00
+ assign ordinals to all exported symbols
git-svn-id: trunk@42625 -
This commit is contained in:
parent
831014cb12
commit
3da4cf0792
@ -644,6 +644,8 @@ interface
|
|||||||
procedure AddNewExeSection;
|
procedure AddNewExeSection;
|
||||||
function WriteNewExe:boolean;
|
function WriteNewExe:boolean;
|
||||||
procedure FillImportedNameAndModuleReferenceTable;
|
procedure FillImportedNameAndModuleReferenceTable;
|
||||||
|
function GetHighestExportSymbolOrdinal: Word;
|
||||||
|
procedure AssignOrdinalsToAllExportSymbols;
|
||||||
property Header: TNewExeHeader read FHeader;
|
property Header: TNewExeHeader read FHeader;
|
||||||
property CurrExeMetaSec: TNewExeMetaSection read FCurrExeMetaSec write FCurrExeMetaSec;
|
property CurrExeMetaSec: TNewExeMetaSection read FCurrExeMetaSec write FCurrExeMetaSec;
|
||||||
property ResourceTable: TNewExeResourceTable read FResourceTable;
|
property ResourceTable: TNewExeResourceTable read FResourceTable;
|
||||||
@ -4110,6 +4112,9 @@ cleanup:
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
{ all exported symbols must have an ordinal }
|
||||||
|
AssignOrdinalsToAllExportSymbols;
|
||||||
|
|
||||||
{ the first entry in the resident-name table is the module name }
|
{ the first entry in the resident-name table is the module name }
|
||||||
TNewExeResidentNameTableEntry.Create(ResidentNameTable,ExtractModuleName(current_module.exefilename),0);
|
TNewExeResidentNameTableEntry.Create(ResidentNameTable,ExtractModuleName(current_module.exefilename),0);
|
||||||
|
|
||||||
@ -4184,6 +4189,51 @@ cleanup:
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TNewExeOutput.GetHighestExportSymbolOrdinal: Word;
|
||||||
|
var
|
||||||
|
i, j: Integer;
|
||||||
|
ObjData: TOmfObjData;
|
||||||
|
sym: TOmfObjExportedSymbol;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
for i:=0 to ObjDataList.Count-1 do
|
||||||
|
begin
|
||||||
|
ObjData:=TOmfObjData(ObjDataList[i]);
|
||||||
|
for j:=0 to ObjData.ExportedSymbolList.Count-1 do
|
||||||
|
begin
|
||||||
|
sym:=TOmfObjExportedSymbol(ObjData.ExportedSymbolList[j]);
|
||||||
|
if sym.ExportByOrdinal then
|
||||||
|
Result:=Max(Result,sym.ExportOrdinal);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TNewExeOutput.AssignOrdinalsToAllExportSymbols;
|
||||||
|
var
|
||||||
|
NextOrdinal: LongInt;
|
||||||
|
i, j: Integer;
|
||||||
|
ObjData: TOmfObjData;
|
||||||
|
sym: TOmfObjExportedSymbol;
|
||||||
|
begin
|
||||||
|
NextOrdinal:=GetHighestExportSymbolOrdinal+1;
|
||||||
|
for i:=0 to ObjDataList.Count-1 do
|
||||||
|
begin
|
||||||
|
ObjData:=TOmfObjData(ObjDataList[i]);
|
||||||
|
for j:=0 to ObjData.ExportedSymbolList.Count-1 do
|
||||||
|
begin
|
||||||
|
sym:=TOmfObjExportedSymbol(ObjData.ExportedSymbolList[j]);
|
||||||
|
if not sym.ExportByOrdinal then
|
||||||
|
begin
|
||||||
|
if NextOrdinal>High(Word) then
|
||||||
|
internalerror(2019081001);
|
||||||
|
sym.ExportByOrdinal:=True;
|
||||||
|
sym.ExportOrdinal:=NextOrdinal;
|
||||||
|
Inc(NextOrdinal);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TNewExeOutput.DoRelocationFixup(objsec: TObjSection);
|
procedure TNewExeOutput.DoRelocationFixup(objsec: TObjSection);
|
||||||
begin
|
begin
|
||||||
{todo}
|
{todo}
|
||||||
|
Loading…
Reference in New Issue
Block a user