From patchwork Sat Feb 12 11:58:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 82901 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1C93FB711D for ; Sat, 12 Feb 2011 22:59:13 +1100 (EST) Received: (qmail 22404 invoked by alias); 12 Feb 2011 11:59:12 -0000 Received: (qmail 22396 invoked by uid 22791); 12 Feb 2011 11:59:10 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 12 Feb 2011 11:59:04 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1CBx2mf018932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 12 Feb 2011 06:59:02 -0500 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1CBwxGA020070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 12 Feb 2011 06:59:01 -0500 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id p1CBww2T007389 for ; Sat, 12 Feb 2011 09:58:59 -0200 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p1CBwvVd027903; Sat, 12 Feb 2011 09:58:57 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id p1CBwt2e027901; Sat, 12 Feb 2011 09:58:55 -0200 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: [PR lto/47225] Check for shared lto-plugin to enable it in GCC Date: Sat, 12 Feb 2011 09:58:55 -0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. I'm checking this in. for ChangeLog from Alexandre Oliva PR lto/47225 * Makefile.def (lto-plugin): Double dash for enable-shared. (configure-gcc): Depend on all-lto-plugin. * Makefile.in: Rebuilt. for lto-plugin/ChangeLog from Alexandre Oliva PR lto/47225 * Makefile.am (gcc_build_dir, in_gcc_libs): New. (liblto_plugin_la_LDFLAGS): Add -module. (copy_lto_plugin): Renamed to... ($(in_gcc_libs)): ... this. Add mkinstalldirs. Skip copying of static modules. * Makefile.in: Rebuild. for gcc/ChangeLog from Alexandre Oliva PR lto/47225 * configure.ac (gcc_cv_lto_plugin): Test for liblto_plugin.la in the current directory. * configure: Rebuilt. Index: lto-plugin/Makefile.am =================================================================== --- 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 +in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib)) # Can be removed when libiberty becomes a normal convenience library Wc=-Wc, @@ -20,13 +22,17 @@ 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) -bindir $(libexecsubdir) \ +liblto_plugin_la_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,) -all: copy_lto_plugin - -copy_lto_plugin: all-am - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $(libexecsub_LTLIBRARIES) `pwd`/../gcc/ +all: $(in_gcc_libs) +$(in_gcc_libs) : $(gcc_build_dir)/%: % + @if test "X`dlname=; . ./$*; echo dlname:$$dlname`" = "Xdlname:"; then \ + echo WARNING: $* is static, not copying to $@ >&2 ; \ + else \ + $(mkinstalldirs) $(gcc_build_dir) && \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $* `pwd`/$@ ; \ + fi Index: lto-plugin/Makefile.in =================================================================== --- lto-plugin/Makefile.in.orig 2011-02-11 13:03:27.777227059 -0200 +++ lto-plugin/Makefile.in 2011-02-12 09:55:20.059528510 -0200 @@ -230,6 +230,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/../include AM_CFLAGS = -Wall -Werror AM_LIBTOOLFLAGS = --tag=disable-static libexecsub_LTLIBRARIES = liblto_plugin.la +gcc_build_dir = ../gcc +in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib)) # Can be removed when libiberty becomes a normal convenience library Wc = -Wc, @@ -238,7 +240,7 @@ 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) -bindir $(libexecsubdir) \ +liblto_plugin_la_LDFLAGS = $(lt_host_flags) -module -bindir $(libexecsubdir) \ $(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a) liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \ @@ -530,10 +532,15 @@ uninstall-am: uninstall-libexecsubLTLIBR tags uninstall uninstall-am uninstall-libexecsubLTLIBRARIES -all: copy_lto_plugin +all: $(in_gcc_libs) -copy_lto_plugin: all-am - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $(libexecsub_LTLIBRARIES) `pwd`/../gcc/ +$(in_gcc_libs) : $(gcc_build_dir)/%: % + @if test "X`dlname=; . ./$*; echo dlname:$$dlname`" = "Xdlname:"; then \ + echo WARNING: $* is static, not copying to $@ >&2 ; \ + else \ + $(mkinstalldirs) $(gcc_build_dir) && \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $* `pwd`/$@ ; \ + fi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. Index: Makefile.def =================================================================== --- Makefile.def.orig 2011-02-11 13:03:27.157240108 -0200 +++ Makefile.def 2011-02-12 09:36:39.291409719 -0200 @@ -146,7 +146,7 @@ host_modules= { module= libtermcap; no_c host_modules= { module= utils; no_check=true; }; host_modules= { module= gnattools; }; host_modules= { module= lto-plugin; bootstrap=true; - extra_configure_flags=-enable-shared; }; + extra_configure_flags=--enable-shared; }; target_modules = { module= libstdc++-v3; bootstrap=true; @@ -322,7 +322,7 @@ dependencies = { module=all-build-fixinc // Host modules specific to gcc. dependencies = { module=configure-gcc; on=configure-intl; }; -dependencies = { module=configure-gcc; on=configure-lto-plugin; }; +dependencies = { module=configure-gcc; on=all-lto-plugin; }; dependencies = { module=configure-gcc; on=all-binutils; }; dependencies = { module=configure-gcc; on=all-gas; }; dependencies = { module=configure-gcc; on=all-ld; }; Index: Makefile.in =================================================================== --- Makefile.in.orig 2011-02-11 13:03:27.300237097 -0200 +++ Makefile.in 2011-02-12 09:36:39.786384536 -0200 @@ -45248,7 +45248,7 @@ configure-lto-plugin: libsrcdir="$$s/lto-plugin"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} $${srcdiroption} -enable-shared \ + --target=${target_alias} $${srcdiroption} --enable-shared \ || exit 1 @endif lto-plugin @@ -45283,7 +45283,7 @@ configure-stage1-lto-plugin: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ $(STAGE1_CONFIGURE_FLAGS) \ - -enable-shared + --enable-shared @endif lto-plugin-bootstrap .PHONY: configure-stage2-lto-plugin maybe-configure-stage2-lto-plugin @@ -45317,7 +45317,7 @@ configure-stage2-lto-plugin: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - -enable-shared + --enable-shared @endif lto-plugin-bootstrap .PHONY: configure-stage3-lto-plugin maybe-configure-stage3-lto-plugin @@ -45351,7 +45351,7 @@ configure-stage3-lto-plugin: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - -enable-shared + --enable-shared @endif lto-plugin-bootstrap .PHONY: configure-stage4-lto-plugin maybe-configure-stage4-lto-plugin @@ -45385,7 +45385,7 @@ configure-stage4-lto-plugin: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - -enable-shared + --enable-shared @endif lto-plugin-bootstrap .PHONY: configure-stageprofile-lto-plugin maybe-configure-stageprofile-lto-plugin @@ -45419,7 +45419,7 @@ configure-stageprofile-lto-plugin: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - -enable-shared + --enable-shared @endif lto-plugin-bootstrap .PHONY: configure-stagefeedback-lto-plugin maybe-configure-stagefeedback-lto-plugin @@ -45453,7 +45453,7 @@ configure-stagefeedback-lto-plugin: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - -enable-shared + --enable-shared @endif lto-plugin-bootstrap @@ -60266,14 +60266,14 @@ configure-stage3-gcc: maybe-configure-st configure-stage4-gcc: maybe-configure-stage4-intl configure-stageprofile-gcc: maybe-configure-stageprofile-intl configure-stagefeedback-gcc: maybe-configure-stagefeedback-intl -configure-gcc: maybe-configure-lto-plugin +configure-gcc: maybe-all-lto-plugin -configure-stage1-gcc: maybe-configure-stage1-lto-plugin -configure-stage2-gcc: maybe-configure-stage2-lto-plugin -configure-stage3-gcc: maybe-configure-stage3-lto-plugin -configure-stage4-gcc: maybe-configure-stage4-lto-plugin -configure-stageprofile-gcc: maybe-configure-stageprofile-lto-plugin -configure-stagefeedback-gcc: maybe-configure-stagefeedback-lto-plugin +configure-stage1-gcc: maybe-all-stage1-lto-plugin +configure-stage2-gcc: maybe-all-stage2-lto-plugin +configure-stage3-gcc: maybe-all-stage3-lto-plugin +configure-stage4-gcc: maybe-all-stage4-lto-plugin +configure-stageprofile-gcc: maybe-all-stageprofile-lto-plugin +configure-stagefeedback-gcc: maybe-all-stagefeedback-lto-plugin configure-gcc: maybe-all-binutils configure-stage1-gcc: maybe-all-stage1-binutils Index: gcc/configure =================================================================== --- gcc/configure.orig 2011-02-11 13:03:48.589789093 -0200 +++ gcc/configure 2011-02-12 09:41:32.119525999 -0200 @@ -23125,7 +23125,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker plugin support" >&5 $as_echo_n "checking linker plugin support... " >&6; } gcc_cv_lto_plugin=no -if test -f ../lto-plugin/Makefile ; then +if test -f liblto_plugin.la; then if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET=" = x"$gcc_cv_ld"; then if test x"$ld_is_gold" = xyes; then gcc_cv_lto_plugin=yes Index: gcc/configure.ac =================================================================== --- gcc/configure.ac.orig 2011-02-11 13:03:26.999243431 -0200 +++ gcc/configure.ac 2011-02-12 09:41:08.829708396 -0200 @@ -3174,7 +3174,7 @@ fi AC_MSG_CHECKING(linker plugin support) gcc_cv_lto_plugin=no -if test -f ../lto-plugin/Makefile ; then +if test -f liblto_plugin.la; then if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET=" = x"$gcc_cv_ld"; then if test x"$ld_is_gold" = xyes; then gcc_cv_lto_plugin=yes