diff mbox

RFC automatic linkage of libquadmath with gfortran: PR driver/46516; libgfortran.spec, multilib search path

Message ID Pine.LNX.4.64.1011220003360.29956@wotan.suse.de
State New
Headers show

Commit Message

Michael Matz Nov. 21, 2010, 11:07 p.m. UTC
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.

Comments

Tobias Burnus Nov. 22, 2010, 7:28 a.m. UTC | #1
On 11/22/2010 12:07 AM, Michael Matz wrote:
> 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?

OK. Thanks for the patch!

Tobais

> 	* 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;
>
diff mbox

Patch

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;