Hi

I don't seem to have any luck building epiphany tools for either
epiphany-rtems4.12 or epiphany-elf on the master of binutils-gdb,
gcc, and newlib. I am posting the current "add rtems" patch for
posterity. It looks like epiphany-elf isn't supported by upstream
binutils yet but it is in gdb.

--joel
From 195ddfb96042cc934b9b29811c88adbcc6a3fa7a Mon Sep 17 00:00:00 2001
From: Joel Sherrill <j...@rtems.org>
Date: Sun, 20 Mar 2016 10:55:59 -0500
Subject: [PATCH] 2015-02-24  Hesham ALMatary  <heshamelmat...@gmail.com>

	* config.gcc: Add Epiphany RTEMS target.
	* config/epiphany/rtems.h: New file.
	* config/epiphany/t-rtems: Add new dummy epiphany/t-rtems file.

2015-02-24  Hesham ALMatary  <heshamelmat...@gmail.com>

	* config.host: Add Epiphany RTEMS target.
---
 gcc/config.gcc                 | 12 +++++++++---
 gcc/config/epiphany/epiphany.h |  2 ++
 gcc/config/epiphany/rtems.h    | 33 +++++++++++++++++++++++++++++++++
 gcc/config/epiphany/t-rtems    |  1 +
 libgcc/config.host             |  2 +-
 5 files changed, 46 insertions(+), 4 deletions(-)
 create mode 100644 gcc/config/epiphany/rtems.h
 create mode 100644 gcc/config/epiphany/t-rtems

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6722260..1844da8 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1201,13 +1201,19 @@ crisv32-*-linux* | cris-*-linux*)
 		;;
 	esac
 	;;
-epiphany-*-elf )
-	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
-	tmake_file="epiphany/t-epiphany"
+epiphany-*-elf | epiphany-*-rtems*)
+	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
+	tmake_file="${tmake_file} epiphany/t-epiphany"
 	extra_options="${extra_options} fused-madd.opt"
 	extra_objs="$extra_objs mode-switch-use.o resolve-sw-modes.o"
 	tm_defines="${tm_defines} EPIPHANY_STACK_OFFSET=${with_stack_offset:-8}"
 	extra_headers="epiphany_intrinsics.h"
+	case ${target} in
+	  epiphany-*-rtems*)
+		tm_file="${tm_file} epiphany/rtems.h rtems.h"
+		tmake_file="${tmake_file} epiphany/t-rtems"
+		;;
+	esac
 	;;
 fr30-*-elf)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
diff --git a/gcc/config/epiphany/epiphany.h b/gcc/config/epiphany/epiphany.h
index 9e7ee50..289dc81 100644
--- a/gcc/config/epiphany/epiphany.h
+++ b/gcc/config/epiphany/epiphany.h
@@ -700,8 +700,10 @@ typedef struct GTY (()) machine_function
 #define TEXT_SECTION_ASM_OP	"\t.section .text"
 #define DATA_SECTION_ASM_OP	"\t.section .data"
 
+#if 0
 #undef  READONLY_DATA_SECTION_ASM_OP
 #define READONLY_DATA_SECTION_ASM_OP	"\t.section .rodata"
+#endif
 
 #define BSS_SECTION_ASM_OP	"\t.section .bss"
 
diff --git a/gcc/config/epiphany/rtems.h b/gcc/config/epiphany/rtems.h
new file mode 100644
index 0000000..c2cb4bd
--- /dev/null
+++ b/gcc/config/epiphany/rtems.h
@@ -0,0 +1,33 @@
+/* Definitions for rtems targeting a RTEMS using ELF.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by Joel Sherrill (j...@oarcorp.com).
+
+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/>.  */
+
+/* Target OS builtins.  */
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+	builtin_define ("__rtems__");		\
+	builtin_define ("__USE_INIT_FINI__");	\
+	builtin_assert ("system=rtems");	\
+    }						\
+  while (0)
+
+/* Use the default */
+#undef LINK_GCC_C_SEQUENCE_SPEC
diff --git a/gcc/config/epiphany/t-rtems b/gcc/config/epiphany/t-rtems
new file mode 100644
index 0000000..d0c3826
--- /dev/null
+++ b/gcc/config/epiphany/t-rtems
@@ -0,0 +1 @@
+# Custom multilibs for RTEMS
diff --git a/libgcc/config.host b/libgcc/config.host
index b61a579..13588fa 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -471,7 +471,7 @@ cris-*-elf)
 cris-*-linux* | crisv32-*-linux*)
 	tmake_file="$tmake_file cris/t-cris t-softfp-sfdf t-softfp cris/t-linux"
 	;;
-epiphany-*-elf*)
+epiphany-*-elf* | epiphany-*-rtems*)
 	tmake_file="epiphany/t-epiphany t-fdpbit epiphany/t-custom-eqsf"
 	extra_parts="$extra_parts crti.o crtint.o crtrunc.o crtm1reg-r43.o crtm1reg-r63.o crtn.o"
 	;;
-- 
1.8.3.1

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to