Force an import of the special symbol __STARTUP__ in the C compiler when

main() is encountered. Define this symbol in the startup code. This will
automatically force linking of the startup code which can then reside inside
the standard library as any other object file.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3988 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2009-07-31 12:05:42 +00:00
parent 66391bfc25
commit 8216bf1d6a
18 changed files with 37 additions and 86 deletions

View File

@@ -46,7 +46,6 @@ apple2lib:
$(MAKE) SYS=apple2 -C $$i || exit 1; \
$(AR) a apple2.lib $$i/*.o;\
done
mv apple2/crt0.o apple2.o
cp apple2/apple2-auxmem.emd a2.auxmem.emd
cp apple2/apple2-stdjoy.joy a2.stdjoy.joy
cp apple2/apple2-stdmou.mou a2.stdmou.mou
@@ -62,7 +61,6 @@ apple2enhlib:
$(MAKE) SYS=apple2enh -C $$i || exit 1; \
$(AR) a apple2enh.lib $$i/*.o;\
done
mv apple2enh/crt0.o apple2enh.o
cp apple2enh/apple2-auxmem.emd a2e.auxmem.emd
cp apple2enh/apple2-stdjoy.joy a2e.stdjoy.joy
cp apple2enh/apple2-stdmou.mou a2e.stdmou.mou
@@ -78,7 +76,6 @@ atarilib:
$(MAKE) SYS=atari -C $$i || exit 1; \
$(AR) a atari.lib $$i/*.o;\
done
mv atari/crt0.o atari.o
cp atari/atari-stdjoy.joy ataristd.joy
cp atari/atari-multijoy.joy atarimj8.joy
@@ -90,7 +87,6 @@ atmoslib:
$(MAKE) SYS=atmos -C $$i || exit 1; \
$(AR) a atmos.lib $$i/*.o;\
done
mv atmos/crt0.o atmos.o
cp atmos/*.tgi .
#-----------------------------------------------------------------------------
@@ -101,7 +97,6 @@ c16lib:
$(MAKE) SYS=c16 -C $$i || exit 1; \
$(AR) a c16.lib $$i/*.o;\
done
mv c16/crt0.o c16.o
cp c16/*.joy .
cp c16/*.emd .
@@ -113,7 +108,6 @@ c64lib:
$(MAKE) SYS=c64 -C $$i || exit 1; \
$(AR) a c64.lib $$i/*.o;\
done
mv c64/crt0.o c64.o
cp c64/*.emd .
cp c64/*.joy .
cp c64/c64-1351.mou .
@@ -130,7 +124,6 @@ c128lib:
$(MAKE) SYS=c128 -C $$i || exit 1; \
$(AR) a c128.lib $$i/*.o;\
done
mv c128/crt0.o c128.o
cp c128/*.emd .
cp c128/*.joy .
cp c128/c128-1351.mou .
@@ -148,7 +141,6 @@ cbm510lib:
$(MAKE) SYS=cbm510 -C $$i || exit 1; \
$(AR) a cbm510.lib $$i/*.o;\
done
mv cbm510/crt0.o cbm510.o
cp cbm510/*.emd .
cp cbm510/cbm510-stdjoy.joy cbm510-std.joy
cp cbm510/cbm510-stdser.ser cbm510-std.ser
@@ -161,7 +153,6 @@ cbm610lib:
$(MAKE) SYS=cbm610 -C $$i || exit 1; \
$(AR) a cbm610.lib $$i/*.o;\
done
mv cbm610/crt0.o cbm610.o
cp cbm610/*.emd .
cp cbm610/cbm610-stdser.ser cbm610-std.ser
@@ -204,7 +195,6 @@ lynxlib:
$(MAKE) SYS=lynx -C $$i || exit 1; \
$(AR) a lynx.lib $$i/*.o;\
done
mv lynx/crt0.o lynx.o
cp lynx/*.joy .
cp lynx/*.tgi .
@@ -216,7 +206,6 @@ neslib:
$(MAKE) SYS=nes -C $$i || exit 1; \
$(AR) a nes.lib $$i/*.o;\
done
mv nes/crt0.o nes.o
cp nes/*.joy .
#-----------------------------------------------------------------------------
@@ -227,7 +216,6 @@ petlib:
$(MAKE) SYS=pet -C $$i || exit 1; \
$(AR) a pet.lib $$i/*.o;\
done
mv pet/crt0.o pet.o
cp pet/*.joy .
#-----------------------------------------------------------------------------
@@ -238,7 +226,6 @@ plus4lib:
$(MAKE) SYS=plus4 -C $$i || exit 1; \
$(AR) a plus4.lib $$i/*.o;\
done
mv plus4/crt0.o plus4.o
cp plus4/*.joy .
cp plus4/*.ser .
@@ -250,7 +237,6 @@ supervisionlib:
$(MAKE) SYS=supervision -C $$i || exit 1; \
$(AR) a supervision.lib $$i/*.o;\
done
mv supervision/crt0.o supervision.o
#-----------------------------------------------------------------------------
# Vic20
@@ -260,7 +246,6 @@ vic20lib:
$(MAKE) SYS=vic20 -C $$i || exit 1; \
$(AR) a vic20.lib $$i/*.o;\
done
mv vic20/crt0.o vic20.o
cp vic20/*.joy .
#-----------------------------------------------------------------------------

View File

@@ -1,10 +1,9 @@
;
; Startup code for cc65 (Apple2 version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import zerobss
.import initlib, donelib
.import callmain, callirq
@@ -40,13 +39,13 @@
; Switch in LC bank 2 for W/O
bit $C081
bit $C081
; Set source start address
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__)
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__)
sta $9B
sty $9C
; Set source last address
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
@@ -68,7 +67,7 @@
ldy #>__ZPSAVE_RUN__
sta $9B
sty $9C
; Set source last address
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__)
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__)
@@ -92,7 +91,7 @@
_exit: ldx #<exit
lda #>exit
jsr reset ; Setup RESET vector
; Switch in ROM in case it wasn't already switched in by a RESET
bit $C082
@@ -159,7 +158,7 @@ init: ldx #zpspace-1
ldx #<_exit
lda #>_exit
jsr reset ; Setup RESET vector
; Setup the stack
lda HIMEM
sta sp

View File

@@ -5,11 +5,10 @@
; Mark Keates
; Freddy Offenga
; Christian Groessler
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.constructor initsp, 26
.import initlib, donelib, callmain

View File

@@ -2,11 +2,10 @@
; Startup code for cc65 (Oric version)
;
; By Debrune J<>r<EFBFBD>me <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib
.import callmain, zerobss
.import __RAM_START__, __RAM_SIZE__, __BSS_LOAD__

View File

@@ -1,10 +1,9 @@
;
; Startup code for cc65 (C128 version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import callirq, initlib, donelib
.import zerobss
.import push0, callmain

View File

@@ -1,13 +1,12 @@
;
; Startup code for cc65 (C16 version)
;
; This must be the *first* file on the linker command line
;
; Note: The C16 is actually the Plus/4 with just 16KB of memory. So many
; things are similar here, and we even use the plus4.inc include file.
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib, callirq
.import callmain, zerobss
.import MEMTOP, RESTOR, BSOUT, CLRCH

View File

@@ -1,10 +1,9 @@
;
; Startup code for cc65 (C64 version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib, callirq
.import zerobss
.import callmain

View File

@@ -1,10 +1,9 @@
;
; Startup code for cc65 (CBM 500 version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import _clrscr, initlib, donelib, callirq_y
.import push0, callmain

View File

@@ -1,10 +1,9 @@
;
; Startup code for cc65 (CBM 600/700 version)
;
; This must be the *first* file on the linker command line
;
.export _exit, BRKVec
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import callirq_y, initlib, donelib
.import push0, callmain

View File

@@ -13,12 +13,11 @@
; code structure. The C stack is located at the end of the RAM memory
; segment and grows downward. Bastian Schick's executable header is put
; on the front of the fully linked binary (see EXEHDR segment.)
;
; This must be the *first* file on the linker command line
;
.include "lynx.inc"
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib
.import zerobss

View File

@@ -3,11 +3,10 @@
;
; by Groepaz/Hitmen <groepaz@gmx.net>
; based on code by Ullrich von Bassewitz <uz@cc65.org>
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib, callmain
.import push0, _main, zerobss, copydata
.import ppubuf_flush

View File

@@ -1,10 +1,9 @@
;
; Startup code for cc65 (PET version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib, callirq
.import zerobss, push0
.import callmain

View File

@@ -1,11 +1,10 @@
;
; Startup code for cc65 (Plus/4 version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.export brk_jmp
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import callirq_y, initlib, donelib
.import callmain, zerobss

View File

@@ -1,10 +1,9 @@
;
; Startup code for cc65 (supervision version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import _main
.import initlib, donelib, copydata

View File

@@ -1,10 +1,9 @@
;
; Startup code for cc65 (Vic20 version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib, callirq
.import zerobss, push0
.import callmain