mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 08:59:27 +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
|
||||
SysUtils,
|
||||
globals,verbose,fmodule,ogmap;
|
||||
globals,verbose,fmodule,ogmap,dbgstabs;
|
||||
|
||||
const
|
||||
SectionDataMaxGrow = 4096;
|
||||
@ -1507,7 +1507,8 @@ implementation
|
||||
end;
|
||||
end;
|
||||
{ Sort list if needed }
|
||||
TmpObjSectionList.Sort(@ObjSectionNameCompare);
|
||||
if CurrExeSec.Name='.idata' then
|
||||
TmpObjSectionList.Sort(@ObjSectionNameCompare);
|
||||
{ Add the (sorted) list to the current ExeSection }
|
||||
for i:=0 to TmpObjSectionList.Count-1 do
|
||||
begin
|
||||
@ -2015,6 +2016,7 @@ implementation
|
||||
mergestabcnt,
|
||||
stabcnt : longint;
|
||||
skipstab : boolean;
|
||||
skipfun : boolean;
|
||||
hstab : TObjStabEntry;
|
||||
stabrelocofs : longint;
|
||||
buf : array[0..1023] of byte;
|
||||
@ -2041,6 +2043,7 @@ implementation
|
||||
buf[0]:=0;
|
||||
mergedstabstrsec.write(buf[0],1);
|
||||
|
||||
skipfun:=false;
|
||||
{ Copy stabs and corresponding Relocations }
|
||||
for i:=0 to stabexesec.ObjSectionList.Count-1 do
|
||||
begin
|
||||
@ -2059,6 +2062,11 @@ implementation
|
||||
{ Only include first hdrsym stab }
|
||||
if hstab.ntype=0 then
|
||||
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
|
||||
begin
|
||||
{ Find corresponding Relocation }
|
||||
@ -2088,7 +2096,17 @@ implementation
|
||||
if not assigned(relocsec) then
|
||||
internalerror(200603302);
|
||||
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;
|
||||
if not skipstab then
|
||||
|
@ -224,15 +224,19 @@ implementation
|
||||
|
||||
{$ifdef arm}
|
||||
procedure InsertPData;
|
||||
var
|
||||
prolog: TAsmList;
|
||||
begin
|
||||
new_section(current_asmdata.asmlists[al_globals],sec_code,'FPC_EH_PROLOG',sizeof(aint),secorder_begin);
|
||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Createname('_ARM_ExceptionHandler', 0));
|
||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(0));
|
||||
current_asmdata.asmlists[al_globals].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_globals].concat(Tai_const.Createname('FPC_EH_CODE_START', 0));
|
||||
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit($cfffff02));
|
||||
prolog:=TAsmList.create;
|
||||
new_section(prolog,sec_code,'FPC_EH_PROLOG',sizeof(aint),secorder_begin);
|
||||
prolog.concat(Tai_const.Createname('_ARM_ExceptionHandler', 0));
|
||||
prolog.concat(Tai_const.Create_32bit(0));
|
||||
prolog.concat(Tai_symbol.Createname_global('FPC_EH_CODE_START',AT_DATA,0));
|
||||
current_asmdata.asmlists[al_start].insertList(prolog);
|
||||
prolog.Free;
|
||||
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;
|
||||
{$endif arm}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user