mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-06 08:38:52 +02:00
+ generate the stack segment for i8086 far data memory models from within fpc
itself (instead of having a fixed 16k stack in the startup code). This allows setting the stack size in these models with the -Cs option. git-svn-id: trunk@27820 -
This commit is contained in:
parent
3c1368903f
commit
3cc8ff11e3
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -263,6 +263,7 @@ compiler/i8086/n8086ld.pas svneol=native#text/plain
|
|||||||
compiler/i8086/n8086mat.pas svneol=native#text/plain
|
compiler/i8086/n8086mat.pas svneol=native#text/plain
|
||||||
compiler/i8086/n8086mem.pas svneol=native#text/plain
|
compiler/i8086/n8086mem.pas svneol=native#text/plain
|
||||||
compiler/i8086/n8086tcon.pas svneol=native#text/plain
|
compiler/i8086/n8086tcon.pas svneol=native#text/plain
|
||||||
|
compiler/i8086/n8086util.pas svneol=native#text/plain
|
||||||
compiler/i8086/r8086ari.inc svneol=native#text/plain
|
compiler/i8086/r8086ari.inc svneol=native#text/plain
|
||||||
compiler/i8086/r8086att.inc svneol=native#text/plain
|
compiler/i8086/r8086att.inc svneol=native#text/plain
|
||||||
compiler/i8086/r8086con.inc svneol=native#text/plain
|
compiler/i8086/r8086con.inc svneol=native#text/plain
|
||||||
|
@ -140,7 +140,9 @@ interface
|
|||||||
sec_objc_nlclasslist,
|
sec_objc_nlclasslist,
|
||||||
sec_objc_catlist,
|
sec_objc_catlist,
|
||||||
sec_objc_nlcatlist,
|
sec_objc_nlcatlist,
|
||||||
sec_objc_protolist
|
sec_objc_protolist,
|
||||||
|
{ stack segment for 16-bit DOS }
|
||||||
|
sec_stack
|
||||||
);
|
);
|
||||||
|
|
||||||
TAsmSectionOrder = (secorder_begin,secorder_default,secorder_end);
|
TAsmSectionOrder = (secorder_begin,secorder_default,secorder_end);
|
||||||
|
@ -347,7 +347,8 @@ implementation
|
|||||||
'.objc_nlclasslist',
|
'.objc_nlclasslist',
|
||||||
'.objc_catlist',
|
'.objc_catlist',
|
||||||
'.obcj_nlcatlist',
|
'.obcj_nlcatlist',
|
||||||
'.objc_protolist'
|
'.objc_protolist',
|
||||||
|
'.stack'
|
||||||
);
|
);
|
||||||
secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
|
secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
|
||||||
'.text',
|
'.text',
|
||||||
@ -404,7 +405,8 @@ implementation
|
|||||||
'.objc_nlclasslist',
|
'.objc_nlclasslist',
|
||||||
'.objc_catlist',
|
'.objc_catlist',
|
||||||
'.obcj_nlcatlist',
|
'.obcj_nlcatlist',
|
||||||
'.objc_protolist'
|
'.objc_protolist',
|
||||||
|
'.stack'
|
||||||
);
|
);
|
||||||
var
|
var
|
||||||
sep : string[3];
|
sep : string[3];
|
||||||
@ -2014,7 +2016,8 @@ implementation
|
|||||||
sec_none (* sec_objc_nlclasslist *),
|
sec_none (* sec_objc_nlclasslist *),
|
||||||
sec_none (* sec_objc_catlist *),
|
sec_none (* sec_objc_catlist *),
|
||||||
sec_none (* sec_objc_nlcatlist *),
|
sec_none (* sec_objc_nlcatlist *),
|
||||||
sec_none (* sec_objc_protlist *)
|
sec_none (* sec_objc_protlist *),
|
||||||
|
sec_none (* sec_stack *)
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
Result := inherited SectionName (SecXTable [AType], AName, AOrder);
|
Result := inherited SectionName (SecXTable [AType], AName, AOrder);
|
||||||
|
@ -57,7 +57,7 @@ unit cpunode;
|
|||||||
n8086mat,
|
n8086mat,
|
||||||
n8086con,
|
n8086con,
|
||||||
{ these are not really nodes }
|
{ these are not really nodes }
|
||||||
n8086tcon,tgcpu,
|
n8086util,n8086tcon,tgcpu,
|
||||||
{ symtable }
|
{ symtable }
|
||||||
symcpu
|
symcpu
|
||||||
;
|
;
|
||||||
|
58
compiler/i8086/n8086util.pas
Normal file
58
compiler/i8086/n8086util.pas
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
Copyright (c) 2014 by Nikolay Nikolov
|
||||||
|
|
||||||
|
i8086 version of some node tree helper routines
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
}
|
||||||
|
unit n8086util;
|
||||||
|
|
||||||
|
{$i fpcdefs.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
ngenutil;
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
ti8086nodeutils = class(tnodeutils)
|
||||||
|
class procedure InsertMemorySizes; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
globals,cpuinfo,
|
||||||
|
aasmbase,aasmdata,aasmtai;
|
||||||
|
|
||||||
|
|
||||||
|
class procedure ti8086nodeutils.InsertMemorySizes;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if current_settings.x86memorymodel in x86_far_data_models then
|
||||||
|
begin
|
||||||
|
new_section(current_asmdata.asmlists[al_globals],sec_stack,'__stack', 16);
|
||||||
|
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stack', stacksize));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
cnodeutils:=ti8086nodeutils;
|
||||||
|
end.
|
@ -1079,7 +1079,8 @@ implementation
|
|||||||
{sec_objc_nlclasslist} [oso_data,oso_load],
|
{sec_objc_nlclasslist} [oso_data,oso_load],
|
||||||
{sec_objc_catlist} [oso_data,oso_load],
|
{sec_objc_catlist} [oso_data,oso_load],
|
||||||
{sec_objc_nlcatlist} [oso_data,oso_load],
|
{sec_objc_nlcatlist} [oso_data,oso_load],
|
||||||
{sec_objc_protolist'} [oso_data,oso_load]
|
{sec_objc_protolist'} [oso_data,oso_load],
|
||||||
|
{stack} [oso_load,oso_write]
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
result:=secoptions[atype];
|
result:=secoptions[atype];
|
||||||
|
@ -539,7 +539,8 @@ implementation
|
|||||||
'.objc_nlclasslist',
|
'.objc_nlclasslist',
|
||||||
'.objc_catlist',
|
'.objc_catlist',
|
||||||
'.obcj_nlcatlist',
|
'.obcj_nlcatlist',
|
||||||
'.objc_protolist'
|
'.objc_protolist',
|
||||||
|
'.stack'
|
||||||
);
|
);
|
||||||
|
|
||||||
const go32v2stub : array[0..2047] of byte=(
|
const go32v2stub : array[0..2047] of byte=(
|
||||||
|
@ -793,7 +793,8 @@ implementation
|
|||||||
'.objc_nlclasslist',
|
'.objc_nlclasslist',
|
||||||
'.objc_catlist',
|
'.objc_catlist',
|
||||||
'.obcj_nlcatlist',
|
'.obcj_nlcatlist',
|
||||||
'.objc_protolist'
|
'.objc_protolist',
|
||||||
|
'.stack'
|
||||||
);
|
);
|
||||||
var
|
var
|
||||||
sep : string[3];
|
sep : string[3];
|
||||||
|
@ -115,6 +115,7 @@ interface
|
|||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
|
'',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<Units Count="229">
|
<Units Count="230">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="pp.pas"/>
|
<Filename Value="pp.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -180,6 +180,7 @@
|
|||||||
<Unit30>
|
<Unit30>
|
||||||
<Filename Value="x86\agx86int.pas"/>
|
<Filename Value="x86\agx86int.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="agx86int"/>
|
||||||
</Unit30>
|
</Unit30>
|
||||||
<Unit31>
|
<Unit31>
|
||||||
<Filename Value="x86\cga.pas"/>
|
<Filename Value="x86\cga.pas"/>
|
||||||
@ -506,10 +507,12 @@
|
|||||||
<Unit97>
|
<Unit97>
|
||||||
<Filename Value="aasmbase.pas"/>
|
<Filename Value="aasmbase.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="aasmbase"/>
|
||||||
</Unit97>
|
</Unit97>
|
||||||
<Unit98>
|
<Unit98>
|
||||||
<Filename Value="aasmdata.pas"/>
|
<Filename Value="aasmdata.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="aasmdata"/>
|
||||||
</Unit98>
|
</Unit98>
|
||||||
<Unit99>
|
<Unit99>
|
||||||
<Filename Value="aasmsym.pas"/>
|
<Filename Value="aasmsym.pas"/>
|
||||||
@ -518,6 +521,7 @@
|
|||||||
<Unit100>
|
<Unit100>
|
||||||
<Filename Value="aggas.pas"/>
|
<Filename Value="aggas.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="aggas"/>
|
||||||
</Unit100>
|
</Unit100>
|
||||||
<Unit101>
|
<Unit101>
|
||||||
<Filename Value="agjasmin.pas"/>
|
<Filename Value="agjasmin.pas"/>
|
||||||
@ -673,6 +677,7 @@
|
|||||||
<Unit138>
|
<Unit138>
|
||||||
<Filename Value="gendef.pas"/>
|
<Filename Value="gendef.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="gendef"/>
|
||||||
</Unit138>
|
</Unit138>
|
||||||
<Unit139>
|
<Unit139>
|
||||||
<Filename Value="globstat.pas"/>
|
<Filename Value="globstat.pas"/>
|
||||||
@ -794,10 +799,12 @@
|
|||||||
<Unit167>
|
<Unit167>
|
||||||
<Filename Value="ogbase.pas"/>
|
<Filename Value="ogbase.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="ogbase"/>
|
||||||
</Unit167>
|
</Unit167>
|
||||||
<Unit168>
|
<Unit168>
|
||||||
<Filename Value="ogelf.pas"/>
|
<Filename Value="ogelf.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="ogelf"/>
|
||||||
</Unit168>
|
</Unit168>
|
||||||
<Unit169>
|
<Unit169>
|
||||||
<Filename Value="oglx.pas"/>
|
<Filename Value="oglx.pas"/>
|
||||||
@ -878,6 +885,7 @@
|
|||||||
<Unit188>
|
<Unit188>
|
||||||
<Filename Value="pdecobj.pas"/>
|
<Filename Value="pdecobj.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="pdecobj"/>
|
||||||
</Unit188>
|
</Unit188>
|
||||||
<Unit189>
|
<Unit189>
|
||||||
<Filename Value="pdecvar.pas"/>
|
<Filename Value="pdecvar.pas"/>
|
||||||
@ -1050,6 +1058,11 @@
|
|||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="tgcpu"/>
|
<UnitName Value="tgcpu"/>
|
||||||
</Unit228>
|
</Unit228>
|
||||||
|
<Unit229>
|
||||||
|
<Filename Value="i8086\n8086util.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="n8086util"/>
|
||||||
|
</Unit229>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -106,6 +106,7 @@ implementation
|
|||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
|
'',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ implementation
|
|||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
|
'',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -569,7 +569,8 @@ interface
|
|||||||
'.objc_nlclasslist',
|
'.objc_nlclasslist',
|
||||||
'.objc_catlist',
|
'.objc_catlist',
|
||||||
'.obcj_nlcatlist',
|
'.obcj_nlcatlist',
|
||||||
'.objc_protolist'
|
'.objc_protolist',
|
||||||
|
'.stack'
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
AsmLn;
|
AsmLn;
|
||||||
@ -1225,11 +1226,16 @@ interface
|
|||||||
AsmWriteLn('SECTION .fpc');
|
AsmWriteLn('SECTION .fpc');
|
||||||
{ WLINK requires class=bss in order to leave the BSS section out of the executable }
|
{ WLINK requires class=bss in order to leave the BSS section out of the executable }
|
||||||
AsmWriteLn('SECTION .bss class=bss');
|
AsmWriteLn('SECTION .bss class=bss');
|
||||||
|
if current_settings.x86memorymodel in x86_far_data_models then
|
||||||
|
AsmWriteLn('SECTION stack stack class=stack align=16');
|
||||||
{ group these sections in the same segment }
|
{ group these sections in the same segment }
|
||||||
if current_settings.x86memorymodel=mm_tiny then
|
if current_settings.x86memorymodel=mm_tiny then
|
||||||
AsmWriteLn('GROUP dgroup text rodata data fpc bss')
|
AsmWriteLn('GROUP dgroup text rodata data fpc bss')
|
||||||
else
|
else
|
||||||
AsmWriteLn('GROUP dgroup rodata data fpc bss');
|
if current_settings.x86memorymodel in x86_far_data_models then
|
||||||
|
AsmWriteLn('GROUP dgroup rodata data fpc bss stack')
|
||||||
|
else
|
||||||
|
AsmWriteLn('GROUP dgroup rodata data fpc bss');
|
||||||
if paratargetdbg in [dbg_dwarf2,dbg_dwarf3,dbg_dwarf4] then
|
if paratargetdbg in [dbg_dwarf2,dbg_dwarf3,dbg_dwarf4] then
|
||||||
begin
|
begin
|
||||||
AsmWriteLn('SECTION .debug_frame use32 class=DWARF');
|
AsmWriteLn('SECTION .debug_frame use32 class=DWARF');
|
||||||
|
@ -473,15 +473,15 @@ __nullarea:
|
|||||||
segment stack stack class=stack
|
segment stack stack class=stack
|
||||||
resb 256
|
resb 256
|
||||||
stacktop:
|
stacktop:
|
||||||
%else
|
|
||||||
; todo: make FPC create the stack segment in far data models
|
|
||||||
segment stack stack class=stack align=16
|
|
||||||
resb 16384
|
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%ifdef __TINY__
|
%ifdef __TINY__
|
||||||
group dgroup text data bss
|
group dgroup text data bss
|
||||||
%else
|
%else
|
||||||
|
%ifdef __NEAR_DATA__
|
||||||
group dgroup _NULL _AFTERNULL data bss stack
|
group dgroup _NULL _AFTERNULL data bss stack
|
||||||
|
%else
|
||||||
|
group dgroup _NULL _AFTERNULL data bss
|
||||||
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
Loading…
Reference in New Issue
Block a user