mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 18:47:52 +02:00
* fixed gprof support for darwin/ppc32 (although the output from gprof
isn't very useful, since it discards all symbols which contain a '$') git-svn-id: trunk@6080 -
This commit is contained in:
parent
01749b93f3
commit
4d1f213889
@ -940,10 +940,12 @@ const
|
||||
begin
|
||||
{ save link register? }
|
||||
if (pi_do_call in current_procinfo.flags) or
|
||||
([cs_lineinfo,cs_debuginfo] * current_settings.moduleswitches <> []) then
|
||||
([cs_lineinfo,cs_debuginfo,cs_profile] * current_settings.moduleswitches <> []) then
|
||||
begin
|
||||
a_reg_alloc(list,NR_R0);
|
||||
{ save return address... }
|
||||
{ warning: if this is no longer done via r0, or if r0 is }
|
||||
{ added to the usable registers, adapt tcgppcgen.g_profilecode }
|
||||
list.concat(taicpu.op_reg(A_MFLR,NR_R0));
|
||||
{ ... in caller's frame }
|
||||
case target_info.abi of
|
||||
@ -953,7 +955,8 @@ const
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,LA_LR_SYSV);
|
||||
end;
|
||||
list.concat(taicpu.op_reg_ref(A_STW,NR_R0,href));
|
||||
a_reg_dealloc(list,NR_R0);
|
||||
if not(cs_profile in current_settings.moduleswitches) then
|
||||
a_reg_dealloc(list,NR_R0);
|
||||
end;
|
||||
|
||||
(*
|
||||
|
@ -50,6 +50,8 @@ unit cgppc;
|
||||
procedure a_loadfpu_ref_reg(list: TAsmList; fromsize, tosize: tcgsize; const ref: treference; reg: tregister); override;
|
||||
procedure a_loadfpu_reg_ref(list: TAsmList; fromsize, tosize: tcgsize; reg: tregister; const ref: treference); override;
|
||||
|
||||
{ entry code }
|
||||
procedure g_profilecode(list: TAsmList); override;
|
||||
protected
|
||||
function get_darwin_call_stub(const s: string): tasmsymbol;
|
||||
procedure a_load_subsetref_regs_noindex(list: TAsmList; subsetsize: tcgsize; loadbitsize: byte; const sref: tsubsetreference; valuereg, extra_value_reg: tregister); override;
|
||||
@ -319,4 +321,25 @@ unit cgppc;
|
||||
a_load_subsetreg_subsetreg(list,subsetsize,subsetsize,fromsreg,tosreg);
|
||||
end;
|
||||
|
||||
|
||||
procedure tcgppcgen.g_profilecode(list: TAsmList);
|
||||
var
|
||||
paraloc1 : tcgpara;
|
||||
reg: tregister;
|
||||
begin
|
||||
if (target_info.system in [system_powerpc_darwin]) then
|
||||
begin
|
||||
paraloc1.init;
|
||||
paramanager.getintparaloc(pocall_cdecl,1,paraloc1);
|
||||
a_param_reg(list,OS_ADDR,NR_R0,paraloc1);
|
||||
paramanager.freeparaloc(list,paraloc1);
|
||||
paraloc1.done;
|
||||
allocallcpuregisters(list);
|
||||
a_call_name(list,'mcount');
|
||||
deallocallcpuregisters(list);
|
||||
a_reg_dealloc(list,NR_R0);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -329,19 +329,31 @@ begin
|
||||
begin
|
||||
{ for darwin: always link dynamically against libc }
|
||||
linklibc := true;
|
||||
{ not sure what this is for, but gcc always links against it }
|
||||
if not(cs_profile in current_settings.moduleswitches) then
|
||||
AddSharedLibrary('SystemStubs')
|
||||
else
|
||||
AddSharedLibrary('SystemStubs_profile');
|
||||
reorder:=reorderentries;
|
||||
if not(isdll) then
|
||||
if not(cs_profile in current_settings.moduleswitches) then
|
||||
begin
|
||||
if librarysearchpath.FindFile('crt1.o',false,s) then
|
||||
if librarysearchpath.FindFile('crt1.o',false,s) then
|
||||
prtobj:=s
|
||||
else
|
||||
prtobj:='/usr/lib/crt1.o';
|
||||
end
|
||||
else
|
||||
prtobj:='/usr/lib/gcrt1.o'
|
||||
begin
|
||||
if librarysearchpath.FindFile('gcrt1.o',false,s) then
|
||||
prtobj:=s
|
||||
else
|
||||
prtobj:='/usr/lib/gcrt1.o';
|
||||
end
|
||||
else
|
||||
prtobj:='';
|
||||
begin
|
||||
prtobj:='';
|
||||
end;
|
||||
end;
|
||||
|
||||
if reorder Then
|
||||
@ -523,13 +535,14 @@ begin
|
||||
// warning: this option only exists for 32 bit under Mac OS X, maybe the default for 64 bit?
|
||||
GCSectionsStr:='-dead_strip';
|
||||
|
||||
If (cs_profile in current_settings.moduleswitches) or
|
||||
if(not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) and
|
||||
(cs_profile in current_settings.moduleswitches)) or
|
||||
((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
|
||||
DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
|
||||
|
||||
if CShared Then
|
||||
begin
|
||||
if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
|
||||
if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
|
||||
DynLinKStr:=DynLinkStr+' --shared'
|
||||
else
|
||||
DynLinKStr:=DynLinkStr+' -dynamic'; // one dash!
|
||||
|
Loading…
Reference in New Issue
Block a user