This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: binutils 2.9.5.0.5 still trigger the last bug - static libstdc++ required
- To: hjl@lucon.org
- Subject: Re: binutils 2.9.5.0.5 still trigger the last bug - static libstdc++ required
- From: Ian Lance Taylor <ian@zembu.com>
- Date: 7 Aug 1999 21:11:53 -0400
- CC: wwc@rentec.com, jj@sunsite.ms.mff.cuni.cz, binutils@sourceware.cygnus.com, egcs@egcs.cygnus.com
- References: <19990807232112.8522657B9@ocean.lucon.org>
Date: Sat, 7 Aug 1999 16:21:12 -0700 (PDT)
From: hjl@lucon.org (H.J. Lu)
I don't have an easy way to test problems on Solaris, so I'm waiting
for somebody to find the problem or produce a test case I can look at
(i.e., one which does not require building gcc or libstdc++ and which
does not require the Solaris startup files or libraries).
The bug has been in binutils for a while. Ian, Jakub, with "make check"
in ld, I got
FAIL: shared (non PIC)
FAIL: shared (non PIC, load offset)
FAIL: shared (PIC main, non PIC so)
This suggests a bug in handling relocations when generating shared
libraries.
I believe it is related to this bug. When
# g++ -G -o libNope.so libNope.C
is used to generate a DSO, -lstdc++ is passed to ld. If there is no
libstd++.so, libstdc++.a will be used. However, gnu ld doesn't do the
right thing on Solaris/Sparc. Before gnu ld is fixed, the workarounds
are:
1. Use the native ld. Or
2. Use
# gcc -G -o libNope.so libNope.C
instead of
# g++ -G -o libNope.so libNope.C
It is better than putting non PIC code in a shared library. Or
3. Fix g++ such that passing -lstdc++ to ld for -G/-shared when
building shared library only if --enable-shared is used. It doesn't
make any senses to include libstdc++.a for a DSO.
My preferences are 3, 2 and 1. I may work on a patch for 3 if everyone
thinks it is a good idea.
To me it makes perfect sense to include libstdc++.a in a shared
object. Anyhow, it seems silly to patch g++ merely because there is a
bug in ld. We should just fix the bug in ld. A bug like this can't
be hard to fix, especially since the GNU linker used to pass those
tests on Solaris.
Ian