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]

[PATCH 03/12] remove conditional compilation of sdb debug info


From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

We need to include gsyms.h before tm.h because some targets (rl78 iirc) define
macros that conflict with identifiers in gsyms.h.  This means sdbout.c won't
produce correct output for those targets, but it previously couldn't either
because it wasn't compiled at all.

gcc/ChangeLog:

2015-11-09  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* defaults.h: New definition of SDB_DEBUGGING_INFO.
	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in: Adjust.
	* final.c (rest_of_clean_state): Remove check if
	SDB_DEBUGGING_INFO is defined.
	* function.c (number_blocks): Likewise.
	* output.h: Likewise.
	* sdbout.c: Likewise.
	* toplev.c (process_options): Likewise.
---
 gcc/defaults.h     | 8 ++++++--
 gcc/doc/tm.texi    | 2 +-
 gcc/doc/tm.texi.in | 2 +-
 gcc/final.c        | 6 +-----
 gcc/function.c     | 2 +-
 gcc/output.h       | 2 --
 gcc/sdbout.c       | 6 +-----
 gcc/toplev.c       | 6 +-----
 8 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index cee799d..ddda89a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -914,10 +914,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define DEFAULT_GDB_EXTENSIONS 1
 #endif
 
+#ifndef SDB_DEBUGGING_INFO
+#define SDB_DEBUGGING_INFO 0
+#endif
+
 /* If more than one debugging type is supported, you must define
    PREFERRED_DEBUGGING_TYPE to choose the default.  */
 
-#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) \
+#if 1 < (defined (DBX_DEBUGGING_INFO) + (SDB_DEBUGGING_INFO) \
          + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) \
          + defined (VMS_DEBUGGING_INFO))
 #ifndef PREFERRED_DEBUGGING_TYPE
@@ -929,7 +933,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #elif defined DBX_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
 
-#elif defined SDB_DEBUGGING_INFO
+#elif SDB_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
 
 #elif defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 5609a98..a174e21 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9567,7 +9567,7 @@ whose value is the highest absolute text address in the file.
 Here are macros for SDB and DWARF output.
 
 @defmac SDB_DEBUGGING_INFO
-Define this macro if GCC should produce COFF-style debugging output
+Define this macro to 1 if GCC should produce COFF-style debugging output
 for SDB in response to the @option{-g} option.
 @end defmac
 
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 96ca063a..9c13e9b 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -6992,7 +6992,7 @@ whose value is the highest absolute text address in the file.
 Here are macros for SDB and DWARF output.
 
 @defmac SDB_DEBUGGING_INFO
-Define this macro if GCC should produce COFF-style debugging output
+Define this macro to 1 if GCC should produce COFF-style debugging output
 for SDB in response to the @option{-g} option.
 @end defmac
 
diff --git a/gcc/final.c b/gcc/final.c
index 30b3826..2f57b1b 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -88,9 +88,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dbxout.h"
 #endif
 
-#ifdef SDB_DEBUGGING_INFO
 #include "sdbout.h"
-#endif
 
 /* Most ports that aren't using cc0 don't need to define CC_STATUS_INIT.
    So define a null default for it to save conditionalization later.  */
@@ -4644,10 +4642,8 @@ rest_of_clean_state (void)
   /* In case the function was not output,
      don't leave any temporary anonymous types
      queued up for sdb output.  */
-#ifdef SDB_DEBUGGING_INFO
-  if (write_symbols == SDB_DEBUG)
+  if (SDB_DEBUGGING_INFO && write_symbols == SDB_DEBUG)
     sdbout_types (NULL_TREE);
-#endif
 
   flag_rerun_cse_after_global_opts = 0;
   reload_completed = 0;
diff --git a/gcc/function.c b/gcc/function.c
index a637cb3..afc2c87 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4671,7 +4671,7 @@ number_blocks (tree fn)
   /* For SDB and XCOFF debugging output, we start numbering the blocks
      from 1 within each function, rather than keeping a running
      count.  */
-#if defined (SDB_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
+#if SDB_DEBUGGING_INFO || defined (XCOFF_DEBUGGING_INFO)
   if (write_symbols == SDB_DEBUG || write_symbols == XCOFF_DEBUG)
     next_block_index = 1;
 #endif
diff --git a/gcc/output.h b/gcc/output.h
index f6a576c..d485cd6 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -309,9 +309,7 @@ extern rtx_sequence *final_sequence;
 /* The line number of the beginning of the current function.  Various
    md code needs this so that it can output relative linenumbers.  */
 
-#ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers.  */
 extern int sdb_begin_function_line;
-#endif
 
 /* File in which assembler code is being written.  */
 
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index e495a8a..f22bc7c 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -42,6 +42,7 @@ AT&T C compiler.  From the example below I would conclude the following:
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "gsyms.h"
 #include "tm.h"
 #include "debug.h"
 #include "tree.h"
@@ -65,8 +66,6 @@ static GTY(()) vec<tree, va_gc> *deferred_global_decls;
 static GTY(()) tree preinit_symbols;
 static GTY(()) bool sdbout_initialized;
 
-#ifdef SDB_DEBUGGING_INFO
-
 #include "rtl.h"
 #include "regs.h"
 #include "flags.h"
@@ -75,7 +74,6 @@ static GTY(()) bool sdbout_initialized;
 #include "output.h"
 #include "diagnostic-core.h"
 #include "tm_p.h"
-#include "gsyms.h"
 #include "langhooks.h"
 #include "target.h"
 
@@ -1648,6 +1646,4 @@ sdbout_init (const char *input_file_name ATTRIBUTE_UNUSED)
   preinit_symbols = 0;
 }
 
-#endif /* SDB_DEBUGGING_INFO */
-
 #include "gt-sdbout.h"
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 140e36f..b18d93e 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -80,9 +80,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dbxout.h"
 #endif
 
-#ifdef SDB_DEBUGGING_INFO
 #include "sdbout.h"
-#endif
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"		/* Needed for external data declarations. */
@@ -1378,10 +1376,8 @@ process_options (void)
   else if (write_symbols == XCOFF_DEBUG)
     debug_hooks = &xcoff_debug_hooks;
 #endif
-#ifdef SDB_DEBUGGING_INFO
-  else if (write_symbols == SDB_DEBUG)
+  else if (SDB_DEBUGGING_INFO && write_symbols == SDB_DEBUG)
     debug_hooks = &sdb_debug_hooks;
-#endif
 #ifdef DWARF2_DEBUGGING_INFO
   else if (write_symbols == DWARF2_DEBUG)
     debug_hooks = &dwarf2_debug_hooks;
-- 
2.5.0.rc1.5.gc07173f


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