diff options
author | Marvin Borner | 2021-04-04 00:11:57 +0200 |
---|---|---|
committer | Marvin Borner | 2021-04-04 00:11:57 +0200 |
commit | acffb01f7a8474d4adf82049690380d63faba782 (patch) | |
tree | c593a6d7e4c71b793e3d806348f75ede663f36a1 /libs | |
parent | 7a64bdbbcf14023370b90b22de73c2f61a6f84ac (diff) |
Added missing crt files
Diffstat (limited to 'libs')
-rw-r--r-- | libs/libc/crt/crt0.asm | 15 | ||||
-rw-r--r-- | libs/libc/crt/crt0.c | 18 | ||||
-rw-r--r-- | libs/libc/crt/crti.asm | 9 | ||||
-rw-r--r-- | libs/libc/crt/crtn.asm | 7 |
4 files changed, 34 insertions, 15 deletions
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 <def.h> +#include <sys.h> + +#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 |