This is the mail archive of the 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

	The *DEFAULT* libgcc spec for a configuration supporting shared
libraries prior to my change was:

%{shared-libgcc:-lgcc_s%M libgcc.a%s}
%{static-libgcc:libgcc.a%s libgcc_eh.a%s}
%{!shared-libgcc:%{!static-libgcc:%{!shared:libgcc.a%s libgcc_eh.a%s}}}

	Please follow the logic and show me how -shared would not link
with -lgcc_s.  Remember I said DEFAULT.  Now let's look at what could
affect that...

	The reason that "gcc -shared" did not link with the shared library
on GNU/Linux is because config/linux.h defines

#if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR)
#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "

and gcc.c:init_gcc_specs defines

  p = "%{!shared-libgcc:%{!static-libgcc:%{shared:";
  obstack_grow (obstack, p, strlen (p));
  sprintf (buffer, "%s}}}", static_name);
  sprintf (buffer, "%s}}}", shared_name);

	Note very carefully what happens if LINK_EH_SPEC is defined:
static_name is used.  If LINK_EH_SPEC is not defined, shared_name is used.
LINK_EH_SPEC is causing the problem, not "gcc -shared".  LINK_EH_SPEC
affects whether "gcc -shared" links with -lgcc_s or libgcc.a.

	"gcc -shared" did not link with shared libgcc because linux.h
overrides the normal behavior.  That is the place that you and Richard
should be fixing, not CXX_FOR_TARGET and not using "gcc -shared-libgcc".


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