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 #include <libc-internal.h>
8 #ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
12 static void (*const __CTOR_LIST__[1]) (void)
13 __attribute__ ((section (".ctors")))
14 = { (void (*) (void)) -1 };
15 static void (*const __DTOR_LIST__[1]) (void)
16 __attribute__ ((section (".dtors")))
17 = { (void (*) (void)) -1 };
20 run_hooks (void (*const list[]) (void))
26 #ifdef HAVE_DWARF2_UNWIND_INFO
27 static char __EH_FRAME_BEGIN__[]
28 __attribute__ ((section (".eh_frame")))
30 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
31 extern void __register_frame_info (const void *, struct object *);
32 extern void __deregister_frame_info (const void *);
34 extern void __register_frame (const void *);
35 extern void __deregister_frame (const void *);
39 /* This function will be called from _init in init-first.c. */
41 __libc_global_ctors (void)
43 /* Call constructor functions. */
44 run_hooks (__CTOR_LIST__);
46 #ifdef HAVE_DWARF2_UNWIND_INFO
47 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
49 static struct object ob;
50 __register_frame_info (__EH_FRAME_BEGIN__, &ob);
53 __register_frame (__EH_FRAME_BEGIN__);
59 /* This function becomes the DT_FINI termination function
61 void _fini (void) __attribute__ ((section (".fini"))); /* Just for kicks. */
65 /* Call destructor functions. */
66 run_hooks (__DTOR_LIST__);
67 #ifdef HAVE_DWARF2_UNWIND_INFO
68 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
69 __deregister_frame_info (__EH_FRAME_BEGIN__);
71 __deregister_frame (__EH_FRAME_BEGIN__);