From acffb01f7a8474d4adf82049690380d63faba782 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 4 Apr 2021 00:11:57 +0200 Subject: Added missing crt files --- libs/libc/crt/crt0.asm | 15 --------------- libs/libc/crt/crt0.c | 18 ++++++++++++++++++ libs/libc/crt/crti.asm | 9 +++++++++ libs/libc/crt/crtn.asm | 7 +++++++ 4 files changed, 34 insertions(+), 15 deletions(-) delete mode 100644 libs/libc/crt/crt0.asm create mode 100644 libs/libc/crt/crt0.c create mode 100644 libs/libc/crt/crti.asm create mode 100644 libs/libc/crt/crtn.asm (limited to 'libs') diff --git a/libs/libc/crt/crt0.asm b/libs/libc/crt/crt0.asm deleted file mode 100644 index e002952..0000000 --- a/libs/libc/crt/crt0.asm +++ /dev/null @@ -1,15 +0,0 @@ -; MIT License, Copyright (c) 2020 Marvin Borner - -section .text - -extern main -extern exit -extern atexit_trigger - -global _start -_start: - call main - - push eax - call exit - jmp $ diff --git a/libs/libc/crt/crt0.c b/libs/libc/crt/crt0.c new file mode 100644 index 0000000..6c38474 --- /dev/null +++ b/libs/libc/crt/crt0.c @@ -0,0 +1,18 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#include +#include + +#ifdef USER + +extern int main(int, char **); + +void _start(void); +void _start(void) +{ + exit(main(0, NULL)); + while (1) + ; +} + +#endif diff --git a/libs/libc/crt/crti.asm b/libs/libc/crt/crti.asm new file mode 100644 index 0000000..e139704 --- /dev/null +++ b/libs/libc/crt/crti.asm @@ -0,0 +1,9 @@ +global _init +section .init +_init: + push ebp + +global _fini +section .fini +_fini: + push ebp diff --git a/libs/libc/crt/crtn.asm b/libs/libc/crt/crtn.asm new file mode 100644 index 0000000..a593ab0 --- /dev/null +++ b/libs/libc/crt/crtn.asm @@ -0,0 +1,7 @@ +section .init + pop ebp + ret + +section .fini + pop ebp + ret -- cgit v1.2.3