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

View File

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