From daa226c3f23fe7b909f236026f79e5c7d9399e94 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Wed, 6 May 2020 12:59:40 +0900 Subject: [PATCH] libc: Call _exit() after returning from main() --- libc/start.S | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libc/start.S b/libc/start.S index 73ccbee..b874a9c 100644 --- a/libc/start.S +++ b/libc/start.S @@ -3,8 +3,15 @@ .global _start .extern main - .extern exit + .extern _exit _start: call main - jmp _start + + pushl %eax +0: call _exit + + /* we *should* never reach this */ + + movl %eax, (%esp) + jmp 0b -- 2.47.3