This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++ libtool lossage


On Feb 23, 2002, Mark Mitchell <mark@codesourcery.com> wrote:

> gcc and g++ handled "-shared" differently because it was thought that
> C users would benefit from not having to deal with the shared libgcc,

No, they didn't, but they do now, on GNU/Linux, if you have a recent
enough version of GNU ld.

Also, -shared used to link in both the shared and the static libgcc,
but this caused problems on AIX, so the meaning of -shared was
changed recently.  Then, it was changed again in the past few days to
allow for the optimization on GNU/Linux, that allows C shared
libraries to not be linked with the shared libgcc.

> 1. Why are we doing anything?  What is the problem that we started
>    trying to solve last week?  What goes wrong?

The problem was that, since the change above, that made -shared not
link the shared libgcc in when linking with gcc (as opposed to g++),
libstdc++ and libjava stopped being linked with the shared libgcc,
which would break EH.  So RTH asked me to find a way to get them
linked using -shared-libgcc, that would revert both libstdc++ and
libjava to the original state, which I did.  But then, it broke AIX,
because the change that modified -shared such that it would not link
in the static libgcc, as required by AIX, did not change
-shared-libgcc accordingly, so linking with -shared -shared-libgcc is
incorrect on AIX.

> 2. How have we tried to solve it thus far?  What changes have we
>    made, why have we made them, and what to they do?

I've arranged to have -shared-libgcc added to the link commands of
libstdc++-v3 and libjava, such that they would be linked with the
shared libgcc, as requested by RTH.  But this broke AIX, so David
wrote a patch that arranged for -shared-libgcc to no link in the
static libgcc, but this broke some tests in the automated regression
tester because some programs depended on symbols that were only
defined in the static libgcc.

I have since suggested that -shared-libgcc and -static-libgcc might
have different meanings depending on the presence or absence of
-shared.  Even though I realize my original suggestion, as I wrote it,
would defeat the optimization intended for GNU/Linux, I see the
general idea as the only possibility in fixing the problem such that
we get correct behavior on both GNU/Linux and AIX.  Basically, the
idea is to arrange the specs like this (-lgcc_eh omitted):

%{!shared:%{shared-libgcc: $shared_name $static_name}
          %{!shared-libgcc: $static_name $eh_name}}
%{shared:%{shared-libgcc: $shared_name}
         %{static-libgcc: $static_name}
         %{!shared-libgcc:%{!static-libgcc:
#ifdef LINK_EH_SPEC
           $shared_name
#else
           $static_name
#endif
         }}}

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


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