From: Alan Cox Date: Sun, 8 Apr 2018 19:51:21 +0000 (+0100) Subject: crt0: Fix return propogation to exit X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d4390779a220929380e53741ccd026f0ebd39d09;p=FUZIX.git crt0: Fix return propogation to exit Reported by David Given --- diff --git a/Library/libs/crt0.s b/Library/libs/crt0.s index b0ffdcd2..0d4e3032 100644 --- a/Library/libs/crt0.s +++ b/Library/libs/crt0.s @@ -69,9 +69,9 @@ start2: ld hl, #l__DATA - 1 ; work around linker limit push hl ld (___argv), hl ; needed for stuff like err() push de - ld hl, #_exit ; return vector + call _main ; go push hl - jp _main ; go + call _exit .area _GSINIT ; diff --git a/Library/libs/crt0_68000.S b/Library/libs/crt0_68000.S index aba23064..ce04f073 100644 --- a/Library/libs/crt0_68000.S +++ b/Library/libs/crt0_68000.S @@ -17,5 +17,5 @@ _start: move.l a0,environ move.l 4(sp),__argv jsr main - moveq #0,d0 - jmp _exit + move.l d0,-(sp) + jsr _exit diff --git a/Library/libs/crt0nostdio.s b/Library/libs/crt0nostdio.s index 288e2a88..dd3c34a7 100644 --- a/Library/libs/crt0nostdio.s +++ b/Library/libs/crt0nostdio.s @@ -68,9 +68,9 @@ start2: ld hl, #l__DATA - 1 ; work around linker limit push hl ld (___argv), hl ; needed for stuff like err() push de - ld hl, #_exit ; return vector + call _main ; go push hl - jp _main ; go + call _exit .area _GSINIT gsinit: diff --git a/Library/libs/crt0nostdio_68000.S b/Library/libs/crt0nostdio_68000.S index 0ab014d1..3eeecccb 100644 --- a/Library/libs/crt0nostdio_68000.S +++ b/Library/libs/crt0nostdio_68000.S @@ -16,6 +16,6 @@ _start: move.l a0,environ move.l 4(sp),__argv jsr main - moveq #0,d0 - jmp _exit + move.l,d0,-(sp) + call _exit