* use high level interface wrappers for powerpc64 if pic is generated as

the abi does not support branches between functions located in different
    tocs which might happen for inter-module branches
This commit is contained in:
florian 2021-11-27 23:33:22 +01:00
parent 5c55f1a16e
commit 12f48c230b
2 changed files with 63 additions and 46 deletions

View File

@ -1222,14 +1222,22 @@ implementation
tmps : string;
pd : TProcdef;
ImplIntf : TImplementedInterface;
{$ifdef cpuhighleveltarget}
wrapperpd: tprocdef;
wrapperinfo: pskpara_interface_wrapper;
{$else}
tmplist: tasmlist;
oldfileposinfo: tfileposinfo;
{$endif cpuhighleveltarget}
usehighlevelwrapper: Boolean;
begin
{$if defined(cpuhighleveltarget)}
usehighlevelwrapper:=true;
{$else defined(cpuhighleveltarget)}
{$if defined(powerpc64)}
if cs_create_pic in current_settings.moduleswitches then
usehighlevelwrapper:=true
else
{$endif defined(powerpc64)}
usehighlevelwrapper:=false;
{$endif defined(cpuhighleveltarget)}
for i:=0 to _class.ImplementedInterfaces.count-1 do
begin
ImplIntf:=TImplementedInterface(_class.ImplementedInterfaces[i]);
@ -1246,7 +1254,9 @@ implementation
not is_objectpascal_helper(tprocdef(pd).struct) then
tobjectdef(tprocdef(pd).struct).register_vmt_call(tprocdef(pd).extnumber);
tmps:=CreateWrapperName(_Class,ImplIntf,j,pd);
{$ifdef cpuhighleveltarget}
if usehighlevelwrapper then
begin
new(wrapperinfo);
wrapperinfo^.pd:=pd;
wrapperinfo^.offset:=ImplIntf.ioffset;
@ -1257,7 +1267,9 @@ implementation
current_module.localsymtable,_class,
tsk_interface_wrapper,wrapperinfo);
include(wrapperpd.implprocoptions,pio_thunk);
{$else cpuhighleveltarget}
end
else
begin
oldfileposinfo:=current_filepos;
if pd.owner.iscurrentunit then
current_filepos:=pd.fileinfo
@ -1282,7 +1294,7 @@ implementation
list.concatlist(tmplist);
tmplist.Free;
current_filepos:=oldfileposinfo;
{$endif cpuhighleveltarget}
end;
end;
end;
end;

View File

@ -183,11 +183,16 @@ implementation
system_powerpc_darwin,
system_powerpc64_darwin:
list.concat(taicpu.op_sym(A_B,tcgppcgen(cg).get_darwin_call_stub(procdef.mangledname,false)));
else if use_dotted_functions then
else
begin
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,AT_FUNCTION)))
else
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)))
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)));
if (target_info.system in ([system_powerpc64_linux]+systems_aix)) then
list.concat(taicpu.op_none(A_NOP));
end;
end;
List.concat(Tai_symbol_end.Createname(labelname));
end;