Results for egcs-2.91.42 19980621 (gcc2 ss-980502 experimental) testsuite on sparc-sun-sunos4.1.3

Craig Burley burley@gnu.org
Fri Jun 26 09:05:00 GMT 1998


>The problem seems to have something to do with linking libm before
>libg2c.  Since the testsuite links with -lm but not with -lg2c, ld is
>called like this:
>
>/n/temp1/gcctest/egcs/SunOS-4.1.3/lib/gcc-lib/sparc-sun-sunos4.1.3/egcs-2.91.42/collect2 -e start -dc -dp /lib/crt0.o -L/n/temp1/gcctest/egcs/SunOS-4.1.3/lib/gcc-lib/sparc-sun-sunos4.1.3/egcs-2.91.42 -L/n/temp1/gcctest/egcs/SunOS-4.1.3/sparc-sun-sunos4.1.3/lib -L/n/temp1/gcctest/egcs/SunOS-4.1.3/lib /tmp/cca073921.o -lm -lg2c -lm -lgcc -lc -lgcc
>
>Example:
>
>oliva@atibaia% ~/egcs/SunOS-4.1.3/bin/g77 -g cabs.f && ./a.out    
>oliva@atibaia% ~/egcs/SunOS-4.1.3/bin/g77 -g cabs.f -lg2c -lm && ./a.out    
>oliva@atibaia% ~/egcs/SunOS-4.1.3/bin/g77 -g cabs.f -lm && ./a.out
>Fortran abort routine called
>Abort (core dumped)

Here is a patch that should fix this problem.  I'm putting it into
g77 0.5.24 as well.  Dave Love, once this patch is confirmed as
working by Alexandre or someone else on SunOS4, could you please
install it?

The news.texi that I've written for 0.5.24 (and will later
submit patches to clean up egcs-g77's news.texi shortly before
final testing) is:

@item
The @code{g77} driver now ensures that @samp{-lg2c}
is specified in the link phase prior to any
occurrence of @samp{-lm}.
This prevents accidentally linking to a routine
in the SunOS4 @samp{-lm} library
when the generated code wants to link to the one
in @code{libf2c} (@code{libg2c}).


Fri Jun 26 11:54:19 1998  Craig Burley  <burley@gnu.org>

	* g77spec.c (lang_specific_driver): Put `-lg2c' in
	front of any `-lm' that is seen.


*** g77-e/gcc/f/g77spec.c.~1~   Fri Jun 19 16:02:11 1998
--- g77-e/gcc/f/g77spec.c       Fri Jun 26 11:55:48 1998
*************** Report bugs to <egcs-bugs@cygnus.org>.\n
*** 512,515 ****
--- 512,517 ----
              if (saw_library == 1)
                saw_library = 2;        /* -l<library> -lm. */
+             else
+               append_arg (FORTRAN_LIBRARY);
            }
          else if (strcmp (argv[i], FORTRAN_LIBRARY) == 0)



More information about the Gcc-patches mailing list