diff options
Diffstat (limited to 'lib/libpthread/uthread/uthread_autoinit.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_autoinit.c | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/lib/libpthread/uthread/uthread_autoinit.c b/lib/libpthread/uthread/uthread_autoinit.c index 5753d434c7f..1601d2098c9 100644 --- a/lib/libpthread/uthread/uthread_autoinit.c +++ b/lib/libpthread/uthread/uthread_autoinit.c @@ -1,23 +1,14 @@ /* * David Leonard, 1998. Public Domain. <david.leonard@csee.uq.edu.au> * - * $OpenBSD: uthread_autoinit.c,v 1.10 2002/02/16 21:27:25 millert Exp $ + * $OpenBSD: uthread_autoinit.c,v 1.11 2003/01/31 04:46:17 marc Exp $ */ + #include <stdio.h> #include <pthread.h> #include "pthread_private.h" -__BEGIN_DECLS -extern void _thread_init(void); -__END_DECLS - -#ifdef DEBUG -#define init_debug(m) stderr_debug( "[init method: " m "]\n") -#else -#define init_debug(m) /* nothing */ -#endif - /* * Use C++'s static instance constructor to initialise threads. */ @@ -25,7 +16,6 @@ __END_DECLS class Init { public: Init() { - init_debug("C++"); _thread_init(); } }; @@ -33,31 +23,17 @@ Init _thread_initialiser; #endif /* C++ */ /* - * The a.out ld.so dynamic linker calls the function - * at symbol ".init" if it exists, just after linkage. + * This construct places the function in the __CTOR_LIST__ entry in the + * object, and later the collect2 stage of linkage will inform __main (from + * libgcc.a) to call it. */ -extern void _thread_dot_init(void) asm(".init"); -void -_thread_dot_init() -{ - init_debug("a.out .init"); - _thread_init(); -} +#if defined(__GNUC__) +extern void _thread_init_constructor(void) __attribute__((constructor)); +extern void _GLOBAL_$I$_thread_init_constructor(void); -/* - * A GNU C installation may know how to automatically run - * constructors for other architectures. (It doesn't matter if - * we initialise multiple times.) This construct places - * the function in the __CTOR_LIST__ entry in the object, and later - * the collect2 stage of linkage will inform __main (from libgcc.a) - * to call it. - */ -#if defined(__GNUC__) /* && defined(notyet) */ /* internal compiler error??? */ -void _thread_init_constructor(void) __attribute__((constructor)); void _thread_init_constructor() { - init_debug("GNU constructor"); _thread_init(); } #endif /* GNU C */ |