diff mbox

Use the LTO linker plugin by default

Message ID yddwqfwsr4l.fsf@lokon.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth March 14, 2014, 4:04 p.m. UTC
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

>>> > For this particular case at least.
>>> >
>>> > Note that I'm not against linking against static libgcc_s for
>>> > lto-plugin.  The -static-libstdc++ we use is just because during
>>> > bootstrap picking up the correct libstdc++ was deemed too hard
>>> > to implement and thus the easy way out was -static-libstdc++.
>>> 
>>> So how should we go forward with this issue?  This bootstrap failure is
>>> a regression from all previous releases.  As I said, I'd rather not
>>> duplicate the -static-libgcc test from the toplevel, but would do so if
>>> all else fails.  Perhaps Paolo could weigh in as the build maintainer?
>>
>> Yeah, I'd like a build maintainer to look over your first proposed patch
>> (workaround libtools nicyness).
>
> Just one additional data point: I've checked mainline libtool, and it
> still doesn't handle (meaning: still drops)
> -static-libgcc/-static-libstdc++.  At least they have some hints in
> their documentation on what testing etc. it takes to get additional
> options passed through to the compiler/linker.

I'm now testing this alternative.  So far, I've just manually configured
lto-plugin with CC=cc (Solaris Studio cc, no -static-libgcc) and CC=gcc
and found that -static-libgcc is only used with gcc, as expected.  I've
checked that -static-libgcc is supported as far back as 3.4.6 (probably
even far older), so the $GCC check should be enough.

I'm including it in this weekend's bootstraps on Solaris and Linux.

	Rainer


2014-03-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (ac_lto_plugin_ldflags): Set to -Wc,-static-libgcc
	for gcc.
	* configure: Regenerate.
	* Makefile.am (AM_LDFLAGS): New variable.
	(liblto_plugin_la_LDFLAGS): Add it.
	* Makefile.in: Regenerate.

Comments

Richard Biener March 14, 2014, 4:43 p.m. UTC | #1
On Fri, 14 Mar 2014, Rainer Orth wrote:

> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> 
> >>> > For this particular case at least.
> >>> >
> >>> > Note that I'm not against linking against static libgcc_s for
> >>> > lto-plugin.  The -static-libstdc++ we use is just because during
> >>> > bootstrap picking up the correct libstdc++ was deemed too hard
> >>> > to implement and thus the easy way out was -static-libstdc++.
> >>> 
> >>> So how should we go forward with this issue?  This bootstrap failure is
> >>> a regression from all previous releases.  As I said, I'd rather not
> >>> duplicate the -static-libgcc test from the toplevel, but would do so if
> >>> all else fails.  Perhaps Paolo could weigh in as the build maintainer?
> >>
> >> Yeah, I'd like a build maintainer to look over your first proposed patch
> >> (workaround libtools nicyness).
> >
> > Just one additional data point: I've checked mainline libtool, and it
> > still doesn't handle (meaning: still drops)
> > -static-libgcc/-static-libstdc++.  At least they have some hints in
> > their documentation on what testing etc. it takes to get additional
> > options passed through to the compiler/linker.
> 
> I'm now testing this alternative.  So far, I've just manually configured
> lto-plugin with CC=cc (Solaris Studio cc, no -static-libgcc) and CC=gcc
> and found that -static-libgcc is only used with gcc, as expected.  I've
> checked that -static-libgcc is supported as far back as 3.4.6 (probably
> even far older), so the $GCC check should be enough.

Yeah, only -static-libstdc++ is relatively new.  And we require at least
GCC 3.4.x for bootstrapping anyway.

> I'm including it in this weekend's bootstraps on Solaris and Linux.

Looks good to me, thus ok if the bootstraps work.

Thanks,
Richard.
diff mbox

Patch

# HG changeset patch
# Parent baa4e95100d168dd4133db86c265fd35739647aa
Fix Solaris bootstrap with GNU ld/LTO

diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -9,6 +9,7 @@  libexecsubdir := $(libexecdir)/gcc/$(tar
 
 AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
 AM_CFLAGS = @ac_lto_plugin_warn_cflags@
+AM_LDFLAGS = @ac_lto_plugin_ldflags@
 AM_LIBTOOLFLAGS = --tag=disable-static
 
 libexecsub_LTLIBRARIES = liblto_plugin.la
@@ -22,7 +23,8 @@  liblto_plugin_la_SOURCES = lto-plugin.c
 liblto_plugin_la_LIBADD = \
 	$(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,)
 # Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS
-liblto_plugin_la_LDFLAGS = $(lt_host_flags) -module -bindir $(libexecsubdir) \
+liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) \
+	$(lt_host_flags) -module -bindir $(libexecsubdir) \
 	$(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a)
 liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \
 	../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,)
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -7,6 +7,9 @@  AM_MAINTAINER_MODE
 AC_PROG_CC
 AC_SYS_LARGEFILE
 ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_lto_plugin_warn_cflags])
+# Need -Wc to get it through libtool.
+if test "x$GCC" = xyes; then ac_lto_plugin_ldflags="-Wc,-static-libgcc"; fi
+AC_SUBST(ac_lto_plugin_ldflags)
 AM_PROG_LIBTOOL
 ACX_LT_HOST_FLAGS
 AC_SUBST(target_noncanonical)