This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][Fortran] Do not search -L library path for libgfortran.spec


(sorry for the dups, forgot to include gcc-patches)

The following patch fixes PR61418 by removing the odd code (probably
copied from Java) that adds a -specs= command line flag if
libgfortran.spec was found in a path specified by -L.  It shouldn't
be necessary to search those paths (and it could be harmful instead,
as random paths may contain random files named libgfortran.spec).
The proper way to add a search path for specs is to specify -B.

libgfortran.spec is handled specially here - libgomp.spec for
example is not found in -L paths (libgcj.spec is though, but I
don't intend to fix that ...).

Bootstrap and regtest in progress on x86_64-unknown-linux-gnu.

Ok for trunk and 4.9 branch?

Thanks,
Richard.

2014-06-05  Richard Biener  <rguenther@suse.de>

	PR fortran/61418
	* gfortranspec.c (spec_file): Remove.
	(find_spec_file): Likewise.
	(lang_specific_driver): Do not look for specs file in -L
	or append -specs command line argument.
	(lang_specific_pre_link): Always %:include libgfortran.spec.

Index: gcc/fortran/gfortranspec.c
===================================================================
--- gcc/fortran/gfortranspec.c	(revision 211228)
+++ gcc/fortran/gfortranspec.c	(working copy)
@@ -73,34 +73,11 @@ static void append_arg (const struct cl_
 static unsigned int g77_newargc;
 static struct cl_decoded_option *g77_new_decoded_options;
 
-/* The path to the spec file.  */
-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
-   not.  */
-static char *
-find_spec_file (const char *dir)
-{
-  const char dirsep_string[] = { DIR_SEPARATOR, '\0' };
-  char *spec;
-  struct stat sb;
-
-  spec = XNEWVEC (char, strlen (dir) + sizeof (SPEC_FILE) + 4);
-  strcpy (spec, dir);
-  strcat (spec, dirsep_string);
-  strcat (spec, SPEC_FILE);
-  if (!stat (spec, &sb))
-    return spec;
-  free (spec);
-  return NULL;
-}
-
-
 /* Return whether strings S1 and S2 are both NULL or both the same
    string.  */
 
@@ -313,12 +290,6 @@ For more information about these matters
 	     cool facility for handling --help and --verbose --help.  */
 	  return;
 
-	case OPT_L:
-	  if (!spec_file)
-	    spec_file = find_spec_file (decoded_options[i].arg);
-	  break;
-
-
 	default:
 	  break;
 	}
@@ -449,12 +420,6 @@ For more information about these matters
 
 #endif
 
-  /* Read the specs file corresponding to libgfortran.
-     If we didn't find the spec file on the -L path, we load it
-     via lang_specific_pre_link.  */
-  if (spec_file)
-    append_option (OPT_specs_, spec_file, 1);
-
   if (verbose && g77_new_decoded_options != g77_x_decoded_options)
     {
       fprintf (stderr, _("Driving:"));
@@ -473,8 +438,7 @@ For more information about these matters
 int
 lang_specific_pre_link (void)
 {
-  free (spec_file);
-  if (spec_file == NULL && library)
+  if (library)
     do_spec ("%:include(libgfortran.spec)");
 
   return 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]