* Added virtual function TObjSection.GetAltName to be able to specify additional section name by descendants.

* OMF: Use the name of the first global symbol as an addition section name. This name is visible in the linker map file and helps tracking of section references.

git-svn-id: trunk@46298 -
This commit is contained in:
yury 2020-08-06 20:21:13 +00:00
parent fcf085b141
commit 985220d94c
2 changed files with 31 additions and 3 deletions

View File

@ -309,6 +309,8 @@ interface
FSizeLimit : TObjSectionOfs;
procedure SetSecOptions(Aoptions:TObjSectionOptions);
procedure SectionTooLargeError;
protected
function GetAltName: string; virtual;
public
ObjData : TObjData;
index : longword; { index of section in section headers }
@ -1013,6 +1015,12 @@ implementation
end;
function TObjSection.GetAltName: string;
begin
result:='';
end;
function TObjSection.write(const d;l:TObjSectionOfs):TObjSectionOfs;
begin
result:=size;
@ -1152,13 +1160,20 @@ implementation
function TObjSection.FullName:string;
var
s: string;
begin
if not assigned(FCachedFullName) then
begin
if assigned(ObjData) then
FCachedFullName:=stringdup(ObjData.Name+'('+Name+')')
s:=GetAltName;
if s<>'' then
s:=Name+s
else
FCachedFullName:=stringdup(Name);
s:=Name;
if assigned(ObjData) then
FCachedFullName:=stringdup(ObjData.Name+'('+s+')')
else
FCachedFullName:=stringdup(s);
end;
result:=FCachedFullName^;
end;

View File

@ -74,6 +74,7 @@ interface
private
FClassName: string;
FOverlayName: string;
FFirstSym: TObjSymbol;
FCombination: TOmfSegmentCombination;
FUse: TOmfSegmentUse;
FPrimaryGroup: TObjSectionGroup;
@ -81,6 +82,8 @@ interface
FMZExeUnifiedLogicalSegment: TMZExeUnifiedLogicalSegment;
FLinNumEntries: TOmfSubRecord_LINNUM_MsLink_LineNumberList;
function GetOmfAlignment: TOmfSegmentAlignment;
protected
function GetAltName: string; override;
public
constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:longint;Aoptions:TObjSectionOptions);override;
destructor destroy;override;
@ -1006,6 +1009,14 @@ implementation
end;
end;
function TOmfObjSection.GetAltName: string;
begin
if FFirstSym<>nil then
result:='/'+FFirstSym.Name
else
result:='';
end;
constructor TOmfObjSection.create(AList: TFPHashObjectList;
const Aname: string; Aalign: longint; Aoptions: TObjSectionOptions);
begin
@ -1983,6 +1994,8 @@ implementation
objsym.objsection:=objsec;
objsym.offset:=PubDefElem.PublicOffset;
objsym.size:=0;
if (objsym.bind=AB_GLOBAL) and (objsec.FFirstSym=nil) then
objsec.FFirstSym:=objsym;
end;
PubDefRec.Free;
Result:=True;