README revision 1.1
11.1SjoergOverview of the common runtime support
21.1Sjoerg
31.1SjoergThe common runtime support contains two modules, crtbegin and crtend.
41.1Sjoergcrtbegin is linked before all other object files of the program or
51.1Sjoergdynamic library, crtend after all other object files.  They frame the
61.1Sjoerglists of constructors, destructors, Java types and exception handling frames.
71.1Sjoerg
81.1SjoergIf done correctly, crtend contains no code and is therefore position
91.1Sjoergindependent.  crtendS.o is therefore just a link to crtend.o.
101.1Sjoerg
111.1Sjoergcrtbegin should be position-independent code.  crtbeginT.o doesn't have
121.1Sjoergto be PIC as it is statically linked.  The overhead is generally not
131.1Sjoergworth the trouble though.
141.1Sjoerg
151.1Sjoerg
161.1SjoergSection types:
171.1Sjoerg.ctor: writeable
181.1Sjoerg.dtor: writeable
191.1Sjoerg.eh_frame: read-only if platform allows mixing read-only and read-write
201.1Sjoergsections.  This is supported by GNU ld.
211.1Sjoerg.jcr: writeable
221.1Sjoerg.init: executable
231.1Sjoerg.fini: executable
241.1Sjoerg
251.1Sjoerg
261.1SjoergNon-local symbols:
271.1Sjoerg
281.1SjoergWeak references:
291.1Sjoerg- _Jv_RegisterClasses,
301.1Sjoerg- __cxa_finalize (crtbeginS.o)
311.1Sjoerg- __deregister_frame_info
321.1Sjoerg- __register_frame_info
331.1Sjoerg
341.1SjoergHidden:
351.1Sjoerg- __dso_handle: pointer to self for crtbeginS.o, NULL otherwise.
361.1Sjoerg- __CTOR_LIST_END__
371.1Sjoerg
381.1Sjoerg
391.1SjoergInitialisation (called from .init):
401.1Sjoerg
411.1Sjoerg1.  Check that the init code hasn't started already, otherwise bail out.
421.1Sjoerg2.  If __register_frame_info is NULL, skip to 4
431.1Sjoerg3.  Call __register_frame_info with start of .eh_frame as first argument
441.1Sjoerg    and a data object of at least 8 pointers as second argument.
451.1Sjoerg4:  If _Jv_RegisterClasses is NULL, skip to 6
461.1Sjoerg5:  Call _Jv_RegisterClasses with the first pointer of the .jcr section
471.1Sjoerg    as argument.
481.1Sjoerg6:  Iterate from the end of the .ctor section to the start.  Skip the
491.1Sjoerg    terminating NULL and stop when reaching the starting (void *)-1 element.
501.1Sjoerg    Call the pointers as void (*)(void) functions.
511.1Sjoerg
521.1Sjoerg
531.1SjoergDeinitialisation (called from .fini):
541.1Sjoerg
551.1Sjoerg1.  Check if the init code has already started, otherwise bail out.
561.1Sjoerg2.  If this is not crtbeginS.o or __cxa_finalize is NULL, skip to 4.
571.1Sjoerg3.  Call __cxa_finalize with a pointer into this Dynamic Shared Object (DSO)
581.1Sjoerg    as first argument.
591.1Sjoerg4.  Iterate from the start of the .dtor section to the send.  Skip the
601.1Sjoerg    initial (void *)-1 and stop when reaching the terminating NULL element.
611.1Sjoerg    Call the pointers as void (*)(void) functions.
621.1Sjoerg5.  If __deregister_frame_info is NULL, return.
631.1Sjoerg6.  Call __deregister_frame_info with the start of .eh_frame as the argument.
64