summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_autoinit.c
blob: 0fdf5ca58e9a216efa206ca1e7e7d9c821d54915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

#include <stdio.h>
#include <pthread.h>
#include "pthread_private.h"

extern void _thread_init __P((void));

#ifdef __cplusplus
/*
 * Use C++ static initialiser
 */
class Init {
public:
	Init() { _thread_init(); }
};
Init _thread_initialiser;
#endif /* C++ */

/*
 * a.out ld.so initialisation
 */
extern void _thread_dot_init __P((void)) asm(".init");
void 
_thread_dot_init()
{ 
	_thread_init();
}

#ifdef mips
/*
 * elf ld.so initialisation
 */
extern int _init() __attribute__((constructor,section (".dynamic")));
int 
_init()
{ 
	_thread_init();
	return 0; 
}
#endif /* mips */

#ifdef _GNUC_
/*
 * GNU CTOR_LIST constructor
 */
void _thread_init_constructor __P((void)) __attribute__((constructor));
void
_thread_init_constructor()
{
	_thread_init();
}
#endif /* GNU C */

/*
 * Dummy symbol referenced by uthread_init.o so this compilation unit 
 * is always loaded.
 */
int _thread_autoinit_hook = 0;