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 /* This function will be called from _init in init-first.c. */
45 __libc_global_ctors (void)
47 /* Call constructor functions. */
48 run_hooks (__CTOR_LIST__
);
49 #ifdef HAVE_DWARF2_UNWIND_INFO
50 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
52 static struct object ob
;
53 __register_frame_info (__EH_FRAME_BEGIN__
, &ob
);
56 __register_frame (__EH_FRAME_BEGIN__
);
62 /* This function becomes the DT_FINI termination function
64 void _fini (void) __attribute__ ((section (".fini"))); /* Just for kicks. */
68 /* Call destructor functions. */
69 run_hooks (__DTOR_LIST__
);
70 #ifdef HAVE_DWARF2_UNWIND_INFO
71 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
72 __deregister_frame_info (__EH_FRAME_BEGIN__
);
74 __deregister_frame (__EH_FRAME_BEGIN__
);