From patchwork Sun Nov 21 23:07:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Matz X-Patchwork-Id: 72468 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 AC1A8B7108 for ; Mon, 22 Nov 2010 10:07:36 +1100 (EST) Received: (qmail 14292 invoked by alias); 21 Nov 2010 23:07:29 -0000 Received: (qmail 14266 invoked by uid 22791); 21 Nov 2010 23:07:27 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL, BAYES_00, TW_IB, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 21 Nov 2010 23:07:21 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 54FF287567; Mon, 22 Nov 2010 00:07:18 +0100 (CET) Date: Mon, 22 Nov 2010 00:07:17 +0100 (CET) From: Michael Matz To: Tobias Burnus Cc: gcc patches , gfortran Subject: Re: RFC automatic linkage of libquadmath with gfortran: PR driver/46516; libgfortran.spec, multilib search path In-Reply-To: <4CE8D295.5040606@net-b.de> Message-ID: References: <4CE80CA9.9050205@net-b.de> <4CE8229E.9050600@net-b.de> <4CE8D295.5040606@net-b.de> MIME-Version: 1.0 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 Hi, On Sun, 21 Nov 2010, Tobias Burnus wrote: > Tobias Burnus wrote: > > Awesome! The attached patch seems to work as it should! I will do some > > bootstrapping tests, but I think should be fine. > > > > Assuming that no issue pops up: Is this patch OK for committal? > > Bootstrapped, regtested and committed after approval on #gfortran by > Steve and Jerry. > > Michael: Thanks again for the patch (the words could be trivially > translated into a real patch). I have another improvement here. I'm regularly testing uninstalled compilers (or compilers installed in temp paths). This exposed a problem in that the .spec file is only found when the proper -L option is given (that's okay), which it usually isn't for non-linking commands. In that case lang_specific_pre_link is nevertheless called, tries to include libgfortran.spec and fails. Hence, let's remember if we're in a non-link run, and not do anything with that .spec file. Regstrapping on x86_64-linux in progress. Okay if that passes? Ciao, Michael. * gfortranspec.c (library): New global, moved from ... (lang_specific_driver): ... here. (lang_specific_pre_link): Test it here before including libgfortran.spec. Index: gfortranspec.c =================================================================== --- gfortranspec.c (Revision 167013) +++ gfortranspec.c (Arbeitskopie) @@ -76,7 +76,11 @@ static unsigned int g77_newargc; static struct cl_decoded_option *g77_new_decoded_options; /* The path to the spec file. */ -char *spec_file = NULL; +static char *spec_file = NULL; + +/* This will be NULL if we encounter a situation where we should not + link in the fortran libraries. */ +static const char *library = NULL; /* Return full path name of spec file if it is in DIR, or NULL if @@ -207,10 +211,6 @@ lang_specific_driver (struct cl_decoded_ unsigned int i; int verbose = 0; - /* This will be NULL if we encounter a situation where we should not - link in libf2c. */ - const char *library = FORTRAN_LIBRARY; - /* 0 => -xnone in effect. 1 => -xfoo in effect. */ int saw_speclang = 0; @@ -233,6 +233,8 @@ lang_specific_driver (struct cl_decoded_ int n_infiles = 0; int n_outfiles = 0; + library = FORTRAN_LIBRARY; + #if 0 fprintf (stderr, "Incoming:"); for (i = 0; i < argc; i++) @@ -472,7 +474,7 @@ lang_specific_pre_link (void) { if (spec_file) free (spec_file); - else + else if (library) do_spec ("%:include(libgfortran.spec)"); return 0;