freebsd-src/lib/csu/i386
John Polstra d5489b0d8f Check the count in the first word of __CTOR_LIST__ before executing
the loop that invokes the static constructors.  That makes it safe
to link c++rt0.o into any shared library, even one that does not
have any static constructors.  Formerly, doing that would cause a
bus error.  If the library has no static constructors, __CTOR_LIST__
comes out as a simple 4-byte COMMON region, and it does not have
the usual NULL word that terminates the list of constructors.  This
caused the old code to "call" a garbage address via the non-existent
entry __CTOR_LIST__[1].

The analogous code that invokes the static destructors was already safe.

This change is fully backward-compatible.

Reviewed by:	dfr@render.com (Doug Rabson)
1996-01-15 17:53:25 +00:00
..
c++rt0.c Check the count in the first word of __CTOR_LIST__ before executing 1996-01-15 17:53:25 +00:00
crt0.c Remove my locale hack. Sigh. 1995-11-02 12:42:42 +00:00
dlfcn.h Add two parts of Mark's/Gary's dlopen() changes that I missed before. 1995-02-08 17:56:27 +00:00
dlopen.3 Add two parts of Mark's/Gary's dlopen() changes that I missed before. 1995-02-08 17:56:27 +00:00
Makefile Remove my locale hack. Sigh. 1995-11-02 12:42:42 +00:00