[gnu.gcc.bug] -g Shouldn't Abort Compile on MIPS

frank@croton.enet.dec.com (Frank Wortner) (02/22/90)

The MIPS version of gcc 1.37 still bombs out if a "-g" flag is given
to it.  Since I have neither the time nor (more likely) the talent to
add real debugger support, I've done the next best thing:  fixed gcc
so that it prints a warning message and then ignores the "-g".
 
The diffs below also move a the handling of the "-lg" linker flag to
LIB_SPEC.  Obviously, if a machine does not support "-g", it won't
have a libarary corresponding to "-lg".  :-)
 
I hope that someone will eventually get gdb working on the MIPS
processors, but, until then, this should keep everyone from having
to change all those Makefiles that assume "-g" is a legitimate option
on all versions of gcc.
 
Have fun!
 
				Frank Wortner
				Ultrix Resource Center
				Digital Equipment Corp.
 

diff -rc gcc-1.37/gcc.c gcc-1.37-fw/gcc.c
*** gcc-1.37/gcc.c	Wed Feb 21 09:39:24 1990
--- gcc-1.37-fw/gcc.c	Fri Feb 16 11:08:14 1990
***************
*** 184,190 ****
  
  /* config.h can define LIB_SPEC to override the default libraries.  */
  #ifndef LIB_SPEC
! #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
  #endif
  
  /* config.h can define STARTFILE_SPEC to override the default crt0 files.  */
--- 184,190 ----
  
  /* config.h can define LIB_SPEC to override the default libraries.  */
  #ifndef LIB_SPEC
! #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
  #endif
  
  /* config.h can define STARTFILE_SPEC to override the default crt0 files.  */
***************
*** 284,293 ****
  };
  
  /* Here is the spec for running the linker, after compiling all files.  */
  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\
   %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
   %{y*} %{!A:%{!nostdlib:%S}} \
!  %{L*} %o %{!nostdlib:gnulib%s %{g:-lg} %L gnulib%s}\n }}}}";
  
  /* Accumulate a command (program name and args), and run it.  */
  
--- 284,294 ----
  };
  
  /* Here is the spec for running the linker, after compiling all files.  */
+ 
  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\
   %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
   %{y*} %{!A:%{!nostdlib:%S}} \
!  %{L*} %o %{!nostdlib:gnulib%s %L gnulib%s}\n }}}}";
  
  /* Accumulate a command (program name and args), and run it.  */
  
diff -rc gcc-1.37/toplev.c gcc-1.37-fw/toplev.c
*** gcc-1.37/toplev.c	Wed Feb 21 09:40:08 1990
--- gcc-1.37-fw/toplev.c	Thu Feb 15 13:47:56 1990
***************
*** 1968,1973 ****
--- 1968,1977 ----
  	else if (!strcmp (str, "G0"))
  	  write_symbols = SDB_DEBUG;
  #endif
+ #if !defined(SDB_DEBUGGING_INFO) && !defined(DBX_DEBUGGING_INFO)
+ 	else if (!strcmp (str, "g"))
+ 	  warning("-g option not supported on this vesion of GCC");
+ #endif
  	else if (!strcmp (str, "symout"))
  	  {
  	    if (write_symbols == NO_DEBUG)
diff -rc gcc-1.37/config/tm-3b1.h gcc-1.37-fw/config/tm-3b1.h
*** gcc-1.37/config/tm-3b1.h	Wed Feb 21 09:38:43 1990
--- gcc-1.37-fw/config/tm-3b1.h	Wed Feb 21 09:47:23 1990
***************
*** 39,45 ****
  /* we use /lib/libp/lib*  when profiling */
  
  #undef LIB_SPEC
! #define LIB_SPEC "%{!shlib:%{p:-L/lib/libp} %{pg:-L/lib/libp} -lc}"
  
  /* shared libraries need to use crt0s.o  */
  
--- 39,45 ----
  /* we use /lib/libp/lib*  when profiling */
  
  #undef LIB_SPEC
! #define LIB_SPEC "%{g:-lg} %{!shlib:%{p:-L/lib/libp} %{pg:-L/lib/libp} -lc}"
  
  /* shared libraries need to use crt0s.o  */
  
diff -rc gcc-1.37/config/tm-aix386.h gcc-1.37-fw/config/tm-aix386.h
*** gcc-1.37/config/tm-aix386.h	Fri Aug  4 17:32:50 1989
--- gcc-1.37-fw/config/tm-aix386.h	Wed Feb 21 09:47:46 1990
***************
*** 34,40 ****
  #define STARTFILE_SPEC  \
    "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
  
! #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s"
  
  /* Special flags for the linker.  I don't know what they do.  */
  
--- 34,40 ----
  #define STARTFILE_SPEC  \
    "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
  
! #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s"
  
  /* Special flags for the linker.  I don't know what they do.  */
  
diff -rc gcc-1.37/config/tm-i386v.h gcc-1.37-fw/config/tm-i386v.h
*** gcc-1.37/config/tm-i386v.h	Fri Aug  4 00:39:41 1989
--- gcc-1.37-fw/config/tm-i386v.h	Wed Feb 21 09:48:18 1990
***************
*** 33,39 ****
  #define STARTFILE_SPEC  \
    "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
  
! #define LIB_SPEC "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} -lc crtn.o%s"
  
  /* Specify predefined symbols in preprocessor.  */
  
--- 33,39 ----
  #define STARTFILE_SPEC  \
    "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
  
! #define LIB_SPEC "%{g:-lg} %{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} -lc crtn.o%s"
  
  /* Specify predefined symbols in preprocessor.  */
  
diff -rc gcc-1.37/config/tm-isi68.h gcc-1.37-fw/config/tm-isi68.h
*** gcc-1.37/config/tm-isi68.h	Wed Aug  9 14:18:19 1989
--- gcc-1.37-fw/config/tm-isi68.h	Wed Feb 21 09:49:20 1990
***************
*** 34,40 ****
  
  /* If the 68881 is used, link must load libmc.a instead of libc.a */
  
! #define LIB_SPEC "%{msoft-float:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}%{!msoft-float:%{!p:%{!pg:-lmc}}%{p:-lmc_p}%{pg:-lmc_p}}"
  
  #else
  /* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
--- 34,40 ----
  
  /* If the 68881 is used, link must load libmc.a instead of libc.a */
  
! #define LIB_SPEC "%{g:-lg} %{msoft-float:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}%{!msoft-float:%{!p:%{!pg:-lmc}}%{p:-lmc_p}%{pg:-lmc_p}}"
  
  #else
  /* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
***************
*** 44,50 ****
  
  /* If the 68881 is used, link must load libmc.a instead of libc.a */
  
! #define LIB_SPEC "%{!m68881:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}%{m68881:%{!p:%{!pg:-lmc}}%{p:-lmc_p}%{pg:-lmc_p}}"
  #endif
  
  /* Names to predefine in the preprocessor for this target machine.  */
--- 44,50 ----
  
  /* If the 68881 is used, link must load libmc.a instead of libc.a */
  
! #define LIB_SPEC "%{g:-lg} %{!m68881:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}%{m68881:%{!p:%{!pg:-lmc}}%{p:-lmc_p}%{pg:-lmc_p}}"
  #endif
  
  /* Names to predefine in the preprocessor for this target machine.  */
diff -rc gcc-1.37/config/tm-mips.h gcc-1.37-fw/config/tm-mips.h
*** gcc-1.37/config/tm-mips.h	Wed Feb 21 09:38:57 1990
--- gcc-1.37-fw/config/tm-mips.h	Fri Feb 16 11:08:04 1990
***************
*** 140,145 ****
--- 140,149 ----
  #endif
  #endif
  
+ /* LIB SPECS */
+ 
+ #define LIB_SPEC   "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+ 
  /* CC1 SPECS */
  
  #define CC1_SPEC   "%{O2:-O -fstrength-reduce -fomit-frame-pointer -mgpOPT}\
diff -rc gcc-1.37/config/tm-next.h gcc-1.37-fw/config/tm-next.h
*** gcc-1.37/config/tm-next.h	Wed Feb 21 09:38:57 1990
--- gcc-1.37-fw/config/tm-next.h	Wed Feb 21 09:49:43 1990
***************
*** 28,34 ****
  
  /* Machine dependent libraries.  */
  
! #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lsys_p}%{pg:-lsys_p}"
   
  /* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
  #define STARTFILE_SPEC  \
--- 28,34 ----
  
  /* Machine dependent libraries.  */
  
! #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lsys_p}%{pg:-lsys_p}"
   
  /* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
  #define STARTFILE_SPEC  \
diff -rc gcc-1.37/config/tm-sparc.h gcc-1.37-fw/config/tm-sparc.h
*** gcc-1.37/config/tm-sparc.h	Wed Feb 21 09:39:01 1990
--- gcc-1.37-fw/config/tm-sparc.h	Wed Feb 21 09:50:16 1990
***************
*** 23,29 ****
  
  /* Specify library to handle `-a' basic block profiling.  */
  
! #define LIB_SPEC "%{a:/usr/lib/bb_link.o} \
  %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
  
  /* Provide required defaults for linker -e and -d switches.
--- 23,29 ----
  
  /* Specify library to handle `-a' basic block profiling.  */
  
! #define LIB_SPEC "%{g:-lg} %{a:/usr/lib/bb_link.o} \
  %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
  
  /* Provide required defaults for linker -e and -d switches.
diff -rc gcc-1.37/config/tm-sun3.h gcc-1.37-fw/config/tm-sun3.h
*** gcc-1.37/config/tm-sun3.h	Wed Feb 21 09:39:02 1990
--- gcc-1.37-fw/config/tm-sun3.h	Wed Feb 21 09:50:47 1990
***************
*** 111,117 ****
  
  #if TARGET_DEFAULT & 0100
  /* -mfpa is the default */
! #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  %{a:/usr/lib/bb_link.o} %{g:-lg} \
  %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
  %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
--- 111,117 ----
  
  #if TARGET_DEFAULT & 0100
  /* -mfpa is the default */
! #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  %{a:/usr/lib/bb_link.o} %{g:-lg} \
  %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
  %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
***************
*** 118,130 ****
  #else
  #if TARGET_DEFAULT & 2
  /* -m68881 is the default */
! #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  %{a:/usr/lib/bb_link.o} %{g:-lg} \
  %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
  %{mfpa:-L/usr/lib/ffpa}"
  #else
  /* -msoft-float is the default */
! #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  %{a:/usr/lib/bb_link.o} %{g:-lg} \
  %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
  %{mfpa:-L/usr/lib/ffpa}"
--- 118,130 ----
  #else
  #if TARGET_DEFAULT & 2
  /* -m68881 is the default */
! #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  %{a:/usr/lib/bb_link.o} %{g:-lg} \
  %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
  %{mfpa:-L/usr/lib/ffpa}"
  #else
  /* -msoft-float is the default */
! #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  %{a:/usr/lib/bb_link.o} %{g:-lg} \
  %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
  %{mfpa:-L/usr/lib/ffpa}"
diff -rc gcc-1.37/config/tm-sun386i.h gcc-1.37-fw/config/tm-sun386i.h
*** gcc-1.37/config/tm-sun386i.h	Wed May 24 15:27:55 1989
--- gcc-1.37-fw/config/tm-sun386i.h	Wed Feb 21 09:51:19 1990
***************
*** 33,39 ****
  #define STARTFILE_SPEC  \
    "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
  
! #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}\
  %{sun386:}"
  /* That last item is just to prevent a spurious error.  */
  
--- 33,39 ----
  #define STARTFILE_SPEC  \
    "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
  
! #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}\
  %{sun386:}"
  /* That last item is just to prevent a spurious error.  */
  
 
================== RFC 822 Headers ==================
Date: Wed, 21 Feb 90 12:20:05 EST