From patchwork Thu Oct 11 12:56:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 190905 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 B82C62C008F for ; Thu, 11 Oct 2012 23:59:03 +1100 (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=1350565144; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=wTnekX3YimhDbSWcnFGT eoI2asw=; b=JxZj/gTEu4plb0hB03mjxq9IfkcRMjKG0lll/NJbhZm0fU1h+qWi pIjwTLN4xeQ/+8Z2lrisjVFCi8b352SSGWDMxwluLU23sJO8Mz5pKeet0yy5n+k6 c0DVj79lKJVFBt5VTWDmpPsWEdIFvi/sFq7MmylGlimVz0nLDD3h96k= 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:Received:From:To:Subject:Date:Message-ID:User-Agent:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=SSM8jCD0bsZRcsw2SPBNYsiu4U2luv4vizbL9wiNAlhNZaSFk32NgETd2eYCTH wgt6C5ycW3ZyStSj+XTC5MtG2bUcM1catw5VsjaLw45gdC9h+E7GGNbMeaRpEb0I jKa4Kyn0GAYvPX9PjuSOncNcdT/9jnQ5KjieMDk0kozYo=; Received: (qmail 22764 invoked by alias); 11 Oct 2012 12:58:57 -0000 Received: (qmail 22751 invoked by uid 22791); 11 Oct 2012 12:58:53 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Oct 2012 12:58:48 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id AD882290015 for ; Thu, 11 Oct 2012 14:58:58 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lsJ9NMHQsuPa for ; Thu, 11 Oct 2012 14:58:58 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 74ACB29000B for ; Thu, 11 Oct 2012 14:58:58 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Re: [patch] Fix PR bootstrap/54820 Date: Thu, 11 Oct 2012 14:56:22 +0200 Message-ID: <10689037.f9KFBEBVzS@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) In-Reply-To: <6538779.exI3fxXHMp@polaris> References: <6538779.exI3fxXHMp@polaris> 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 > 2012-10-09 Eric Botcazou > PR bootstrap/54820 > * Makefile.tpl (STAGE1_FLAGS_TO_PASS): New variable. > (host_modules): Add STAGE1_FLAGS_TO_PASS to args. > * Makefile.in: Regenerate. > * configure.ac (have_static_libs): New variable and associated check. > (stage1-ldflags): Move to after stage1_libs and set to -static-libstdc++ > -static-libgcc if stage1_libs is empty and have_static_libs is yes. > * configure: Regenerate. > gcc/ada > * gcc-interface/Make-lang.in (GCC_LINK): Remove -static-libstdc++ > -static-libgcc. The Makefile.tpl change was a bit rough... Here is a better patch, where a new variable stage1_args is defined for the host modules. Tested on x86_64-suse-linux, OK for the mainline? 2012-10-11 Eric Botcazou PR bootstrap/54820 * Makefile.tpl (STAGE1_FLAGS_TO_PASS): New variable. (all-[+prefix+][+module+]): Pass stage1_args to sub-makes. (all-stage[+id+]-[+prefix+][+module+]): Likewise, if prev is false. (clean-stage[+id+]-[+prefix+][+module+]): Likewise, if prev is false. (host_modules): Set stage1_args to STAGE1_FLAGS_TO_PASS. * Makefile.in: Regenerate. * configure.ac (have_static_libs): New variable and associated check. (stage1-ldflags): Move to after stage1_libs and set to -static-libstdc++ -static-libgcc if stage1_libs is empty and have_static_libs is yes. * configure: Regenerate. gcc/ada * gcc-interface/Make-lang.in (GCC_LINK): Remove hardcoded options. Index: Makefile.tpl =================================================================== --- Makefile.tpl (revision 192353) +++ Makefile.tpl (working copy) @@ -615,6 +615,12 @@ EXTRA_HOST_FLAGS = \ FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) +# Flags to pass to stage1 or when not bootstrapping. + +STAGE1_FLAGS_TO_PASS = \ + LDFLAGS="$${LDFLAGS}" \ + HOST_LIBS="$${HOST_LIBS}" + # Flags to pass to stage2 and later makes. POSTSTAGE1_FLAGS_TO_PASS = \ @@ -1076,7 +1082,7 @@ all-[+prefix+][+module+]: configure-[+pr s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ [+exports+] [+extra_exports+] \ (cd [+subdir+]/[+module+] && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \ + $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \ $(TARGET-[+prefix+][+module+])) @endif [+prefix+][+module+] @@ -1109,9 +1115,8 @@ all-stage[+id+]-[+prefix+][+module+]: co CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - [+args+] [+ - IF prev +][+poststage1_args+][+ ENDIF prev - +] [+extra_make_flags+] \ + [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \ + [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \ TFLAGS="$(STAGE[+id+]_TFLAGS)" \ $(TARGET-stage[+id+]-[+prefix+][+module+]) @@ -1125,9 +1130,8 @@ clean-stage[+id+]-[+prefix+][+module+]: $(MAKE) stage[+id+]-start; \ fi; \ cd [+subdir+]/[+module+] && \ - $(MAKE) [+args+] [+ IF prev +] \ - [+poststage1_args+] [+ ENDIF prev +] \ - [+extra_make_flags+] clean + $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \ + [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean @endif [+prefix+][+module+]-bootstrap [+ ENDFOR bootstrap_stage +] @@ -1162,6 +1166,7 @@ clean-stage[+id+]-[+prefix+][+module+]: exports="$(HOST_EXPORTS)" poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" args="$(EXTRA_HOST_FLAGS)" + stage1_args="$(STAGE1_FLAGS_TO_PASS)" poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +] .PHONY: check-[+module+] maybe-check-[+module+] Index: configure.ac =================================================================== --- configure.ac (revision 192353) +++ configure.ac (working copy) @@ -1182,6 +1182,22 @@ if test -z "$LD"; then fi fi +# Check whether -static-libstdc++ -static-libgcc is supported +have_static_libs=no +if test "$GCC" = yes; then + saved_LDFLAGS="$LDFLAGS" + + LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc" + AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc]) + AC_LANG_PUSH(C++) + AC_LINK_IFELSE([int main() {}], + [AC_MSG_RESULT([yes]); have_static_libs=yes], + [AC_MSG_RESULT([no])]) + AC_LANG_POP(C++) + + LDFLAGS="$saved_LDFLAGS" +fi + ACX_PROG_GNAT ACX_PROG_CMP_IGNORE_INITIAL @@ -1478,17 +1494,6 @@ case $with_host_libstdcxx in ;; esac -# Linker flags to use for stage1 or when not boostrapping. -AC_ARG_WITH(stage1-ldflags, -[AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])], -[if test "$withval" = "no" -o "$withval" = "yes"; then - stage1_ldflags= - else - stage1_ldflags=$withval - fi], -[stage1_ldflags=]) -AC_SUBST(stage1_ldflags) - # Libraries to use for stage1 or when not bootstrapping. AC_ARG_WITH(stage1-libs, [AS_HELP_STRING([--with-stage1-libs=LIBS], [libraries for stage1])], @@ -1500,6 +1505,23 @@ AC_ARG_WITH(stage1-libs, [stage1_libs=$with_host_libstdcxx]) AC_SUBST(stage1_libs) +# Linker flags to use for stage1 or when not bootstrapping. +AC_ARG_WITH(stage1-ldflags, +[AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])], +[if test "$withval" = "no" -o "$withval" = "yes"; then + stage1_ldflags= + else + stage1_ldflags=$withval + fi], +[stage1_ldflags= + # In stage 1, default to linking libstdc++ and libgcc statically with GCC + # if supported. But if the user explicitly specified the libraries to use, + # trust that they are doing what they want. + if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then + stage1_ldflags="-static-libstdc++ -static-libgcc" + fi]) +AC_SUBST(stage1_ldflags) + # Libraries to use for stage2 and later builds. This defaults to the # argument passed to --with-host-libstdcxx. AC_ARG_WITH(boot-libs, Index: gcc/ada/gcc-interface/Make-lang.in =================================================================== --- gcc/ada/gcc-interface/Make-lang.in (revision 192353) +++ gcc/ada/gcc-interface/Make-lang.in (working copy) @@ -172,7 +172,7 @@ endif # Strip -Werror during linking for the LTO bootstrap GCC_LINKERFLAGS = $(filter-out -Werror, $(ALL_LINKERFLAGS)) -GCC_LINK=$(LINKER) $(GCC_LINKERFLAGS) -static-libgcc -static-libstdc++ $(LDFLAGS) +GCC_LINK=$(LINKER) $(GCC_LINKERFLAGS) $(LDFLAGS) # Lists of files for various purposes.