* fixing bug related to errornous program main entry stack frame

This commit is contained in:
mazen 2003-02-06 22:36:55 +00:00
parent 8cb32a768b
commit 9ad1d0ffe2
3 changed files with 46 additions and 10 deletions

View File

@ -1294,6 +1294,12 @@ implementation
aktprocdef.aliasnames.insert('PASCALMAIN');
aktprocdef.aliasnames.insert(target_info.cprefix+'main');
end;
{$IFDEF SPARC}
ProcInfo.After_Header;
{main function is declared as
PROCEDURE main(ArgC:Integer;ArgV,EnvP:ARRAY OF PChar):Integer;CDECL;
So, all parameters are passerd into registers in sparc architecture.}
{$ENDIF SPARC}
compile_proc_body(true,false);
{ should we force unit initialization? }
@ -1438,7 +1444,10 @@ implementation
end.
{
$Log$
Revision 1.94 2003-01-30 21:46:20 peter
Revision 1.95 2003-02-06 22:36:55 mazen
* fixing bug related to errornous program main entry stack frame
Revision 1.94 2003/01/30 21:46:20 peter
* tai_const_symbol.createdataname added
Revision 1.93 2003/01/11 11:19:54 hajny

View File

@ -50,20 +50,41 @@ stack frame.}
end;
implementation
uses
tgobj;
tgobj,paramgr,symsym,systems;
constructor TSparcprocinfo.create;
begin
inherited create;
maxpushedparasize:=0;
LocalSize:=0;
end;
procedure TSparcprocinfo.after_header;
begin
LocalSize:=(16+1)*4;
{First 16 words are in the frame are used to save registers in case of a
register overflow/underflow.The 17th word is used to save the address of
the variable which will receive the return value of the called function}
Return_Offset:=16*4;
procdef.parast.address_fixup:=(16+1)*4;
end;
procedure TSparcprocinfo.after_header;
begin
{target_info.first_parm_offset should be (16+1)*4 as the return address pointer
is usually allocated even if return value is in register.}
procdef.parast.address_fixup:=target_info.first_parm_offset;
if assigned(procdef.localst)and(procdef.localst.symtablelevel>1)
then
begin
framepointer_offset:=procdef.parast.address_fixup;
inc(procdef.parast.address_fixup,4);
end;
if assigned(_class)
then
begin
selfpointer_offset:=procdef.parast.address_fixup;
inc(procdef.parast.address_fixup,4);
end;
{ this value is necessary for nested procedures }
if assigned(procdef.localst)
then
procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
if assigned(aktprocdef.funcretsym) and not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption))
then
return_offset:=tg.direction*tfuncretsym(aktprocdef.funcretsym).address+procdef.localst.address_fixup;
end;
procedure TSparcProcInfo.after_pass1;
begin
@ -90,7 +111,10 @@ begin
end.
{
$Log$
Revision 1.11 2003-01-05 21:32:35 mazen
Revision 1.12 2003-02-06 22:36:55 mazen
* fixing bug related to errornous program main entry stack frame
Revision 1.11 2003/01/05 21:32:35 mazen
* fixing several bugs compiling the RTL
Revision 1.10 2002/12/24 21:30:20 mazen

View File

@ -405,7 +405,7 @@ unit i_linux;
recordalignmax : 2;
maxCrecordalign : 4
);
first_parm_offset : 8;
first_parm_offset : (16+1)*4;
heapsize : 256*1024;
stacksize : 262144;
DllScanSupported:false;
@ -446,7 +446,10 @@ initialization
end.
{
$Log$
Revision 1.3 2003-01-11 16:35:15 marco
Revision 1.4 2003-02-06 22:36:55 mazen
* fixing bug related to errornous program main entry stack frame
Revision 1.3 2003/01/11 16:35:15 marco
* HASUNIX defined for now.
Revision 1.2 2002/10/04 21:57:42 mazen