diff options
author | H. Peter Anvin <hpa@zytor.com> | 2005-12-12 13:41:17 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2005-12-12 13:41:17 -0800 |
commit | c6b4d9e6249b884c52b1b851a1dbcd95735ccf1c (patch) | |
tree | 4d2050b4eaa3366186b05edf1136b212673c75f5 | |
parent | 82039b135d0bf58b850eef94cc2c0ab01d71d462 (diff) | |
download | klibc-c6b4d9e6249b884c52b1b851a1dbcd95735ccf1c.tar.gz |
Ignore onexit pointer; causes more harm than goodklibc-1.1.4
-rw-r--r-- | klibc/libc_init.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/klibc/libc_init.c b/klibc/libc_init.c index 081eb44b6eef3..93834148b5880 100644 --- a/klibc/libc_init.c +++ b/klibc/libc_init.c @@ -12,6 +12,13 @@ * void (*onexit)(void) -- Function to install into onexit */ +/* + * Several Linux ABIs don't pass the onexit pointer, and the ones that + * do never use it. Therefore, unless USE_ONEXIT is defined, we just + * ignore the onexit pointer. + */ +/* #define USE_ONEXIT */ + #include <stddef.h> #include <stdlib.h> #include <stdint.h> @@ -32,8 +39,6 @@ struct auxentry { uintptr_t v; }; -static struct atexit at_exit; - __noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) { int argc; @@ -48,13 +53,17 @@ __noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) #endif unsigned int page_size = 0, page_shift = 0; +#ifdef USE_ONEXIT if ( onexit ) { + static struct atexit at_exit; + at_exit.fctn = (void(*)(int, void *))onexit; /* at_exit.next = NULL already */ __atexit_list = &at_exit; } - - (void)onexit; /* For now, we ignore this... */ +#else + (void)onexit; /* Ignore this... */ +#endif argc = (int)*elfdata++; argv = (char **)elfdata; |