From e46ea682c1aa214ccb59c9871914993c9375e5c2 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 24 Jan 2011 08:54:54 +0100 Subject: Fixing a few templates, and making the various needed functions available. --- os/src/init.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'os/src') diff --git a/os/src/init.c b/os/src/init.c index e69de29..d161355 100644 --- a/os/src/init.c +++ b/os/src/init.c @@ -0,0 +1,23 @@ +#include + +extern void __libc_init_array(void) __attribute__ ((weak)); +extern void __libc_fini_array(void) __attribute__ ((weak)); +extern void exit(int) __attribute__ ((noreturn, weak)); +extern void __main() __attribute__ ((weak)); +extern int main(int, char **, char **); + +void _start() { + if (__libc_init_array) + __libc_init_array(); + + if (__main) + __main(); + + int return_code = main(0, NULL, NULL); + + if (__libc_fini_array) + __libc_fini_array(); + + if (exit) + exit(return_code); +} -- cgit v1.2.3