1 /* Initializer module for building the ELF shared C library. This file and
2 sofini.c do the work normally done by crtbeginS.o and crtendS.o, to wrap
3 the `.ctors' and `.dtors' sections so the lists are terminated, and
4 calling those lists of functions. */
6 static void (*const __CTOR_LIST__
[1]) (void)
7 __attribute__ ((section (".ctors")))
8 = { (void (*) (void)) -1 };
9 static void (*const __DTOR_LIST__
[1]) (void)
10 __attribute__ ((section (".dtors")))
11 = { (void (*) (void)) -1 };
14 run_hooks (void (*const list
[]) (void))
20 #ifdef HAVE_DWARF2_UNWIND_INFO
21 static char __EH_FRAME_BEGIN__
[]
22 __attribute__ ((section (".eh_frame")))
24 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
25 /* This must match what's in frame.h in gcc. How can one do that? */
35 extern void __register_frame_info (const void *, struct object
*);
36 extern void __deregister_frame_info (const void *);
38 extern void __register_frame (const void *);
39 extern void __deregister_frame (const void *);
43 /* We have to initialize the thread library at least if bit. */
44 extern void __pthread_initialize_minimal (void) __attribute__ ((weak
));
46 /* This function will be called from _init in init-first.c. */
48 __libc_global_ctors (void)
50 /* Call constructor functions. */
51 run_hooks (__CTOR_LIST__
);
53 /* Initialize the thread library at least a bit since the libgcc functions
54 are using thread functions if these are available. */
55 if (__pthread_initialize_minimal
)
56 __pthread_initialize_minimal ();
58 #ifdef HAVE_DWARF2_UNWIND_INFO
59 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
61 static struct object ob
;
62 __register_frame_info (__EH_FRAME_BEGIN__
, &ob
);
65 __register_frame (__EH_FRAME_BEGIN__
);
71 /* This function becomes the DT_FINI termination function
73 void _fini (void) __attribute__ ((section (".fini"))); /* Just for kicks. */
77 /* Call destructor functions. */
78 run_hooks (__DTOR_LIST__
);
79 #ifdef HAVE_DWARF2_UNWIND_INFO
80 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
81 __deregister_frame_info (__EH_FRAME_BEGIN__
);
83 __deregister_frame (__EH_FRAME_BEGIN__
);