This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: binutils 2.9.5.0.5 still trigger the last bug - static libstdc++ required


   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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]