1 Overview of the common runtime support
3 The common runtime support contains two modules, crtbegin and crtend.
4 crtbegin is linked before all other object files of the program or
5 dynamic library, crtend after all other object files. They frame the
6 lists of constructors, destructors, Java types and exception handling frames.
8 If done correctly, crtend contains no code and is therefore position
9 independent. crtendS.o is therefore just a link to crtend.o.
11 crtbegin should be position-independent code. crtbeginT.o doesn't have
12 to be PIC as it is statically linked. The overhead is generally not
13 worth the trouble though.
19 .eh_frame: read-only if platform allows mixing read-only and read-write
20 sections. This is supported by GNU ld.
29 - _Jv_RegisterClasses,
30 - __cxa_finalize (crtbeginS.o)
31 - __deregister_frame_info
32 - __register_frame_info
35 - __dso_handle: pointer to self for crtbeginS.o, NULL otherwise.
39 Initialisation (called from .init):
41 1. Check that the init code hasn't started already, otherwise bail out.
42 2. If __register_frame_info is NULL, skip to 4
43 3. Call __register_frame_info with start of .eh_frame as first argument
44 and a data object of at least 8 pointers as second argument.
45 4: If _Jv_RegisterClasses is NULL, skip to 6
46 5: Call _Jv_RegisterClasses with the first pointer of the .jcr section
48 6: Iterate from the end of the .ctor section to the start. Skip the
49 terminating NULL and stop when reaching the starting (void *)-1 element.
50 Call the pointers as void (*)(void) functions.
53 Deinitialisation (called from .fini):
55 1. Check if the init code has already started, otherwise bail out.
56 2. If this is not crtbeginS.o or __cxa_finalize is NULL, skip to 4.
57 3. Call __cxa_finalize with a pointer into this Dynamic Shared Object (DSO)
59 4. Iterate from the start of the .dtor section to the send. Skip the
60 initial (void *)-1 and stop when reaching the terminating NULL element.
61 Call the pointers as void (*)(void) functions.
62 5. If __deregister_frame_info is NULL, return.
63 6. Call __deregister_frame_info with the start of .eh_frame as the argument.