[PATCH] RTEMS: Use strict DWARF-2 on ARM, PowerPC, SPARC

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jun 18 11:58:02 UTC 2013


Some debuggers do not cope with the new DWARF3/4 debug format introduced
with GCC 4.8.  Default to strict DWARF-2 on ARM, PowerPC and SPARC for
now.

This patch should be committed to GCC 4.8 and 4.9.

gcc/ChangeLog
2013-06-18  Sebastian Huber  <sebastian.huber at embedded-brains.de>

	* config/rtems.c: New.
	* config.gcc (*-*-rtems*): Set extra_objs.
	* config/rtems.h (rtems_override_options): Declare.
	(RTEMS_OVERRIDE_OPTIONS): Define.
	* config/t-rtems (rtems.o): New.
	* config/arm/rtems-eabi.h (SUBTARGET_OVERRIDE_OPTIONS): Define.
	* config/rs6000/rtems.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Define.
	* config/sparc/rtemself.h (SUBTARGET_OVERRIDE_OPTIONS): Define.
---
 gcc/config.gcc              |    1 +
 gcc/config/arm/rtems-eabi.h |    3 +++
 gcc/config/rs6000/rtems.h   |    3 +++
 gcc/config/rtems.c          |   37 +++++++++++++++++++++++++++++++++++++
 gcc/config/rtems.h          |    4 ++++
 gcc/config/sparc/rtemself.h |    3 +++
 gcc/config/t-rtems          |    4 ++++
 7 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100644 gcc/config/rtems.c

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 1a0be50..6394551 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -734,6 +734,7 @@ case ${target} in
     yes) thread_file='rtems' ;;
   esac
   extra_options="${extra_options} rtems.opt"
+  extra_objs="rtems.o"
   use_gcc_stdint=wrap
   ;;
 *-*-uclinux*)
diff --git a/gcc/config/arm/rtems-eabi.h b/gcc/config/arm/rtems-eabi.h
index 77fcf1a..a7ccdae 100644
--- a/gcc/config/arm/rtems-eabi.h
+++ b/gcc/config/arm/rtems-eabi.h
@@ -27,3 +27,6 @@
 	builtin_assert ("system=rtems");	\
 	TARGET_BPABI_CPP_BUILTINS();    	\
     } while (0)
+
+#undef SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS RTEMS_OVERRIDE_OPTIONS
diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h
index b910b5e..cf53592 100644
--- a/gcc/config/rs6000/rtems.h
+++ b/gcc/config/rs6000/rtems.h
@@ -34,6 +34,9 @@
     }                                     \
   while (0)
 
+#undef SUBSUBTARGET_OVERRIDE_OPTIONS
+#define SUBSUBTARGET_OVERRIDE_OPTIONS RTEMS_OVERRIDE_OPTIONS
+
 #undef CPP_OS_DEFAULT_SPEC
 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_rtems)"
 
diff --git a/gcc/config/rtems.c b/gcc/config/rtems.c
new file mode 100644
index 0000000..4250ba3
--- /dev/null
+++ b/gcc/config/rtems.c
@@ -0,0 +1,37 @@
+/* Common RTEMS target definitions for GNU compiler.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "target.h"
+#include "tm.h"
+
+void
+rtems_override_options (void)
+{
+  /* Use strict DWARF-2 unless specifically selected.  This is a
+     workaround for a lack of tool support.  */
+
+  if (!global_options_set.x_dwarf_strict)
+    dwarf_strict = 1;
+
+  if (!global_options_set.x_dwarf_version)
+    dwarf_version = 2;
+}
diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h
index 4d94f82..8ea97fe 100644
--- a/gcc/config/rtems.h
+++ b/gcc/config/rtems.h
@@ -43,3 +43,7 @@ along with GCC; see the file COPYING3.  If not see
  -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}"
 
 #define TARGET_POSIX_IO
+
+/* Do RTEMS specific parts of TARGET_OPTION_OVERRIDE.  */
+extern void rtems_override_options (void);
+#define RTEMS_OVERRIDE_OPTIONS rtems_override_options ()
diff --git a/gcc/config/sparc/rtemself.h b/gcc/config/sparc/rtemself.h
index 7a69dfa..2ee939c 100644
--- a/gcc/config/sparc/rtemself.h
+++ b/gcc/config/sparc/rtemself.h
@@ -29,5 +29,8 @@ along with GCC; see the file COPYING3.  If not see
     }						\
   while (0)
 
+#undef SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS RTEMS_OVERRIDE_OPTIONS
+
 /* Use the default */
 #undef LINK_GCC_C_SEQUENCE_SPEC
diff --git a/gcc/config/t-rtems b/gcc/config/t-rtems
index baa00d8..5a8e88a 100644
--- a/gcc/config/t-rtems
+++ b/gcc/config/t-rtems
@@ -1,2 +1,6 @@
 # RTEMS always has limits.h.
 LIMITS_H_TEST = true
+
+rtems.o: $(srcdir)/config/rtems.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+	$(TARGET_H) $(TM_H)
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-- 
1.7.7




More information about the devel mailing list