From 5f0e9ea2789c1f2c3e28497a906857c3ba89564a Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Tue, 20 Nov 2001 10:16:09 +0000 Subject: [PATCH] configure.in (HAVE_AS_GDWARF2_DEBUG_FLAG): Define. * 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 | 14 +++++++++++ gcc/config.in | 5 ++++ gcc/configure | 61 ++++++++++++++++++++++++++++++++++++++++++++++-- gcc/configure.in | 51 ++++++++++++++++++++++++++++++++++++++++ gcc/defaults.h | 37 +++++++++++++++++++++++++++++ gcc/gcc.c | 21 +++++++++++++++-- gcc/toplev.c | 37 ----------------------------- 7 files changed, 185 insertions(+), 41 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 25d452fbae6..bab397a8a19 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2001-11-19 Geoffrey Keating + + * 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 * config.gcc (*-*-freebsd*): Remove configuration block. diff --git a/gcc/config.in b/gcc/config.in index 8fa5f3aa1e6..e3fde00baeb 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -569,6 +569,11 @@ /* 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 diff --git a/gcc/configure b/gcc/configure index 74781d6c564..7d2ae9de10f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -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 <&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" diff --git a/gcc/configure.in b/gcc/configure.in index f50695ad84d..fb022ff0293 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -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 diff --git a/gcc/defaults.h b/gcc/defaults.h index bda763fe1b1..b83f25e2e39 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -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 */ diff --git a/gcc/gcc.c b/gcc/gcc.c index fc9ee62a02c..62ff7d03dfe 100644 --- 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), diff --git a/gcc/toplev.c b/gcc/toplev.c index 08764678255..f442b643a5b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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 -- 2.30.2