From patchwork Thu Sep 13 20:20:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Trippelsdorf X-Patchwork-Id: 183711 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 E19002C0089 for ; Fri, 14 Sep 2012 06:20:42 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1348172443; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=E675hLAThmnfTt0vPh5b9Y2MPyo=; b=Cn187xZy1QnmDrn 81F2nD/nh01Kv69Y7OBJHggfUa1ZSHi9/50ER4H5gEQv9s6yIq/oJkrx6i1tvGpM C4huVpezwKx+7BxlDpKMBayV78wnmS5xQ2flBLbKd0m8LTpWkfOgf4yoGhvjffIx pqU0XHTwdHPsEKX2BB5IGoNdjgWw= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=u3v/SxGyQjIZ2k/6ZZvPkEpx+sNkb7JLo4ciNUW8ViJimkGy4Xsd2RymFIquYN //ExZFropSkciUOYKHYkJUc0w+PBaNklC96xxAx1t5zoV8k3Nyd+d9DJVlq4vNDj cUvki4OR78BUJ6gC4GG1XrdRWCwM3PkZfhLICoupXx3mY=; Received: (qmail 19086 invoked by alias); 13 Sep 2012 20:20:31 -0000 Received: (qmail 19072 invoked by uid 22791); 13 Sep 2012 20:20:26 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from ud10.udmedia.de (HELO mail.ud10.udmedia.de) (194.117.254.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Sep 2012 20:20:08 +0000 Received: (qmail 28253 invoked from network); 13 Sep 2012 22:20:06 +0200 Received: from unknown (HELO x4) (ud10?360p3@91.65.91.246) by mail.ud10.udmedia.de with ESMTPSA (DHE-RSA-AES256-SHA encrypted, authenticated); 13 Sep 2012 22:20:06 +0200 Date: Thu, 13 Sep 2012 22:20:05 +0200 From: Markus Trippelsdorf To: gcc-patches@gcc.gnu.org Subject: [PATCH] Add slim-lto-bootstrap build-config Message-ID: <20120913202005.GA14738@x4> MIME-Version: 1.0 Content-Disposition: inline X-IsSubscribed: yes 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 Because there is no enthusiastic support for a full libtool update, here is a minimal version that adds a new slim-lto-bootstrap build-config. Comments are welcome. Thanks. Tested on x86_64-pc-linux-gnu 2012-09-13 Markus Trippelsdorf * Makefile.in (configure-build-fixincludes): Pass CFLAGS * Makefile.in (configure-fixincludes): Likewise. * config/slim-lto-bootstrap.mk: new build-config * libtool.m4 : Handle slim-lto objects * ltmain.sh: Likewise. diff --git a/Makefile.in b/Makefile.in index 0108162..891168d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2835,6 +2835,7 @@ configure-build-fixincludes: test ! -f $(BUILD_SUBDIR)/fixincludes/Makefile || exit 0; \ $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/fixincludes ; \ $(BUILD_EXPORTS) \ + CFLAGS="$(STAGE_CFLAGS)"; export CFLAGS; \ echo Configuring in $(BUILD_SUBDIR)/fixincludes; \ cd "$(BUILD_SUBDIR)/fixincludes" || exit 1; \ case $(srcdir) in \ @@ -2870,6 +2871,7 @@ all-build-fixincludes: configure-build-fixincludes $(BUILD_EXPORTS) \ (cd $(BUILD_SUBDIR)/fixincludes && \ $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS) \ + CFLAGS="$(STAGE_CFLAGS)" \ $(TARGET-build-fixincludes)) @endif build-fixincludes @@ -7745,6 +7747,7 @@ configure-fixincludes: test ! -f $(HOST_SUBDIR)/fixincludes/Makefile || exit 0; \ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fixincludes ; \ $(HOST_EXPORTS) \ + CFLAGS="$(STAGE_CFLAGS)"; export CFLAGS; \ echo Configuring in $(HOST_SUBDIR)/fixincludes; \ cd "$(HOST_SUBDIR)/fixincludes" || exit 1; \ case $(srcdir) in \ @@ -7779,6 +7782,7 @@ all-fixincludes: configure-fixincludes $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/fixincludes && \ $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) \ + CFLAGS="$(STAGE_CFLAGS)" \ $(TARGET-fixincludes)) @endif fixincludes diff --git a/config/slim-lto-bootstrap.mk b/config/slim-lto-bootstrap.mk new file mode 100644 index 0000000..11d1252 --- /dev/null +++ b/config/slim-lto-bootstrap.mk @@ -0,0 +1,9 @@ +# This option enables slim LTO for stage2 and stage3. + +STAGE2_CFLAGS += -flto=jobserver -fno-fat-lto-objects -frandom-seed=1 +STAGE3_CFLAGS += -flto=jobserver -fno-fat-lto-objects -frandom-seed=1 +STAGE_CFLAGS += -fuse-linker-plugin +STAGEprofile_CFLAGS += -fno-lto +AR = gcc-ar +NM = gcc-nm +RANLIB = gcc-ranlib diff --git a/libtool.m4 b/libtool.m4 index a7f99ac..5754fb1 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -3434,6 +3434,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -4451,7 +4452,7 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler @@ -5517,8 +5518,8 @@ if test "$_lt_caught_CXX_error" != yes; then # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -6495,6 +6496,13 @@ public class foo { }; _LT_EOF ]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +esac + dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then @@ -6543,6 +6551,7 @@ if AC_TRY_EVAL(ac_compile); then fi ;; + *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -6578,6 +6587,7 @@ else fi $RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], diff --git a/ltmain.sh b/ltmain.sh index a03433f..2e09101 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -4980,7 +4980,8 @@ func_mode_link () # @file GCC response files # -tp=* Portland pgcc target processor selection -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*| \ + -O*|-flto*|-fwhopr|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg"