Patchwork [PR,lto/47225] Check for shared lto-plugin to enable it in GCC

login
register
mail settings
Submitter Ralf Wildenhues
Date Feb. 12, 2011, 1:23 p.m.
Message ID <20110212132359.GA29282@gmx.de>
Download mbox | patch
Permalink /patch/82904/
State New
Headers show

Comments

Ralf Wildenhues - Feb. 12, 2011, 1:23 p.m.
Hi Alexandre,

* Alexandre Oliva wrote on Sat, Feb 12, 2011 at 12:58:55PM CET:
> Depending on various platform-specific details and including configure
> options, lto-plugin may be built as a static module, in which case GCC
> must not be configured to require the lto plugin, because it won't work.
> 
> This patch fixes this problem, installing the lto-plugin in gcc/ only if
> it was build as a dynamic library, arranging for gcc to be configured
> only after lto-plugin is built (and perhaps copied into gcc/), and using
> the installed plugin to test within gcc's configure whether the plugin
> is to be configured.

Thank you! for addressing this issue.

Looking at the patch again, I see two small nits:

> --- lto-plugin/Makefile.am.orig	2011-02-11 13:03:27.460233730 -0200
> +++ lto-plugin/Makefile.am	2011-02-12 09:55:10.657012631 -0200
> @@ -12,6 +12,8 @@ AM_CFLAGS = -Wall -Werror
>  AM_LIBTOOLFLAGS = --tag=disable-static
>  
>  libexecsub_LTLIBRARIES = liblto_plugin.la
> +gcc_build_dir = ../gcc

This isn't true for an in-tree build, where gcc could be in
host-$host/gcc.

> +all: $(in_gcc_libs)

This target should be all-local instead of all, as per 'info Automake
Extending', so as to not overwrite the automake-generated all rule.

I'm currently testing this patch, and will push later when it works.

Thanks,
Ralf

Fix minor build system issues in lto-plugin.

lto-plugin/:
	* Makefile.am (all-local): Rename from 'all'.
	(gcc_build_dir): Use $(host_subdir).
	* Makefile.in: Regenerate.

Patch

diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
index fd9ea62..4067c43 100644
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -12,7 +12,7 @@  AM_CFLAGS = -Wall -Werror
 AM_LIBTOOLFLAGS = --tag=disable-static
 
 libexecsub_LTLIBRARIES = liblto_plugin.la
-gcc_build_dir = ../gcc
+gcc_build_dir = ../$(host_subdir)/gcc
 in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib))
 
 # Can be removed when libiberty becomes a normal convenience library
@@ -27,7 +27,7 @@  liblto_plugin_la_LDFLAGS = $(lt_host_flags) -module -bindir $(libexecsubdir) \
 liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \
 	../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,)
 
-all: $(in_gcc_libs)
+all-local: $(in_gcc_libs)
 
 $(in_gcc_libs) : $(gcc_build_dir)/%: %
 	@if test "X`dlname=; . ./$*; echo dlname:$$dlname`" = "Xdlname:"; then \