Patchwork PATCH RFA: Set poststage1_ldflags for all builds

login
register
mail settings
Submitter Ian Taylor
Date Nov. 16, 2010, 1:16 a.m.
Message ID <mcr39r2cblb.fsf@google.com>
Download mbox | patch
Permalink /patch/71323/
State New
Headers show

Comments

Ian Taylor - Nov. 16, 2010, 1:16 a.m.
Since nobody seemed to like the idea of testing whether the C++ compiler
supports the -static-libstdc++ option, how do people feel about this
approach.  This changes the default for --with-poststage1-ldflags to be
"-static-libstdc++ -static-libgcc".  Currently that is the default when
--enable-build-with-cxx is used.  This patch changes that to be the
default in all cases.

The -static-libstdc++ option has no effect when not building with the
g++ driver.  The -static-libgcc option will, of course, have an effect,
for some hosts (though not x86 hosts).  I would argue that that effect
will be beneficial.

The problem I'm trying to avoid is somebody doing a typical build of
gcc.  On a host where gcc needs something from libgcc_s.so, this will
cause the installed gcc to depend on the $(prefix)/lib/libgcc_s.so.
That is fine if that directory is in the default library search path,
potentially troublesome otherwise.

It's rarely a problem for libgcc_s.so, because the ABI is stable and gcc
does not use any of the newer versions.  It's frequently a problem for
libstdc++.so, in which a program linked against one version of
libstdc++.so generally will not run with an older version.  That's why
this is the default for --enable-build-with-cxx.

The reason I would like to make this the default in all cases is of
course for the Go frontend.

I'm testing a bootstrap both with and without --enable-build-with-cxx.
Is this patch OK for mainline if both bootstraps succeed?  Thanks.

Ian


2010-11-15  Ian Lance Taylor  <iant@google.com>

	* configure.ac: Don't test $ENABLE_BUILD_WITH_CXX when setting
	default value for --with-boot-ldflags.
	* configure: Rebuild.

2010-11-15  Ian Lance Taylor  <iant@google.com>

	* doc/install.texi (Configuration): Update default for
	--with-boot-ldflags.

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 166769)
+++ configure.ac	(working copy)
@@ -1524,10 +1524,10 @@  AC_ARG_WITH(boot-ldflags,
    poststage1_ldflags=$withval
  fi],
 [poststage1_ldflags=
- # With --enable-build-with-cxx, default to linking libstdc++ and
- # libgcc statically.  But if the user explicitly specified the
- # libraries to use, trust that they are doing what they want.
- if test "$ENABLE_BUILD_WITH_CXX" = "yes" -a "$poststage1_libs" = ""; then
+ # In stages 2 and 3, default to linking libstdc++ and libgcc
+ # statically.  But if the user explicitly specified the libraries to
+ # use, trust that they are doing what they want.
+ if test "$poststage1_libs" = ""; then
    poststage1_ldflags="-static-libstdc++ -static-libgcc"
  fi])
 AC_SUBST(poststage1_ldflags)
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 166769)
+++ gcc/doc/install.texi	(working copy)
@@ -1611,8 +1611,9 @@  of GCC.  These are also used when linkin
 
 @item --with-boot-ldflags=@var{flags}
 This option may be used to set linker flags to be used when linking
-stage 2 and later when bootstrapping GCC.  By default no special flags
-are used.
+stage 2 and later when bootstrapping GCC.  If neither --with-boot-libs
+nor --with-host-libstdcxx is set to a value, then the default is
+@samp{-static-libstdc++ -static-libgcc}.
 
 @item --with-boot-libs=@var{libs}
 This option may be used to set libraries to be used when linking stage 2