From patchwork Fri May 4 10:35:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 156853 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 CC113B6FC3 for ; Fri, 4 May 2012 20:37:12 +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=1336732634; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version:Message-Id: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=4IScKzt DnLtE2QKX0R8ieQC2BL4=; b=w+6NHQnmrfCD0KaPLwOO9QgDIc6fdU70WKQZKjM VIbg1BYQ/woanzwxjVZgKlQdT2VWeHuWCcB5mDRE8ncIPcZFkNTV5h87oWNAeQ/x kTU30otXOhVztP1B/KmvXFqk6NgqQNet9J5IkT7TTHJ1K1j0kK/lM3lSWCqpf+gV ZeAs= 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:User-Agent:MIME-Version:Message-Id:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=r2JxGo8IDVbw+t4P1gvuDffDfJB9mkrJuXPuGlb11z0AQ5tfFgTfdCT8N2gwPo sXzSVc6AtPMKzl9fFv0ZrHEt/XreJjz4WqwumDTVrtcgNyPA5u4A1PH46pNKGonR A1y56uzAkf6YHZWT7xPRDxcKHNWM5R/iNFay91SOW28f8=; Received: (qmail 14716 invoked by alias); 4 May 2012 10:37:08 -0000 Received: (qmail 14603 invoked by uid 22791); 4 May 2012 10:37:07 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 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; Fri, 04 May 2012 10:36:47 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 48FAD29000E for ; Fri, 4 May 2012 12:36:52 +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 MYwdPgeO0qT7 for ; Fri, 4 May 2012 12:36:52 +0200 (CEST) Received: from [192.168.1.2] (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 A1E49290007 for ; Fri, 4 May 2012 12:36:51 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix plugin-enabled LTO with cross-native build Date: Fri, 4 May 2012 12:35:31 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201205041235.31703.ebotcazou@adacore.com> 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 Hi, we ran into a problem with plugin-enabled LTO and a cross-native build of the compiler for Windows: collect2.c isn't able to find the linker in LTO mode. The reason is that, at configure time, PLUGIN_LD is set to the $gcc_cv_ld, but the machinery in collect2.c is set up for suffixes instead: static const char *const ld_suffix = "ld"; static const char *const plugin_ld_suffix = PLUGIN_LD; static const char *const real_ld_suffix = "real-ld"; static const char *const collect_ld_suffix = "collect-ld"; static const char *const nm_suffix = "nm"; static const char *const gnm_suffix = "gnm"; #ifdef LDD_SUFFIX static const char *const ldd_suffix = LDD_SUFFIX; #endif static const char *const strip_suffix = "strip"; static const char *const gstrip_suffix = "gstrip"; so the attached patch attempts to pass a suffix in this case too. Tested on i586-suse-linux and with the aforementioned cross-native build, OK for the mainline? 2012-05-04 Eric Botcazou * configure.ac (PLUGIN_LD): Rename into... (PLUGIN_LD_SUFFIX): ...this and strip the target_alias triplet. * config.in: Regenerate. * configure: Likewise. * collect2.c (main): Set plugin_ld_suffix to PLUGIN_LD_SUFFIX. Index: configure.ac =================================================================== --- configure.ac (revision 187074) +++ configure.ac (working copy) @@ -2001,15 +2001,15 @@ else fi]) ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld -PLUGIN_LD=`basename $gcc_cv_ld` +PLUGIN_LD_SUFFIX=`basename $gcc_cv_ld | sed -e "s,$target_alias-,,"` AC_ARG_WITH(plugin-ld, [AS_HELP_STRING([[--with-plugin-ld=[ARG]]], [specify the plugin linker])], [if test x"$withval" != x; then ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval" - PLUGIN_LD="$withval" + PLUGIN_LD_SUFFIX=`echo $withval | sed -e "s,$target_alias-,,"` fi]) AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET) -AC_DEFINE_UNQUOTED(PLUGIN_LD, "$PLUGIN_LD", [Specify plugin linker]) +AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker]) # Check to see if we are using gold instead of ld AC_MSG_CHECKING(whether we are using gold) Index: collect2.c =================================================================== --- collect2.c (revision 187074) +++ collect2.c (working copy) @@ -1018,7 +1018,7 @@ int main (int argc, char **argv) { static const char *const ld_suffix = "ld"; - static const char *const plugin_ld_suffix = PLUGIN_LD; + static const char *const plugin_ld_suffix = PLUGIN_LD_SUFFIX; static const char *const real_ld_suffix = "real-ld"; static const char *const collect_ld_suffix = "collect-ld"; static const char *const nm_suffix = "nm";