mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 04:59:26 +02:00
* MIPS: Once again fixed g_external_wrapper. My initial assumption about .cpload was wrong: it is optimized into position-dependent sequence only if "-KPIC -mno-shared" is passed to GAS command line, without -KPIC it is ignored altogether. Therefore r23566 breaks some non-PIC tests.
git-svn-id: trunk@23567 -
This commit is contained in:
parent
9bc758d62b
commit
ef38193043
@ -2032,18 +2032,30 @@ procedure TCGMIPS.g_external_wrapper(list: TAsmList; procdef: tprocdef; const ex
|
||||
var
|
||||
href: treference;
|
||||
begin
|
||||
{ Always do indirect jump using $t9, it won't harm in non-PIC mode.
|
||||
.cpload is safe in this respect, too. }
|
||||
list.concat(taicpu.op_none(A_P_SET_NOREORDER));
|
||||
list.concat(taicpu.op_reg(A_P_CPLOAD,NR_PIC_FUNC));
|
||||
reference_reset_symbol(href,current_asmdata.RefAsmSymbol(externalname),0,sizeof(aint));
|
||||
href.base:=NR_GP;
|
||||
href.refaddr:=addr_pic_call16;
|
||||
list.concat(taicpu.op_reg_ref(A_LW,NR_PIC_FUNC,href));
|
||||
list.concat(taicpu.op_reg(A_J,NR_PIC_FUNC));
|
||||
{ Delay slot }
|
||||
list.Concat(taicpu.op_none(A_NOP));
|
||||
list.Concat(taicpu.op_none(A_P_SET_REORDER));
|
||||
{ Always do indirect jump using $t9, it won't harm in non-PIC mode }
|
||||
if (cs_create_pic in current_settings.moduleswitches) then
|
||||
begin
|
||||
list.concat(taicpu.op_none(A_P_SET_NOREORDER));
|
||||
list.concat(taicpu.op_reg(A_P_CPLOAD,NR_PIC_FUNC));
|
||||
href.base:=NR_GP;
|
||||
href.refaddr:=addr_pic_call16;
|
||||
list.concat(taicpu.op_reg_ref(A_LW,NR_PIC_FUNC,href));
|
||||
list.concat(taicpu.op_reg(A_JR,NR_PIC_FUNC));
|
||||
{ Delay slot }
|
||||
list.Concat(taicpu.op_none(A_NOP));
|
||||
list.Concat(taicpu.op_none(A_P_SET_REORDER));
|
||||
end
|
||||
else
|
||||
begin
|
||||
href.refaddr:=addr_high;
|
||||
list.concat(taicpu.op_reg_ref(A_LUI,NR_PIC_FUNC,href));
|
||||
href.refaddr:=addr_low;
|
||||
list.concat(taicpu.op_reg_ref(A_ADDIU,NR_PIC_FUNC,href));
|
||||
list.concat(taicpu.op_reg(A_JR,NR_PIC_FUNC));
|
||||
{ Delay slot }
|
||||
list.Concat(taicpu.op_none(A_NOP));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -2284,4 +2296,4 @@ end;
|
||||
cg64:=TCg64MPSel.Create;
|
||||
end;
|
||||
|
||||
end.
|
||||
end.
|
Loading…
Reference in New Issue
Block a user