mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 15:10:40 +02:00
* factored out the check for whether we have to generate dotted function
names, and disabled them for ppc64 ELFv2 * disabling those also disables the function descriptors, so use the _CALL_ELF compiler variable to check whether there is in fact a function descriptor git-svn-id: trunk@30196 -
This commit is contained in:
parent
cc071ded4b
commit
1e227f78fe
@ -1276,8 +1276,9 @@ implementation
|
||||
else
|
||||
AsmWriteln(tai_symbol(hp).sym.name);
|
||||
end;
|
||||
if (target_info.system = system_powerpc64_linux) and
|
||||
(tai_symbol(hp).sym.typ = AT_FUNCTION) and (cs_profile in current_settings.moduleswitches) then
|
||||
if (target_info.system=system_powerpc64_linux) and
|
||||
(tai_symbol(hp).sym.typ=AT_FUNCTION) and
|
||||
(cs_profile in current_settings.moduleswitches) then
|
||||
AsmWriteLn('.globl _mcount');
|
||||
|
||||
if tai_symbol(hp).is_global then
|
||||
@ -1288,8 +1289,9 @@ implementation
|
||||
else
|
||||
AsmWriteln(tai_symbol(hp).sym.name);
|
||||
end;
|
||||
if (target_info.system = system_powerpc64_linux) and
|
||||
(tai_symbol(hp).sym.typ = AT_FUNCTION) then
|
||||
if (target_info.system=system_powerpc64_linux) and
|
||||
use_dotted_functions and
|
||||
(tai_symbol(hp).sym.typ=AT_FUNCTION) then
|
||||
begin
|
||||
AsmWriteLn('.section ".opd", "aw"');
|
||||
AsmWriteLn('.align 3');
|
||||
@ -1380,15 +1382,19 @@ implementation
|
||||
inc(symendcount);
|
||||
AsmWriteLn(s+':');
|
||||
AsmWrite(#9'.size'#9);
|
||||
if (target_info.system = system_powerpc64_linux) and (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then
|
||||
if (target_info.system=system_powerpc64_linux) and
|
||||
use_dotted_functions and
|
||||
(tai_symbol_end(hp).sym.typ=AT_FUNCTION) then
|
||||
AsmWrite('.');
|
||||
if replaceforbidden then
|
||||
AsmWrite(ReplaceForbiddenAsmSymbolChars(tai_symbol_end(hp).sym.name))
|
||||
else
|
||||
AsmWrite(tai_symbol_end(hp).sym.name);
|
||||
AsmWrite(', '+s+' - ');
|
||||
if (target_info.system = system_powerpc64_linux) and (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then
|
||||
AsmWrite('.');
|
||||
if (target_info.system=system_powerpc64_linux) and
|
||||
use_dotted_functions and
|
||||
(tai_symbol_end(hp).sym.typ=AT_FUNCTION) then
|
||||
AsmWrite('.');
|
||||
if replaceforbidden then
|
||||
AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbol_end(hp).sym.name))
|
||||
else
|
||||
|
@ -2178,7 +2178,7 @@ implementation
|
||||
current_asmdata.getlabel(procendlabel,alt_dbgtype);
|
||||
current_asmdata.asmlists[al_procedures].insertbefore(tai_label.create(procendlabel),def.procendtai);
|
||||
|
||||
if (target_info.system = system_powerpc64_linux) then
|
||||
if use_dotted_functions then
|
||||
procentry := '.' + def.mangledname
|
||||
else
|
||||
procentry := def.mangledname;
|
||||
|
@ -550,6 +550,7 @@ interface
|
||||
function is_double_hilo_swapped: boolean;{$ifdef USEINLINE}inline;{$endif}
|
||||
{$endif ARM}
|
||||
function floating_point_range_check_error : boolean;
|
||||
function use_dotted_functions: boolean;
|
||||
|
||||
{ hide Sysutils.ExecuteProcess in units using this one after SysUtils}
|
||||
const
|
||||
@ -1295,6 +1296,14 @@ implementation
|
||||
result:=cs_ieee_errors in current_settings.localswitches;
|
||||
end;
|
||||
|
||||
|
||||
function use_dotted_functions: boolean;
|
||||
begin
|
||||
result:=
|
||||
(target_info.system in systems_dotted_function_names) and
|
||||
(target_info.abi<>abi_powerpc_elfv2);
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
Init
|
||||
****************************************************************************}
|
||||
|
@ -242,7 +242,7 @@ const
|
||||
exit;
|
||||
end;
|
||||
if (line[fsymtypepos] in ['T','t']) and
|
||||
(not(target_info.system in systems_dotted_function_names) or
|
||||
(not use_dotted_functions or
|
||||
(line[fsymnamepos-1]='.')) then
|
||||
fsymbols.add(copy(line,fsymnamepos,length(line)),pointer(1));
|
||||
end;
|
||||
@ -340,7 +340,7 @@ const
|
||||
{ on Linux/ppc64, there is an extra '.' at the start
|
||||
of public function names
|
||||
}
|
||||
if (target_info.system=system_powerpc64_linux) then
|
||||
if use_dotted_functions then
|
||||
inc(fsymnamepos);
|
||||
if failiferror(fsymtypepos<=0) then
|
||||
exit;
|
||||
|
@ -47,7 +47,7 @@ Unit rappcgas;
|
||||
{ helpers }
|
||||
cutils,
|
||||
{ global }
|
||||
globtype,verbose,
|
||||
globtype,globals,verbose,
|
||||
systems,
|
||||
{ aasm }
|
||||
cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
||||
@ -763,12 +763,12 @@ Unit rappcgas;
|
||||
if (instr.Operands[1].opr.ref.base<>NR_NO) or
|
||||
(instr.Operands[1].opr.ref.index<>NR_NO) then
|
||||
Message(asmr_e_syn_operand);
|
||||
if (target_info.system in systems_dotted_function_names) and
|
||||
if use_dotted_functions and
|
||||
assigned(instr.Operands[1].opr.ref.symbol) then
|
||||
instr.Operands[1].opr.ref.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.ref.symbol.name,instr.Operands[1].opr.ref.symbol.bind,AT_FUNCTION);
|
||||
end;
|
||||
{ regular name is toc entry, .-based name is actual code }
|
||||
if (target_info.system in systems_dotted_function_names) and
|
||||
if use_dotted_functions and
|
||||
(instr.Operands[1].opr.typ = OPR_SYMBOL) and
|
||||
(instr.Operands[1].opr.symbol.typ=AT_FUNCTION) then
|
||||
instr.Operands[1].opr.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.symbol.name,instr.Operands[1].opr.symbol.bind,AT_FUNCTION);
|
||||
|
@ -47,7 +47,7 @@ uses
|
||||
{ helpers }
|
||||
cutils,
|
||||
{ global }
|
||||
globtype, verbose,
|
||||
globtype, globals, verbose,
|
||||
systems,
|
||||
{ aasm }
|
||||
cpubase, aasmbase, aasmtai,aasmdata, aasmcpu,
|
||||
@ -763,11 +763,11 @@ begin
|
||||
if (instr.Operands[1].opr.ref.base<>NR_NO) or
|
||||
(instr.Operands[1].opr.ref.index<>NR_NO) then
|
||||
Message(asmr_e_syn_operand);
|
||||
if (target_info.system in systems_dotted_function_names) and
|
||||
if use_dotted_functions and
|
||||
assigned(instr.Operands[1].opr.ref.symbol) then
|
||||
instr.Operands[1].opr.ref.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.ref.symbol.name,instr.Operands[1].opr.ref.symbol.bind,AT_FUNCTION);
|
||||
end;
|
||||
if (target_info.system in systems_dotted_function_names) and
|
||||
if use_dotted_functions and
|
||||
(instr.Operands[1].opr.typ = OPR_SYMBOL) and
|
||||
(instr.Operands[1].opr.symbol.typ=AT_FUNCTION) then
|
||||
instr.Operands[1].opr.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.symbol.name,instr.Operands[1].opr.symbol.bind,AT_FUNCTION);
|
||||
|
@ -766,7 +766,9 @@ unit cgppc;
|
||||
href.offset := smallint(href.offset and $ffff);
|
||||
end;
|
||||
a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,NR_R11);
|
||||
if (target_info.system in ([system_powerpc64_linux]+systems_aix)) then
|
||||
if (target_info.system in systems_aix) or
|
||||
((target_info.system = system_powerpc64_linux) and
|
||||
(target_info.abi=abi_powerpc_sysv)) then
|
||||
begin
|
||||
reference_reset_base(href, NR_R11, 0, sizeof(pint));
|
||||
a_load_ref_reg(list, OS_ADDR, OS_ADDR, href, NR_R11);
|
||||
@ -817,11 +819,9 @@ unit cgppc;
|
||||
system_powerpc_darwin,
|
||||
system_powerpc64_darwin:
|
||||
list.concat(taicpu.op_sym(A_B,get_darwin_call_stub(procdef.mangledname,false)));
|
||||
system_powerpc64_linux,
|
||||
system_powerpc_aix,
|
||||
system_powerpc64_aix:
|
||||
else if use_dotted_functions then
|
||||
{$note ts:todo add GOT change?? - think not needed :) }
|
||||
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname)));
|
||||
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname)))
|
||||
else
|
||||
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)))
|
||||
end;
|
||||
|
@ -119,12 +119,13 @@ function InternalInquireSignal(RtlSigNum: Integer; out act: SigActionRec; fromin
|
||||
if not frominit then
|
||||
begin
|
||||
{ check whether the installed signal handler is still ours }
|
||||
{$if not defined(aix) and (not defined(linux) or not defined(cpupowerpc64))}
|
||||
{$if not defined(aix) and (not defined(linux) or not defined(cpupowerpc64) or (defined(_call_elf) and (_call_elf = 2)))}
|
||||
if (pointer(act.sa_handler)=pointer(@defaultsighandler)) then
|
||||
{$else}
|
||||
{ on aix and linux/ppc64, procedure addresses are actually
|
||||
descriptors -> check whether the code addresses inside the
|
||||
descriptors match, rather than the descriptors themselves }
|
||||
{ on aix and linux/ppc64 (ELFv1), procedure addresses are
|
||||
actually descriptors -> check whether the code addresses
|
||||
inside the descriptors match, rather than the descriptors
|
||||
themselves }
|
||||
if (ppointer(act.sa_handler)^=ppointer(@defaultsighandler)^) then
|
||||
{$endif}
|
||||
result:=ssHooked
|
||||
@ -141,7 +142,7 @@ function InternalInquireSignal(RtlSigNum: Integer; out act: SigActionRec; fromin
|
||||
{ program -> signals have been hooked by system init code }
|
||||
if (byte(RtlSigNum) in [RTL_SIGFPE,RTL_SIGSEGV,RTL_SIGILL,RTL_SIGBUS]) then
|
||||
begin
|
||||
{$if not defined(aix) and (not defined(linux) or not defined(cpupowerpc64))}
|
||||
{$if not defined(aix) and (not defined(linux) or not defined(cpupowerpc64) or (defined(_call_elf) and (_call_elf = 2)))}
|
||||
if (pointer(act.sa_handler)=pointer(@defaultsighandler)) then
|
||||
{$else}
|
||||
if (ppointer(act.sa_handler)^=ppointer(@defaultsighandler)^) then
|
||||
|
Loading…
Reference in New Issue
Block a user