configure.in (HAVE_AS_GDWARF2_DEBUG_FLAG): Define.
authorGeoffrey Keating <geoffk@redhat.com>
Tue, 20 Nov 2001 10:16:09 +0000 (10:16 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Tue, 20 Nov 2001 10:16:09 +0000 (10:16 +0000)
* configure.in (HAVE_AS_GDWARF2_DEBUG_FLAG): Define.
(HAVE_AS_GSTABS_DEBUG_FLAG): Define.
* configure: Regenerate.
* config.in: Add dummy definitions of new flags.
* toplev.c (PREFERRED_DEBUGGING_TYPE): Move definition to...
* defaults.h (PREFERRED_DEBUGGING_TYPE): ... here.
* gcc.c (ASM_DEBUG_SPEC): New macro.
(asm_debug): New static variable.
(default_compilers): Add asm_debug when assembling from
user input.
(static_specs): Add asm_debug.

From-SVN: r47210

gcc/ChangeLog
gcc/config.in
gcc/configure
gcc/configure.in
gcc/defaults.h
gcc/gcc.c
gcc/toplev.c

index 25d452fbae605f69fcca4140a7f7b7770b03fc65..bab397a8a19c2406410ad5d84f7b6aac32e14bc5 100644 (file)
@@ -1,3 +1,17 @@
+2001-11-19  Geoffrey Keating  <geoffk@redhat.com>
+
+       * configure.in (HAVE_AS_GDWARF2_DEBUG_FLAG): Define.
+       (HAVE_AS_GSTABS_DEBUG_FLAG): Define.
+       * configure: Regenerate.
+       * config.in: Add dummy definitions of new flags.
+       * toplev.c (PREFERRED_DEBUGGING_TYPE): Move definition to...
+       * defaults.h (PREFERRED_DEBUGGING_TYPE): ... here.
+       * gcc.c (ASM_DEBUG_SPEC): New macro.
+       (asm_debug): New static variable.
+       (default_compilers): Add asm_debug when assembling from
+       user input.
+       (static_specs): Add asm_debug.
+
 2001-11-20  Loren J. Rittle  <ljrittle@acm.org>
 
        * config.gcc (*-*-freebsd*): Remove configuration block.
index 8fa5f3aa1e6448cbcde486d352afb317672d11e9..e3fde00baeb96c87b9a75a6c3604d0dc2664be11 100644 (file)
 /* Define 0/1 to force the choice for exception handling model. */
 #undef CONFIG_SJLJ_EXCEPTIONS
 
+/* Define if your assembler supports the --gdwarf2 option. */
+#undef HAVE_AS_GDWARF2_DEBUG_FLAG
+
+/* Define if your assembler supports the --gstabs option. */
+#undef HAVE_AS_GSTABS_DEBUG_FLAG
 
 /* Bison unconditionally undefines `const' if neither `__STDC__' nor
    __cplusplus are defined.  That's a problem since we use `const' in
index 74781d6c564597e4eea0f36835830f40c14b1048..7d2ae9de10f6e011a8bc7fa13c178edac11c46ef 100755 (executable)
@@ -2078,7 +2078,7 @@ EOF
 fi
 
 # Find some useful tools
-for ac_prog in mawk gawk nawk awk
+for ac_prog in gawk mawk nawk awk
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -7616,6 +7616,63 @@ EOF
 fi
 echo "$ac_t""$gcc_cv_as_dwarf2_debug_line" 1>&6
 
+echo $ac_n "checking assembler --gdwarf2 support""... $ac_c" 1>&6
+echo "configure:7621: checking assembler --gdwarf2 support" >&5
+gcc_cv_as_gdwarf2_flag=no
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
+then
+  if test "$gcc_cv_gas_major_version" -eq 2 \
+       -a "$gcc_cv_gas_minor_version" -ge 11 \
+       -o "$gcc_cv_gas_major_version" -gt 2 \
+     && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+     && test x"$insn" != x ; then
+    gcc_cv_as_gdwarf2_debug_flag="yes"
+  fi
+elif test x$gcc_cv_as != x -a x"$insn" != x ; then
+       echo '' > conftest.s
+       # ??? This fails with non-gnu grep.
+       if $gcc_cv_as --gdwarf2 -o conftest.o conftest.s > /dev/null 2>&1
+         then
+         gcc_cv_as_gdwarf2_flag="yes"
+       fi
+       rm -f conftest.s conftest.o
+fi
+if test x"$gcc_cv_as_gdwarf2_flag" = xyes; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_AS_GDWARF2_DEBUG_FLAG 1
+EOF
+
+fi
+echo "$ac_t""$gcc_cv_as_gdwarf2_flag" 1>&6
+
+echo $ac_n "checking assembler --gstabs support""... $ac_c" 1>&6
+echo "configure:7650: checking assembler --gstabs support" >&5
+gcc_cv_as_gstabs_flag=no
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
+then
+  if test "$gcc_cv_gas_major_version" -eq 2 \
+       -a "$gcc_cv_gas_minor_version" -ge 11 \
+       -o "$gcc_cv_gas_major_version" -gt 2 \
+     && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+     && test x"$insn" != x ; then
+    gcc_cv_as_gstabs_debug_flag="yes"
+  fi
+elif test x$gcc_cv_as != x -a x"$insn" != x ; then
+       echo '' > conftest.s
+       # ??? This fails with non-gnu grep.
+       if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then
+         gcc_cv_as_gstabs_flag="yes"
+       fi
+       rm -f conftest.s conftest.o
+fi
+if test x"$gcc_cv_as_gstabs_flag" = xyes; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_AS_GSTABS_DEBUG_FLAG 1
+EOF
+
+fi
+echo "$ac_t""$gcc_cv_as_gstabs_flag" 1>&6
+
 if test "$prefix" != "/usr" && test "$prefix" != "/usr/local" ; then
   cat >> confdefs.h <<EOF
 #define PREFIX_INCLUDE_DIR "$prefix/include"
@@ -7759,7 +7816,7 @@ fi
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:7763: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:7820: checking whether to enable maintainer-specific portions of Makefiles" >&5
     # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
 if test "${enable_maintainer_mode+set}" = set; then
   enableval="$enable_maintainer_mode"
index f50695ad84dc3d100d21f0b5639dbefca085a402..fb022ff0293cf48dcb9bade3767a4dea56e29adc 100644 (file)
@@ -1725,6 +1725,57 @@ if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then
 fi
 AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line)
 
+AC_MSG_CHECKING(assembler --gdwarf2 support)
+gcc_cv_as_gdwarf2_flag=no
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
+then
+  if test "$gcc_cv_gas_major_version" -eq 2 \
+       -a "$gcc_cv_gas_minor_version" -ge 11 \
+       -o "$gcc_cv_gas_major_version" -gt 2 \
+     && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+     && test x"$insn" != x ; then
+    gcc_cv_as_gdwarf2_debug_flag="yes"
+  fi
+elif test x$gcc_cv_as != x -a x"$insn" != x ; then
+       echo '' > conftest.s
+       # ??? This fails with non-gnu grep.
+       if $gcc_cv_as --gdwarf2 -o conftest.o conftest.s > /dev/null 2>&1
+         then
+         gcc_cv_as_gdwarf2_flag="yes"
+       fi
+       rm -f conftest.s conftest.o
+fi
+if test x"$gcc_cv_as_gdwarf2_flag" = xyes; then
+       AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
+[Define if your assembler supports the --gdwarf2 option.])
+fi
+AC_MSG_RESULT($gcc_cv_as_gdwarf2_flag)
+
+AC_MSG_CHECKING(assembler --gstabs support)
+gcc_cv_as_gstabs_flag=no
+if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x;
+then
+  if test "$gcc_cv_gas_major_version" -eq 2 \
+       -a "$gcc_cv_gas_minor_version" -ge 11 \
+       -o "$gcc_cv_gas_major_version" -gt 2 \
+     && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+     && test x"$insn" != x ; then
+    gcc_cv_as_gstabs_debug_flag="yes"
+  fi
+elif test x$gcc_cv_as != x -a x"$insn" != x ; then
+       echo '' > conftest.s
+       # ??? This fails with non-gnu grep.
+       if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then
+         gcc_cv_as_gstabs_flag="yes"
+       fi
+       rm -f conftest.s conftest.o
+fi
+if test x"$gcc_cv_as_gstabs_flag" = xyes; then
+       AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1,
+[Define if your assembler supports the --gstabs option.])
+fi
+AC_MSG_RESULT($gcc_cv_as_gstabs_flag)
+
 if test "$prefix" != "/usr" && test "$prefix" != "/usr/local" ; then
   AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
 fi
index bda763fe1b1b5ebd79c33853da88d0e8b16a2990..b83f25e2e39267657b20342b038485aa4a47b8a7 100644 (file)
@@ -410,4 +410,41 @@ do {                                                               \
 #define ASM_BYTE_OP                    "\t.byte\t"
 #endif
 
+#ifndef DEFAULT_GDB_EXTENSIONS
+#define DEFAULT_GDB_EXTENSIONS 1
+#endif
+
+/* If more than one debugging type is supported, you must define
+   PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
+
+   This is one long line cause VAXC can't handle a \-newline.  */
+#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
+#ifndef PREFERRED_DEBUGGING_TYPE
+You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
+#endif /* no PREFERRED_DEBUGGING_TYPE */
+#else /* Only one debugging format supported.  Define PREFERRED_DEBUGGING_TYPE
+        so other code needn't care.  */
+#ifdef DBX_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#endif
+#ifdef SDB_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
+#endif
+#ifdef DWARF_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
+#endif
+#ifdef DWARF2_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+#endif
+#ifdef XCOFF_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
+#endif
+#endif /* More than one debugger format enabled.  */
+
+/* If still not defined, must have been because no debugging formats
+   are supported.  */
+#ifndef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE NO_DEBUG
+#endif
+
 #endif  /* ! GCC_DEFAULTS_H */
index fc9ee62a02cb223cb63d13e18a9b572a244a7ddc..62ff7d03dfedc3efc0dfdfda604b7a2bfb9c5ed7 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -586,6 +586,20 @@ proper position among the other output files.  */
 #define LINKER_NAME "collect2"
 #endif
 
+/* Define ASM_DEBUG_SPEC to be a spec suitable for translating '-g'
+   to the assembler.  */
+#ifndef ASM_DEBUG_SPEC
+# if defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG)
+#  if PREFERRED_DEBUGGING_FORMAT == 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
+#  define ASM_DEBUG_SPEC ""
+# endif
+#endif
+
 /* Here is the spec for running the linker, after compiling all files.  */
 
 /* -u* was put back because both BSD and SysV seem to support it.  */
@@ -613,6 +627,7 @@ proper position among the other output files.  */
 # endif
 #endif
 
+static const char *asm_debug = ASM_DEBUG_SPEC;
 static const char *cpp_spec = CPP_SPEC;
 static const char *cpp_predefines = CPP_PREDEFINES;
 static const char *cc1_spec = CC1_SPEC;
@@ -820,11 +835,12 @@ static struct compiler default_compilers[] =
    "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0},
   {".s", "@assembler", 0},
   {"@assembler",
-   "%{!M:%{!MM:%{!E:%{!S:as %(asm_options) %i %A }}}}", 0},
+   "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0},
   {".S", "@assembler-with-cpp", 0},
   {"@assembler-with-cpp",
    "%(trad_capable_cpp) -lang-asm %(cpp_options)\
-       %{!M:%{!MM:%{!E:%(invoke_as)}}}", 0},
+      %{!M:%{!MM:%{!E:%{!S:-o %{|!pipe:%g.s} |\n\
+       as %(asm_debug) %(asm_options) %{!pipe:%g.s} %A }}}}", 0},
 #include "specs.h"
   /* Mark end of table */
   {0, 0, 0}
@@ -1327,6 +1343,7 @@ struct spec_list
 static struct spec_list static_specs[] =
 {
   INIT_STATIC_SPEC ("asm",                     &asm_spec),
+  INIT_STATIC_SPEC ("asm_debug",               &asm_debug),
   INIT_STATIC_SPEC ("asm_final",               &asm_final_spec),
   INIT_STATIC_SPEC ("asm_options",             &asm_options),
   INIT_STATIC_SPEC ("invoke_as",               &invoke_as),
index 0876467825540fd93024d9a9e9f717bcff6dcd8d..f442b643a5b452fecaba03fa9da12d874e2ca5f9 100644 (file)
@@ -114,43 +114,6 @@ vms_fopen (fname, type)
 #define fopen vms_fopen
 #endif /* VMS  */
 
-#ifndef DEFAULT_GDB_EXTENSIONS
-#define DEFAULT_GDB_EXTENSIONS 1
-#endif
-
-/* If more than one debugging type is supported, you must define
-   PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
-
-   This is one long line cause VAXC can't handle a \-newline.  */
-#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
-#ifndef PREFERRED_DEBUGGING_TYPE
-You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
-#endif /* no PREFERRED_DEBUGGING_TYPE */
-#else /* Only one debugging format supported.  Define PREFERRED_DEBUGGING_TYPE
-        so the following code needn't care.  */
-#ifdef DBX_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-#endif
-#ifdef SDB_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-#endif
-#ifdef DWARF_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-#endif
-#ifdef XCOFF_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
-#endif
-#endif /* More than one debugger format enabled.  */
-
-/* If still not defined, must have been because no debugging formats
-   are supported.  */
-#ifndef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE NO_DEBUG
-#endif
-
 #if defined (HAVE_DECL_ENVIRON) && !HAVE_DECL_ENVIRON
 extern char **environ;
 #endif