1Overview of the common runtime support 2 3The common runtime support contains two modules, crtbegin and crtend. 4crtbegin is linked before all other object files of the program or 5dynamic library, crtend after all other object files. They frame the 6lists of constructors, destructors, Java types and exception handling frames. 7 8If done correctly, crtend contains no code and is therefore position 9independent. crtendS.o is therefore just a link to crtend.o. 10 11crtbegin should be position-independent code. crtbeginT.o doesn't have 12to be PIC as it is statically linked. The overhead is generally not 13worth the trouble though. 14 15 16Section types: 17.ctor: writeable 18.dtor: writeable 19.eh_frame: read-only if platform allows mixing read-only and read-write 20sections. This is supported by GNU ld. 21.jcr: writeable 22.init: executable 23.fini: executable 24 25 26Non-local symbols: 27 28Weak references: 29- _Jv_RegisterClasses, 30- __cxa_finalize (crtbeginS.o) 31- __deregister_frame_info 32- __register_frame_info 33 34Hidden: 35- __dso_handle: pointer to self for crtbeginS.o, NULL otherwise. 36- __CTOR_LIST_END__ 37 38 39Initialisation (called from .init): 40 411. Check that the init code hasn't started already, otherwise bail out. 422. If __register_frame_info is NULL, skip to 4 433. 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. 454: If _Jv_RegisterClasses is NULL, skip to 6 465: Call _Jv_RegisterClasses with the first pointer of the .jcr section 47 as argument. 486: 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. 51 52 53Deinitialisation (called from .fini): 54 551. Check if the init code has already started, otherwise bail out. 562. If this is not crtbeginS.o or __cxa_finalize is NULL, skip to 4. 573. Call __cxa_finalize with a pointer into this Dynamic Shared Object (DSO) 58 as first argument. 594. 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. 625. If __deregister_frame_info is NULL, return. 636. Call __deregister_frame_info with the start of .eh_frame as the argument. 64