From d4390779a220929380e53741ccd026f0ebd39d09 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 8 Apr 2018 20:51:21 +0100 Subject: [PATCH] crt0: Fix return propogation to exit Reported by David Given --- Library/libs/crt0.s | 4 ++-- Library/libs/crt0_68000.S | 4 ++-- Library/libs/crt0nostdio.s | 4 ++-- Library/libs/crt0nostdio_68000.S | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) 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 -- 2.34.1