This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.
to 2. This makes them agree with the declarations in libgcc, and
clears the way once again for linking c++rt0.o into all libraries,
and eliminating CPLUSPLUSLIB from <bsd.lib.mk>. (I have not made
that change yet, because there is still a bootstrapping problem
for "make world".)
Also, removed a check which ensured that the constructor count in
the first word of __CTOR_LIST__ was greater than zero before
traversing the list. I had added that check earlier, but it is no
longer necessary, now that there is guaranteed to be at least 2
words in __CTOR_LIST__.
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)
on dlclose. Also correctly call constructors and destructors for libraries
linked with /usr/lib/c++rt0.o.
Change interpretation of dlopen manpage to call _init() rather than init()
for dlopened objects.
Change c++rt0.o to avoid using atexit to call destructors, allowing dlclose to
call destructors when an object is unloaded.
Change interface between crt0 and ld.so to allow crt0 to call a function on
exit to call destructors for shared libraries explicitly.
These changes are backwards compatible. Old binaries will work with the new
ld.so and new binaries will work with the old ld.so. A version number has
been introduced in the crt0-ld.so interface to allow for future changes.
Reviewed by: GAWollman, Craig Struble <cstruble@singularity.bevc.blacksburg.va.us>
This fixes the problems Warner's having with ctors not being called
again with the latest round of ld changes and updates the file-names to what
Paul is using now.
The name change will not affect anything as we are not (yet) using it.