Subject: gcc gotcha on netbsd-1-3 branch?
To: matthew green <mrg@eterna.com.au>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 11/11/1998 01:05:51
>hi folks.
>
>i'm trying to update my stable pmax machines at work to NetBSD 1.3 branch
>via source, and i found that after i installed new libraries, i needed a
>new gcc because it was not linking crtbeginS.o for static binaries, and so
>crt0.o was not finding fini() and init().
>
>things seem OK since i installed a new gcc, which was OK to do since that
>i hadn't broken dynamic links. :)
>
>is this a known problem?  we should probably document it somewhere.

Short answer: yes, and yes.

Its a known problem. well, Simon and Michael and I know :->. part of
the fixes for c++ constructors is to use the standard ELF helpers
(crtbegin/crtend for the mian program, and crtbeginS/crtendS for
shared libs). the other part is to update teh compiler. so you really
need to bootsrap the updated gcc and install it before starting.


The flip side of the same coin comes when you build with $DESTDIR set:
that turns on -nostdlib, which turns off GCC's auto-magic inclusion of
crtbegin.o/crtend.o.

/usr/share/mk/bsd.lib.mk has hooks to add those files back excpllity,
as $DESTDIR/usr/lib/crt<foo>. That wasnt being done for mips --
because the .ctor/.dtor sections had never worked.

The 1.3.3 makefiles do it, though, so if you install the updated 1.3.3
Makefiles into your `real' system before doing the make, and build
with DESTDIR set (which I always recommend), then it should Just Work.
(thats in addition to updatign gcc before starting!)

But, yes, the compiler changed in pretty basic ways, and you should
rebuild gcc and install it onto your `live' 1.3.x system before trying
to update to 1.3.3 from source.  Otherwise you'll just have to remake
the libraries yet again.  Since you _have_ to compile libg++ with the
new compiler to get the C++ ctor/dtor fixes to work. 

The updated compiler emits .ctor and .dtor directives correctly.  the
old 1.3.2 compiler did not, and that was the root cause of the problem.


Is there a "standard" place to document source-ugprade lossage--
other than messages here?