+ some code for PIC support added

This commit is contained in:
florian 2003-10-14 00:30:48 +00:00
parent 64b073a5cd
commit 57a2fe6ddb
5 changed files with 57 additions and 10 deletions

View File

@ -29,10 +29,11 @@ unit cpupi;
interface interface
uses uses
psub; psub,procinfo;
type type
ti386procinfo = class(tcgprocinfo) ti386procinfo = class(tcgprocinfo)
constructor create(aparent:tprocinfo);override;
function calc_stackframe_size:longint;override; function calc_stackframe_size:longint;override;
end; end;
@ -43,7 +44,14 @@ unit cpupi;
cutils, cutils,
globals, globals,
tgobj, tgobj,
procinfo; cpubase;
constructor ti386procinfo.create(aparent:tprocinfo);
begin
inherited create(aparent);
got:=NR_EBX;
end;
function ti386procinfo.calc_stackframe_size:longint; function ti386procinfo.calc_stackframe_size:longint;
begin begin
@ -59,7 +67,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.15 2003-10-03 22:00:33 peter Revision 1.16 2003-10-14 00:30:48 florian
+ some code for PIC support added
Revision 1.15 2003/10/03 22:00:33 peter
* parameter alignment fixes * parameter alignment fixes
Revision 1.14 2003/10/01 20:34:49 peter Revision 1.14 2003/10/01 20:34:49 peter

View File

@ -54,6 +54,7 @@ implementation
ncnv,ncon,nmem,nbas, ncnv,ncon,nmem,nbas,
aasmbase,aasmtai, aasmbase,aasmtai,
cgbase,pass_2, cgbase,pass_2,
procinfo,
cpubase,cpuinfo, cpubase,cpuinfo,
tgobj,ncgutil,cgobj,ncgbas; tgobj,ncgutil,cgobj,ncgbas;
@ -227,6 +228,12 @@ implementation
globalsymtable, globalsymtable,
staticsymtable : staticsymtable :
begin begin
if cs_create_pic in aktmoduleswitches then
begin
location.reference.base:=current_procinfo.got;
location.reference.symbol:=objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname+'@GOT');
end
else
location.reference.symbol:=objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname); location.reference.symbol:=objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname);
end; end;
stt_exceptsymtable: stt_exceptsymtable:
@ -884,7 +891,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.94 2003-10-11 16:06:42 florian Revision 1.95 2003-10-14 00:30:48 florian
+ some code for PIC support added
Revision 1.94 2003/10/11 16:06:42 florian
* fixed some MMX<->SSE * fixed some MMX<->SSE
* started to fix ppc, needs an overhaul * started to fix ppc, needs an overhaul
+ stabs info improve for spilling, not sure if it works correctly/completly + stabs info improve for spilling, not sure if it works correctly/completly

View File

@ -1118,11 +1118,13 @@ begin
include(initglobalswitches,cs_link_shared); include(initglobalswitches,cs_link_shared);
LinkTypeSetExplicitly:=true; LinkTypeSetExplicitly:=true;
end; end;
'd' : Dontlinkstdlibpath:=TRUE;
'P' : Begin 'P' : Begin
utilsprefix:=Copy(more,2,length(More)-1); utilsprefix:=Copy(more,2,length(More)-1);
More:=''; More:='';
End; End;
'd' : Dontlinkstdlibpath:=TRUE; 'p' :
include(initmoduleswitches,cs_create_pic);
'S' : 'S' :
begin begin
def_symbol('FPC_LINK_STATIC'); def_symbol('FPC_LINK_STATIC');
@ -1981,7 +1983,10 @@ finalization
end. end.
{ {
$Log$ $Log$
Revision 1.109 2003-10-11 19:32:04 marco Revision 1.110 2003-10-14 00:30:48 florian
+ some code for PIC support added
Revision 1.109 2003/10/11 19:32:04 marco
* -Xd * -Xd
Revision 1.108 2003/10/08 19:17:43 peter Revision 1.108 2003/10/08 19:17:43 peter

View File

@ -83,6 +83,9 @@ unit procinfo;
{ register used as frame pointer } { register used as frame pointer }
framepointer : tregister; framepointer : tregister;
{ register containing currently the got }
got : tregister;
{ Holds the reference used to store alll saved registers. } { Holds the reference used to store alll saved registers. }
save_regs_ref : treference; save_regs_ref : treference;
@ -214,7 +217,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.5 2003-10-10 17:48:13 peter Revision 1.6 2003-10-14 00:30:48 florian
+ some code for PIC support added
Revision 1.5 2003/10/10 17:48:13 peter
* old trgobj moved to x86/rgcpu and renamed to trgx86fpu * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
* tregisteralloctor renamed to trgobj * tregisteralloctor renamed to trgobj
* removed rgobj from a lot of units * removed rgobj from a lot of units

View File

@ -176,6 +176,9 @@ unit cgx86;
procedure Tcgx86.init_register_allocators; procedure Tcgx86.init_register_allocators;
begin begin
if cs_create_pic in aktmoduleswitches then
rgint:=trgcpu.create(5,R_INTREGISTER,R_SUBWHOLE,#0#1#2#4#5,first_int_imreg,[RS_EBP,RS_EBX])
else
rgint:=trgcpu.create(6,R_INTREGISTER,R_SUBWHOLE,#0#1#2#3#4#5,first_int_imreg,[RS_EBP]); rgint:=trgcpu.create(6,R_INTREGISTER,R_SUBWHOLE,#0#1#2#3#4#5,first_int_imreg,[RS_EBP]);
rgmm:=trgcpu.create(8,R_MMREGISTER,R_SUBNONE,#0#1#2#3#4#5#6#7,first_sse_imreg,[]); rgmm:=trgcpu.create(8,R_MMREGISTER,R_SUBNONE,#0#1#2#3#4#5#6#7,first_sse_imreg,[]);
rgfpu:=Trgx86fpu.create; rgfpu:=Trgx86fpu.create;
@ -1559,12 +1562,21 @@ unit cgx86;
list.concat(Taicpu.op_reg_reg(A_MOV,S_L,NR_ESP,NR_EBP)); list.concat(Taicpu.op_reg_reg(A_MOV,S_L,NR_ESP,NR_EBP));
if localsize>0 then if localsize>0 then
g_stackpointer_alloc(list,localsize); g_stackpointer_alloc(list,localsize);
if cs_create_pic in aktmoduleswitches then
begin
a_call_name(list,'FPC_GETEIPINEBX');
list.concat(taicpu.op_sym_ofs_reg(A_ADD,S_L,objectlibrary.newasmsymboldata('_GLOBAL_OFFSET_TABLE_'),0,NR_EBX));
list.concat(tai_regalloc.alloc(NR_EBX));
end;
end; end;
procedure tcgx86.g_restore_frame_pointer(list : taasmoutput); procedure tcgx86.g_restore_frame_pointer(list : taasmoutput);
begin begin
if cs_create_pic in aktmoduleswitches then
list.concat(tai_regalloc.dealloc(NR_EBX));
list.concat(tai_regalloc.dealloc(NR_EBP)); list.concat(tai_regalloc.dealloc(NR_EBP));
list.concat(Taicpu.op_none(A_LEAVE,S_NO)); list.concat(Taicpu.op_none(A_LEAVE,S_NO));
end; end;
@ -1721,7 +1733,10 @@ unit cgx86;
end. end.
{ {
$Log$ $Log$
Revision 1.78 2003-10-13 01:23:13 florian Revision 1.79 2003-10-14 00:30:48 florian
+ some code for PIC support added
Revision 1.78 2003/10/13 01:23:13 florian
* some ideas for mm support implemented * some ideas for mm support implemented
Revision 1.77 2003/10/11 16:06:42 florian Revision 1.77 2003/10/11 16:06:42 florian