Home | History | Annotate | Line # | Download | only in csu
README revision 1.1
      1  1.1  joerg Overview of the common runtime support
      2  1.1  joerg 
      3  1.1  joerg The common runtime support contains two modules, crtbegin and crtend.
      4  1.1  joerg crtbegin is linked before all other object files of the program or
      5  1.1  joerg dynamic library, crtend after all other object files.  They frame the
      6  1.1  joerg lists of constructors, destructors, Java types and exception handling frames.
      7  1.1  joerg 
      8  1.1  joerg If done correctly, crtend contains no code and is therefore position
      9  1.1  joerg independent.  crtendS.o is therefore just a link to crtend.o.
     10  1.1  joerg 
     11  1.1  joerg crtbegin should be position-independent code.  crtbeginT.o doesn't have
     12  1.1  joerg to be PIC as it is statically linked.  The overhead is generally not
     13  1.1  joerg worth the trouble though.
     14  1.1  joerg 
     15  1.1  joerg 
     16  1.1  joerg Section types:
     17  1.1  joerg .ctor: writeable
     18  1.1  joerg .dtor: writeable
     19  1.1  joerg .eh_frame: read-only if platform allows mixing read-only and read-write
     20  1.1  joerg sections.  This is supported by GNU ld.
     21  1.1  joerg .jcr: writeable
     22  1.1  joerg .init: executable
     23  1.1  joerg .fini: executable
     24  1.1  joerg 
     25  1.1  joerg 
     26  1.1  joerg Non-local symbols:
     27  1.1  joerg 
     28  1.1  joerg Weak references:
     29  1.1  joerg - _Jv_RegisterClasses,
     30  1.1  joerg - __cxa_finalize (crtbeginS.o)
     31  1.1  joerg - __deregister_frame_info
     32  1.1  joerg - __register_frame_info
     33  1.1  joerg 
     34  1.1  joerg Hidden:
     35  1.1  joerg - __dso_handle: pointer to self for crtbeginS.o, NULL otherwise.
     36  1.1  joerg - __CTOR_LIST_END__
     37  1.1  joerg 
     38  1.1  joerg 
     39  1.1  joerg Initialisation (called from .init):
     40  1.1  joerg 
     41  1.1  joerg 1.  Check that the init code hasn't started already, otherwise bail out.
     42  1.1  joerg 2.  If __register_frame_info is NULL, skip to 4
     43  1.1  joerg 3.  Call __register_frame_info with start of .eh_frame as first argument
     44  1.1  joerg     and a data object of at least 8 pointers as second argument.
     45  1.1  joerg 4:  If _Jv_RegisterClasses is NULL, skip to 6
     46  1.1  joerg 5:  Call _Jv_RegisterClasses with the first pointer of the .jcr section
     47  1.1  joerg     as argument.
     48  1.1  joerg 6:  Iterate from the end of the .ctor section to the start.  Skip the
     49  1.1  joerg     terminating NULL and stop when reaching the starting (void *)-1 element.
     50  1.1  joerg     Call the pointers as void (*)(void) functions.
     51  1.1  joerg 
     52  1.1  joerg 
     53  1.1  joerg Deinitialisation (called from .fini):
     54  1.1  joerg 
     55  1.1  joerg 1.  Check if the init code has already started, otherwise bail out.
     56  1.1  joerg 2.  If this is not crtbeginS.o or __cxa_finalize is NULL, skip to 4.
     57  1.1  joerg 3.  Call __cxa_finalize with a pointer into this Dynamic Shared Object (DSO)
     58  1.1  joerg     as first argument.
     59  1.1  joerg 4.  Iterate from the start of the .dtor section to the send.  Skip the
     60  1.1  joerg     initial (void *)-1 and stop when reaching the terminating NULL element.
     61  1.1  joerg     Call the pointers as void (*)(void) functions.
     62  1.1  joerg 5.  If __deregister_frame_info is NULL, return.
     63  1.1  joerg 6.  Call __deregister_frame_info with the start of .eh_frame as the argument.
     64