diff options
Diffstat (limited to 'src/user/lib/libc/start.c')
-rw-r--r-- | src/user/lib/libc/start.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/user/lib/libc/start.c b/src/user/lib/libc/start.c index 2521f97..f15f90d 100644 --- a/src/user/lib/libc/start.c +++ b/src/user/lib/libc/start.c @@ -2,7 +2,20 @@ extern int main(char **args); +extern size_t start_ctors, end_ctors, start_dtors, end_dtors; + void start(char **args) { + size_t *call; + + for (call = &start_ctors; call < &end_ctors; call++) { + ((void(*)(void))*call)(); + } + int ret = main(args); + + for (call = &start_dtors; call < &end_dtors; call++) { + ((void(*)(void))*call)(); + } + process_exit(ret); } |