https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61418
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- Index: gfortranspec.c =================================================================== --- gfortranspec.c (revision 211228) +++ gfortranspec.c (working copy) @@ -449,12 +449,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 +467,17 @@ For more information about these matters int lang_specific_pre_link (void) { - free (spec_file); - if (spec_file == NULL && library) + if (!library) + return 0; + + if (spec_file) + { + char cmd = asprintf (&cmd, "%%:include(%s)", spec_file); + do_spec (cmd); + free (cmd); + free (spec_file); + } + else if (library) do_spec ("%:include(libgfortran.spec)"); return 0;