mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 15:39:40 +02:00
* Internal linker sorts only .idata section and removes stabs of unused functions. It seems all debug info problems with internal linker are solved now.
* Properly arrange arm-wince exception sections. git-svn-id: trunk@5249 -
This commit is contained in:
parent
8827d8d628
commit
4e3c5e202a
@ -453,7 +453,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils,
|
SysUtils,
|
||||||
globals,verbose,fmodule,ogmap;
|
globals,verbose,fmodule,ogmap,dbgstabs;
|
||||||
|
|
||||||
const
|
const
|
||||||
SectionDataMaxGrow = 4096;
|
SectionDataMaxGrow = 4096;
|
||||||
@ -1507,7 +1507,8 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ Sort list if needed }
|
{ Sort list if needed }
|
||||||
TmpObjSectionList.Sort(@ObjSectionNameCompare);
|
if CurrExeSec.Name='.idata' then
|
||||||
|
TmpObjSectionList.Sort(@ObjSectionNameCompare);
|
||||||
{ Add the (sorted) list to the current ExeSection }
|
{ Add the (sorted) list to the current ExeSection }
|
||||||
for i:=0 to TmpObjSectionList.Count-1 do
|
for i:=0 to TmpObjSectionList.Count-1 do
|
||||||
begin
|
begin
|
||||||
@ -2015,6 +2016,7 @@ implementation
|
|||||||
mergestabcnt,
|
mergestabcnt,
|
||||||
stabcnt : longint;
|
stabcnt : longint;
|
||||||
skipstab : boolean;
|
skipstab : boolean;
|
||||||
|
skipfun : boolean;
|
||||||
hstab : TObjStabEntry;
|
hstab : TObjStabEntry;
|
||||||
stabrelocofs : longint;
|
stabrelocofs : longint;
|
||||||
buf : array[0..1023] of byte;
|
buf : array[0..1023] of byte;
|
||||||
@ -2041,6 +2043,7 @@ implementation
|
|||||||
buf[0]:=0;
|
buf[0]:=0;
|
||||||
mergedstabstrsec.write(buf[0],1);
|
mergedstabstrsec.write(buf[0],1);
|
||||||
|
|
||||||
|
skipfun:=false;
|
||||||
{ Copy stabs and corresponding Relocations }
|
{ Copy stabs and corresponding Relocations }
|
||||||
for i:=0 to stabexesec.ObjSectionList.Count-1 do
|
for i:=0 to stabexesec.ObjSectionList.Count-1 do
|
||||||
begin
|
begin
|
||||||
@ -2059,6 +2062,11 @@ implementation
|
|||||||
{ Only include first hdrsym stab }
|
{ Only include first hdrsym stab }
|
||||||
if hstab.ntype=0 then
|
if hstab.ntype=0 then
|
||||||
skipstab:=true;
|
skipstab:=true;
|
||||||
|
if skipfun then
|
||||||
|
begin
|
||||||
|
skipstab:=hstab.ntype in [N_TextLine,N_RSYM,N_LSYM,N_tsym,N_LBRAC,N_RBRAC,N_IncludeFile];
|
||||||
|
skipfun:=skipstab;
|
||||||
|
end;
|
||||||
if not skipstab then
|
if not skipstab then
|
||||||
begin
|
begin
|
||||||
{ Find corresponding Relocation }
|
{ Find corresponding Relocation }
|
||||||
@ -2088,7 +2096,17 @@ implementation
|
|||||||
if not assigned(relocsec) then
|
if not assigned(relocsec) then
|
||||||
internalerror(200603302);
|
internalerror(200603302);
|
||||||
if not relocsec.Used then
|
if not relocsec.Used then
|
||||||
skipstab:=true;
|
begin
|
||||||
|
skipstab:=true;
|
||||||
|
if (hstab.ntype=N_Function) and (hstab.strpos<>0) then
|
||||||
|
begin
|
||||||
|
currstabstrsec.Data.seek(hstab.strpos);
|
||||||
|
bufsize:=currstabstrsec.Data.read(buf,sizeof(buf));
|
||||||
|
bufend:=indexbyte(buf,bufsize,Ord(':'));
|
||||||
|
if (bufend<>-1) and (bufend<bufsize-1) and (buf[bufend+1]=Ord('F')) then
|
||||||
|
skipfun:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if not skipstab then
|
if not skipstab then
|
||||||
|
@ -224,15 +224,19 @@ implementation
|
|||||||
|
|
||||||
{$ifdef arm}
|
{$ifdef arm}
|
||||||
procedure InsertPData;
|
procedure InsertPData;
|
||||||
|
var
|
||||||
|
prolog: TAsmList;
|
||||||
begin
|
begin
|
||||||
new_section(current_asmdata.asmlists[al_globals],sec_code,'FPC_EH_PROLOG',sizeof(aint),secorder_begin);
|
prolog:=TAsmList.create;
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Createname('_ARM_ExceptionHandler', 0));
|
new_section(prolog,sec_code,'FPC_EH_PROLOG',sizeof(aint),secorder_begin);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(0));
|
prolog.concat(Tai_const.Createname('_ARM_ExceptionHandler', 0));
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('FPC_EH_CODE_START',AT_DATA,0));
|
prolog.concat(Tai_const.Create_32bit(0));
|
||||||
|
prolog.concat(Tai_symbol.Createname_global('FPC_EH_CODE_START',AT_DATA,0));
|
||||||
new_section(current_asmdata.asmlists[al_globals],sec_pdata,'',sizeof(aint));
|
current_asmdata.asmlists[al_start].insertList(prolog);
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Createname('FPC_EH_CODE_START', 0));
|
prolog.Free;
|
||||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit($cfffff02));
|
new_section(current_asmdata.asmlists[al_end],sec_pdata,'',sizeof(aint));
|
||||||
|
current_asmdata.asmlists[al_end].concat(Tai_const.Createname('FPC_EH_CODE_START', 0));
|
||||||
|
current_asmdata.asmlists[al_end].concat(Tai_const.Create_32bit($cfffff02));
|
||||||
end;
|
end;
|
||||||
{$endif arm}
|
{$endif arm}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user