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]

3.2 PATCH: Make ASM_DEBUG_SPEC a compile-time constant


While working on the remaining testsuite failures of the IRIX 6 O32
configuration, I tried to make DWARF-2 the default debugging format.
Unfortunately, this breaks bootstrap: the IRIX 6 O32 cc complains:

cfe: Error: /vol/gnu/src/gcc/gcc/gcc/gcc.c, line 649: Invalid constant expression.
 static const char *asm_debug = (DWARF2_DEBUG  == DBX_DEBUG			       ? "%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}"	       : "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}") ;
 ----------------------------------------------------------			-------^
make[2]: *** [gcc.o] Error 1

Reducing this to a minimal testcase, I found the following:

Compiling this gcc.c excerpt with cc -32, all is fine if
PREFERRED_DEBUGGING_TYPE is DBX_DEBUG.  If I change it to DWARF2_DEBUG
instead, I get the error reported above.  This doesn't happen with the
N32/N64 compilers (which use a different backend) or any other vendor cc.
Anyway, the trivial patch below allows me to work around this and continue
the bootstrap (which started to fail with an ICE for other reasons, which I'm
still investigating).

Ok for mainline?

	Rainer

--- const.c ---
enum debug_info_type
{
  NO_DEBUG,	    /* Write no debug info.  */
  DBX_DEBUG,	    /* Write BSD .stabs for DBX (using dbxout.c).  */
  SDB_DEBUG,	    /* Write COFF for (old) SDB (using sdbout.c).  */
  DWARF_DEBUG,	    /* Write Dwarf debug info (using dwarfout.c).  */
  DWARF2_DEBUG,	    /* Write Dwarf v2 debug info (using dwarf2out.c).  */
  XCOFF_DEBUG,	    /* Write IBM/Xcoff debug info (using dbxout.c).  */
  VMS_DEBUG,        /* Write VMS debug info (using vmsdbgout.c).  */
  VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c).
                          and DWARF v2 debug info (using dwarf2out.c).  */
};

/* #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG */
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG

#  define ASM_DEBUG_SPEC					\
      (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG			\
       ? "%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}"	\
       : "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}")

static const char *asm_debug = ASM_DEBUG_SPEC;
---------------


Tue Jun 25 00:04:09 2002  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* gcc.c (ASM_DEBUG_SPEC): Make compile-time constant.

Index: gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.325
diff -u -p -r1.325 gcc.c
--- gcc/gcc.c	20 Jun 2002 20:33:54 -0000	1.325
+++ gcc/gcc.c	25 Jun 2002 12:12:25 -0000
@@ -591,10 +591,11 @@ proper position among the other output f
 #ifndef ASM_DEBUG_SPEC
 # if defined(DBX_DEBUGGING_INFO) && defined(DWARF2_DEBUGGING_INFO) \
      && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG)
-#  define ASM_DEBUG_SPEC					\
-      (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG			\
-       ? "%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}"	\
-       : "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}")
+#  if PREFERRED_DEBUGGING_TYPE == DBX_DEBUG
+#   define ASM_DEBUG_SPEC "%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}"
+#  else
+#   define ASM_DEBUG_SPEC "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}"
+#  endif
 # else
 #  if defined(DBX_DEBUGGING_INFO) && defined(HAVE_AS_GSTABS_DEBUG_FLAG)
 #   define ASM_DEBUG_SPEC "%{g*:--gstabs}"


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