Avoid wrong code generation for a_call_name if we create pic code

git-svn-id: trunk@23560 -
This commit is contained in:
pierre 2013-02-01 21:16:58 +00:00
parent f74954dd32
commit 899951577a

View File

@ -49,6 +49,7 @@ implementation
uses
aasmtai,
cutils,
globals,
cgobj,
cpubase,
cgcpu;
@ -58,6 +59,14 @@ implementation
ref : treference;
begin
if pd.proccalloption=pocall_cdecl then
begin
if (cs_create_pic in current_settings.moduleswitches) then
begin
reference_reset(ref,sizeof(aint));
ref.symbol:=current_asmdata.RefAsmSymbol(s);
cg.a_loadaddr_ref_reg(list,ref,NR_PIC_FUNC);
end
else
begin
{ Use $gp/$t9 registers as the code might be in a shared library }
reference_reset(ref,sizeof(aint));
@ -69,6 +78,7 @@ implementation
ref.base:=NR_GP;
ref.refaddr:=addr_pic_call16;
cg.a_loadaddr_ref_reg(list,ref,NR_PIC_FUNC);
end;
cg.a_call_reg(list,NR_PIC_FUNC);
end
else