minix/lib/csu
Lionel Sambuc 9152e1c5a7 Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
 * tools
 * distribution
 * sets
 * release

The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.

For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.

Regarding new or modifications of Makefiles a few things:
 * Read share/mk/bsd.README
 * If you add a subdirectory, add a Makefile in it, and have it called
   by the parent through the SUBDIR variable.
 * Do not add arbitrary inclusion which crosses to another branch of
   the hierarchy; If you can't do without it, put a comment on why.
   If possible, do not use inclusion at all.
 * Use as much as possible the infrastructure, it is here to make
   life easier, do not fight it.

Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-11-15 16:07:29 +01:00
..
alpha switch to netbsd csu 2012-04-12 13:26:24 +02:00
arch switch to netbsd csu 2012-04-12 13:26:24 +02:00
arm_elf switch to netbsd csu 2012-04-12 13:26:24 +02:00
common Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
common_elf Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
hppa switch to netbsd csu 2012-04-12 13:26:24 +02:00
ia64 switch to netbsd csu 2012-04-12 13:26:24 +02:00
m68k_elf switch to netbsd csu 2012-04-12 13:26:24 +02:00
mips switch to netbsd csu 2012-04-12 13:26:24 +02:00
powerpc switch to netbsd csu 2012-04-12 13:26:24 +02:00
powerpc64 switch to netbsd csu 2012-04-12 13:26:24 +02:00
sh3_elf switch to netbsd csu 2012-04-12 13:26:24 +02:00
sparc64 switch to netbsd csu 2012-04-12 13:26:24 +02:00
sparc_elf switch to netbsd csu 2012-04-12 13:26:24 +02:00
vax_elf switch to netbsd csu 2012-04-12 13:26:24 +02:00
Makefile Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
README switch to netbsd csu 2012-04-12 13:26:24 +02:00

Overview of the common runtime support

The common runtime support contains two modules, crtbegin and crtend.
crtbegin is linked before all other object files of the program or
dynamic library, crtend after all other object files.  They frame the
lists of constructors, destructors, Java types and exception handling frames.

If done correctly, crtend contains no code and is therefore position
independent.  crtendS.o is therefore just a link to crtend.o.

crtbegin should be position-independent code.  crtbeginT.o doesn't have
to be PIC as it is statically linked.  The overhead is generally not
worth the trouble though.


Section types:
.ctor: writeable
.dtor: writeable
.eh_frame: read-only if platform allows mixing read-only and read-write
sections.  This is supported by GNU ld.
.jcr: writeable
.init: executable
.fini: executable


Non-local symbols:

Weak references:
- _Jv_RegisterClasses,
- __cxa_finalize (crtbeginS.o)
- __deregister_frame_info
- __register_frame_info

Hidden:
- __dso_handle: pointer to self for crtbeginS.o, NULL otherwise.
- __CTOR_LIST_END__


Initialisation (called from .init):

1.  Check that the init code hasn't started already, otherwise bail out.
2.  If __register_frame_info is NULL, skip to 4
3.  Call __register_frame_info with start of .eh_frame as first argument
    and a data object of at least 8 pointers as second argument.
4:  If _Jv_RegisterClasses is NULL, skip to 6
5:  Call _Jv_RegisterClasses with the first pointer of the .jcr section
    as argument.
6:  Iterate from the end of the .ctor section to the start.  Skip the
    terminating NULL and stop when reaching the starting (void *)-1 element.
    Call the pointers as void (*)(void) functions.


Deinitialisation (called from .fini):

1.  Check if the init code has already started, otherwise bail out.
2.  If this is not crtbeginS.o or __cxa_finalize is NULL, skip to 4.
3.  Call __cxa_finalize with a pointer into this Dynamic Shared Object (DSO)
    as first argument.
4.  Iterate from the start of the .dtor section to the send.  Skip the
    initial (void *)-1 and stop when reaching the terminating NULL element.
    Call the pointers as void (*)(void) functions.
5.  If __deregister_frame_info is NULL, return.
6.  Call __deregister_frame_info with the start of .eh_frame as the argument.