mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 00:29:33 +02:00
amiga: pascal startup code for 68k and buildrtl refactor
git-svn-id: trunk@35068 -
This commit is contained in:
parent
7eba7122d2
commit
788c622307
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8327,6 +8327,7 @@ rtl/amiga/m68k/execd.inc svneol=native#text/plain
|
||||
rtl/amiga/m68k/execf.inc svneol=native#text/plain
|
||||
rtl/amiga/m68k/m68kamiga.inc svneol=native#text/plain
|
||||
rtl/amiga/m68k/prt0.as svneol=native#text/plain
|
||||
rtl/amiga/m68k/si_prc.pp svneol=native#text/plain
|
||||
rtl/amiga/m68k/utild1.inc svneol=native#text/plain
|
||||
rtl/amiga/m68k/utild2.inc svneol=native#text/plain
|
||||
rtl/amiga/m68k/utilf.inc svneol=native#text/plain
|
||||
|
@ -326,7 +326,7 @@ interface
|
||||
systems_weak_linking = systems_darwin + systems_solaris + systems_linux + systems_android;
|
||||
|
||||
systems_internal_sysinit = [system_i386_linux,system_i386_win32,system_x86_64_win64,
|
||||
system_powerpc64_linux,system_powerpc_morphos]+systems_darwin;
|
||||
system_powerpc64_linux,system_powerpc_morphos,system_m68k_amiga]+systems_darwin;
|
||||
|
||||
{ all systems that use garbage collection for reference-counted types }
|
||||
systems_garbage_collected_managed_types = [
|
||||
|
@ -43,6 +43,7 @@ type
|
||||
public
|
||||
constructor Create; override;
|
||||
procedure SetDefaultInfo; override;
|
||||
procedure InitSysInitUnitName; override;
|
||||
function MakeExecutable: boolean; override;
|
||||
end;
|
||||
|
||||
@ -110,6 +111,12 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
Procedure TLinkerAmiga.InitSysInitUnitName;
|
||||
begin
|
||||
sysinitunit:='si_prc';
|
||||
end;
|
||||
|
||||
|
||||
function TLinkerAmiga.WriteResponseFile(isdll: boolean): boolean;
|
||||
var
|
||||
linkres : TLinkRes;
|
||||
@ -144,8 +151,11 @@ begin
|
||||
|
||||
LinkRes.Add('INPUT (');
|
||||
{ add objectfiles, start with prt0 always }
|
||||
s:=FindObjectFile('prt0','',false);
|
||||
LinkRes.AddFileName(s);
|
||||
if not (target_info.system in systems_internal_sysinit) then
|
||||
begin
|
||||
s:=FindObjectFile('prt0','',false);
|
||||
LinkRes.AddFileName(Unix2AmigaPath(maybequoted(s)));
|
||||
end;
|
||||
while not ObjectFiles.Empty do
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,21 +6,24 @@
|
||||
main=rtl
|
||||
|
||||
[target]
|
||||
loaders=prt0
|
||||
units=$(SYSTEMUNIT) $(RESUNIT) uuchar objpas macpas iso7185 extpas strings \
|
||||
dos heaptrc lineinfo ctypes \
|
||||
sysutils fgl classes math typinfo \
|
||||
charset cpall getopts \
|
||||
types rtlconsts sysconst character \
|
||||
athreads
|
||||
implicitunits=cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
|
||||
loaders=$(LOADERS)
|
||||
units=$(SYSTEMUNIT) $(RESUNIT) uuchar objpas macpas iso7185 extpas buildrtl cpall
|
||||
implicitunits=$(SYSINITUNITS) athreads dos sysutils \
|
||||
ctypes strings rtlconsts sysconst math types \
|
||||
typinfo fgl classes charset character getopts \
|
||||
cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
|
||||
cp437 cp646 cp850 cp856 cp866 cp874 cp8859_1 cp8859_5 cp8859_2 cp852 \
|
||||
unicodedata unicodenumtable
|
||||
# \
|
||||
# exec timer doslib utility hardware inputevent graphics layers \
|
||||
# intuition aboxlib mui \
|
||||
# these can be moved to packages later
|
||||
# clipboard datatypes asl ahi tinygl get9 muihelper \
|
||||
|
||||
# dos heaptrc lineinfo ctypes \
|
||||
# sysutils fgl classes math typinfo \
|
||||
# charset cpall getopts \
|
||||
# types rtlconsts sysconst character \
|
||||
# athreads
|
||||
#implicitunits=cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
|
||||
# cp437 cp646 cp850 cp856 cp866 cp874 cp8859_1 cp8859_5 cp8859_2 cp852 \
|
||||
# unicodedata unicodenumtable
|
||||
|
||||
rsts=math rtlconsts typinfo classes sysconst
|
||||
#implicitunits=exeinfo
|
||||
|
||||
@ -47,7 +50,9 @@ COMMON=$(RTL)/common
|
||||
PROCINC=$(RTL)/$(CPU_TARGET)
|
||||
AMIINC=$(RTL)/amicommon
|
||||
UNITPREFIX=rtl
|
||||
LOADERS=prt0
|
||||
SYSTEMUNIT=system
|
||||
SYSINITUNITS=si_prc
|
||||
|
||||
# Use new feature from 1.0.5 version
|
||||
# that generates release PPU files
|
||||
@ -60,6 +65,7 @@ endif
|
||||
OBJPASDIR=$(RTL)/objpas
|
||||
|
||||
ifeq ($(ARCH),m68k)
|
||||
override LOADERS=
|
||||
RESUNIT=fpextres
|
||||
endif
|
||||
|
||||
@ -99,162 +105,29 @@ prt0$(OEXT) : $(CPU_TARGET)/prt0.as
|
||||
$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
|
||||
$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp $(REDIR)
|
||||
|
||||
uuchar$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(INC)/uuchar.pp
|
||||
$(COMPILER) $(INC)/uuchar.pp
|
||||
heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
|
||||
|
||||
uuchar$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(INC)/uuchar.pp heaptrc$(PPUEXT)
|
||||
$(COMPILER) $(INC)/uuchar.pp
|
||||
|
||||
objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
|
||||
|
||||
strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc \
|
||||
$(PROCINC)/strings.inc $(PROCINC)/stringss.inc \
|
||||
$(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(INC)/strings.pp
|
||||
macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) buildrtl$(PPUEXT) heaptrc$(PPUEXT)
|
||||
$(COMPILER) $(INC)/macpas.pp
|
||||
|
||||
iso7185$(PPUEXT) : $(INC)/iso7185.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
iso7185$(PPUEXT) : $(INC)/iso7185.pp buildrtl$(PPUEXT) heaptrc$(PPUEXT)
|
||||
$(COMPILER) $(INC)/iso7185.pp
|
||||
|
||||
extpas$(PPUEXT) : $(INC)/extpas.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
extpas$(PPUEXT) : $(INC)/extpas.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) heaptrc$(PPUEXT)
|
||||
$(COMPILER) $(INC)/extpas.pp
|
||||
|
||||
#
|
||||
# System Dependent Units
|
||||
#
|
||||
buildrtl$(PPUEXT): buildrtl.pp system$(PPUEXT) objpas$(PPUEXT) heaptrc$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/sysutils -Fi$(OBJPASDIR)/classes -Fu$(CPU_TARGET) -Fu$(PROCINC) -Fu$(AMIINC) -I$(INC) -Fu$(INC) -Fu$(OBJPASDIR) buildrtl
|
||||
|
||||
#ports$(PPUEXT) : ports.pas objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(RESUNIT)$(PPUEXT) : $(INC)/$(RESUNIT).pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -Sg $(INC)/$(RESUNIT).pp
|
||||
|
||||
#doscalls$(PPUEXT) : doscalls.pas strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# TP7 Compatible RTL Units
|
||||
#
|
||||
|
||||
dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
|
||||
$(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(AMIINC)/dos.pp
|
||||
|
||||
#crt$(PPUEXT) : crt.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#objects$(PPUEXT) : $(INC)/objects.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
|
||||
#graph$(PPUEXT) : graph.pp
|
||||
|
||||
#
|
||||
# Delphi Compatible Units
|
||||
#
|
||||
|
||||
sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
|
||||
objpas$(PPUEXT) dos$(PPUEXT) sysconst$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/sysutils $(AMIINC)/sysutils.pp
|
||||
|
||||
classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
|
||||
sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) types$(PPUEXT) fgl$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/classes $(AMIINC)/classes.pp
|
||||
|
||||
typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
|
||||
$(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)
|
||||
|
||||
math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)
|
||||
|
||||
#varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
|
||||
# $(OBJPASDIR)/varutilh.inc varutils.pp
|
||||
# $(COMPILER) -I$(OBJPASDIR) varutils.pp $(REDIR)
|
||||
|
||||
#fmtbcd$(PPUEXT) : $(OBJPASDIR)/fmtbcd.pp objpas$(PPUEXT) sysutils$(PPUEXT) variants$(PPUEXT) classes$(PPUEXT) system$(PPUEXT)
|
||||
# $(COMPILER) $(OBJPASDIR)/fmtbcd.pp
|
||||
|
||||
character$(PPUEXT): sysutils$(PPUEXT) $(OBJPASDIR)/character.pas objpas$(PPUEXT) rtlconsts$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/character.pas
|
||||
|
||||
fgl$(PPUEXT) : $(OBJPASDIR)/fgl.pp objpas$(PPUEXT) types$(PPUEXT) system$(PPUEXT) sysutils$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/fgl.pp
|
||||
|
||||
types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/types.pp
|
||||
|
||||
rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp
|
||||
$(COMPILER) $(OBJPASDIR)/rtlconsts.pp
|
||||
|
||||
sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/sysconst.pp
|
||||
|
||||
dateutil$(PPUEXT) : $(OBJPASDIR)/dateutil.pp
|
||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutil.pp
|
||||
|
||||
#
|
||||
# Mac Pascal Model
|
||||
#
|
||||
|
||||
macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) math$(PPUEXT)
|
||||
$(COMPILER) $(INC)/macpas.pp $(REDIR)
|
||||
|
||||
#
|
||||
# Other system-independent RTL Units
|
||||
#
|
||||
|
||||
ucomplex$(PPUEXT): $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(INC)/ucomplex.pp
|
||||
|
||||
getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(INC)/getopts.pp
|
||||
|
||||
heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
|
||||
|
||||
#lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
# $(COMPILER) $(INC)/lineinfo.pp
|
||||
|
||||
charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(INC)/charset.pp
|
||||
|
||||
cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) charset$(PPUEXT)
|
||||
cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) objpas$(PPUEXT) heaptrc$(PPUEXT)
|
||||
$(COMPILER) -Fu$(INC) -Fi$(RTL)/charmaps $(RTL)/charmaps/cpall.pas
|
||||
|
||||
fpextres$(PPUEXT) : $(INC)/fpextres.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -Sg $(INC)/fpextres.pp
|
||||
|
||||
#
|
||||
# Other system-dependent RTL Units
|
||||
#
|
||||
|
||||
athreads$(PPUEXT) : athreads.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(AMIINC)/athreads.pp
|
||||
|
||||
#exec$(PPUEXT) : exec.pp execf.inc execd.inc
|
||||
|
||||
#timer$(PPUEXT) : timer.pp timerd.inc timerf.inc
|
||||
|
||||
#utility$(PPUEXT) : utility.pp exec$(PPUEXT) utilf.inc utild1.inc utild2.inc
|
||||
|
||||
#doslib$(PPUEXT) : doslib.pp exec$(PPUEXT) timer$(PPUEXT) doslibd.inc doslibf.inc
|
||||
|
||||
#hardware$(PPUEXT): hardware.pas exec$(PPUEXT)
|
||||
|
||||
#inputevent$(PPUEXT): inputevent.pas exec$(PPUEXT) timer$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
#graphics$(PPUEXT): graphics.pas exec$(PPUEXT) utility$(PPUEXT) hardware$(PPUEXT)
|
||||
|
||||
#layers$(PPUEXT) : layers.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
#intuition$(PPUEXT): intuition.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT) \
|
||||
# inputevent$(PPUEXT) timer$(PPUEXT) layers$(PPUEXT)
|
||||
|
||||
#aboxlib$(PPUEXT): aboxlib.pas
|
||||
|
||||
#clipboard$(PPUEXT): clipboard.pas exec$(PPUEXT)
|
||||
|
||||
#datatype$(PPUEXT): datatypes.pas exec$(PPUEXT) doslib$(PPUEXT) intuition$(PPUEXT) \
|
||||
# utility$(PPUEXT) graphics$(PPUEXT)
|
||||
|
||||
#asl$(PPUEXT): asl.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
#ahi$(PPUEXT): ahi.pas exec$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
#mui$(PPUEXT): mui.pas exec$(PPUEXT) utility$(PPUEXT) intuition$(PPUEXT) graphics$(PPUEXT)
|
||||
|
||||
#tinygl$(PPUEXT): tinygl.pp exec$(PPUEXT)
|
||||
|
||||
#get9$(PPUEXT): get9.pas exec$(PPUEXT)
|
||||
|
||||
#muihelper$(PPUEXT): muihelper.pas intuition$(PPUEXT) mui$(PPUEXT) doslib$(PPUEXT) utility$(PPUEXT)
|
||||
|
88
rtl/amiga/m68k/si_prc.pp
Normal file
88
rtl/amiga/m68k/si_prc.pp
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2016 by the Free Pascal development team
|
||||
|
||||
System Entry point for Amiga/68k, Pascal only programs
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
unit si_prc;
|
||||
|
||||
interface
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
AOS_ExecBase: Pointer; public name '_ExecBase';
|
||||
realExecBase: Pointer absolute $4;
|
||||
StkLen: LongInt; external name '__stklen';
|
||||
sysinit_jmpbuf: jmp_buf;
|
||||
ExitCode: LongInt;
|
||||
|
||||
{ the definitions in there need AOS_Execbase }
|
||||
{$include execd.inc}
|
||||
{$include execf.inc}
|
||||
|
||||
var
|
||||
sst: TStackSwapStruct;
|
||||
|
||||
procedure PascalMain; external name 'PASCALMAIN';
|
||||
|
||||
|
||||
{ this function must be the first in this unit which contains code }
|
||||
function _FPC_proc_start: longint; cdecl; public name '_start';
|
||||
var
|
||||
newStack: Pointer;
|
||||
task: PTask;
|
||||
begin
|
||||
AOS_ExecBase:=realExecBase;
|
||||
newStack:=nil;
|
||||
|
||||
task:=FindTask(nil);
|
||||
if (task^.tc_SPUpper-task^.tc_SPLower < StkLen) then
|
||||
begin
|
||||
newStack:=AllocVec(StkLen,MEMF_ANY);
|
||||
|
||||
sst.stk_Lower:=newStack;
|
||||
sst.stk_Upper:=newStack+StkLen;
|
||||
sst.stk_Pointer:=newStack+StkLen;
|
||||
|
||||
StackSwap(@sst);
|
||||
end;
|
||||
|
||||
{ Note: code between the two stackswaps only works because of the
|
||||
nature of the generated code. We're accessing globals which is
|
||||
safe, and the locals are either kept in reg, or accessed via
|
||||
the base pointer (A5), and because we don't use the stack for
|
||||
call arguments, only regs. If this CG behavior changes, this
|
||||
code might break. In that case an asm-written StackSwap+call
|
||||
wrapper code is the solution. (Basically the reimplementation
|
||||
of AROS' NewStackSwap or MorphOS' NewPPCStackSwap.) (KB) }
|
||||
|
||||
if setjmp(sysinit_jmpbuf) = 0 then
|
||||
PascalMain;
|
||||
|
||||
if newStack <> nil then
|
||||
begin
|
||||
StackSwap(@sst);
|
||||
FreeVec(newStack);
|
||||
end;
|
||||
|
||||
_FPC_proc_start:=ExitCode;
|
||||
end;
|
||||
|
||||
procedure _FPC_proc_halt(_ExitCode: longint); cdecl; public name '_haltproc';
|
||||
begin
|
||||
ExitCode:=_ExitCode;
|
||||
longjmp(sysinit_jmpbuf,1);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user