[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: GCC 3.2 on the NetBSD/i386 port



Joel Baker <lucifer@lightbearer.com> writes:

> > /tmp/Build/gcc-3.2/gcc-3.2-3.2ds0/build/i386-unknown-netbsdelf1.6./libstdc++-v3/src/.libs/libstdc++.so: undefined reference to `__dso_handle'
> > /tmp/Build/gcc-3.2/gcc-3.2-3.2ds0/build/i386-unknown-netbsdelf1.6./libstdc++-v3/src/.libs/libstdc++.so: undefined reference to `__cxa_atexit'
> > collect2: ld returned 1 exit status
[...]
> So. Given that this clearly appears to be a workaround, that this was in
> 3.0 or 3.1, and that it must have been removed for good reason (like, it
> was itself a workaround to a different flaw) - what is the best way to
> address this? Is there something in userland that can be tweaked to cope
> with this, or is this an issue with using NetBSD's libc?

It isn't that easy to answer. Are these messages from the static
linker (ld(1)) or the dynamic linker (ld.so.1(1))? If the static
linker, what binutils version?

We have to consider __dso_handle and __cxa_atexit separately. For
__dso_handle, can you tell whether HAVE_GAS_HIDDEN is defined?

For __cxa_atexit, it appears that gcc does not provide a replacement
implementation if the C library does not provide a definition. Can you
tell whether libc has a definition for __cxa_atexit? If not, it would
be a good thing to encourage the NetBSD authors to provide one. This
is a really useful facility; it unfortunately requires close
integration into the atexit facility, so it can't really be replaced
from the ouside. If possible, you should consider hacking libgcc_s.so
to provide a cxa_atexit implementation that interworks with libc.so's
atexit.

If there is indeed no __cxa_atexit on your system, you have to build
gcc without that. Notice that --enable-__cxa_atexit is new in gcc
3.2. On Linux, using this is always the right thing (since glibc 2.1
or so); that's why it is activated by default.

Regards,
Martin



Reply to: