ARM EABI support for RTEMS

Message ID
State New
Headers show

Commit Message

Sebastian Huber Nov. 4, 2011, 9:38 a.m.

please have a look at the attached patch.  It is intended for inclusion in the 
GCC 4.7 branch.  The embedded brains GmbH has a copyright assignment with the FSF.

I was not able to test this patch with the latest snapshot due to this:

/home/sh/archive/gcc-4.7-20111029/libgcc/unwind-dw2.c: In function 
/home/sh/archive/gcc-4.7-20111029/libgcc/unwind-dw2.c:1482:39: internal 
compiler error: in arm_dbx_register_number, at config/arm/arm.c:23536

Kind regards,


Ramana Radhakrishnan Nov. 4, 2011, 11:43 a.m. | #1
> /home/sh/archive/gcc-4.7-20111029/libgcc/unwind-dw2.c: In function
> 'init_dwarf_reg_size_table':
> /home/sh/archive/gcc-4.7-20111029/libgcc/unwind-dw2.c:1482:39: internal
> compiler error: in arm_dbx_register_number, at config/arm/arm.c:23536

Your original post in this thread suggested that you wanted to switch
the rtems port to use the AAPCS .

If the above is what was intended this is not the right way of
achieving it because you are missing an include of bpabi.h which sets
ARM_DEFAULT_ABI to ARM_ABI_AAPCS and a raft of other pre-processor
defines that you need to get the backend in the right form for using
the AAPCS implementation. The other problem is that you aren't using
the right unwind info which is why you are hitting this issue because
it just uses the standard eh_frame implementation .Look at how this is
done in libgcc/

Therefore no - if this is intended to switch rtems to ABI_AAPCS
completely I don't think this is the right way of doing this.



2011-11-04	Sebastian Huber <>

	* config.gcc (arm*-*-rtemseabi*): New target.
	* config/arm/rtems-eabi.h: New.
	* config/arm/t-rtems-eabi: New.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 2c18655..6bdc025 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -904,7 +904,7 @@  arm*-*-ecos-elf)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h"
 	tmake_file="arm/t-arm arm/t-arm-elf"
-arm*-*-eabi* | arm*-*-symbianelf* )
+arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi* )
 	# The BPABI long long divmod functions return a 128-bit value in
 	# registers r0-r3.  Correctly modeling that requires the use of
 	# TImode.
@@ -919,6 +919,10 @@  arm*-*-eabi* | arm*-*-symbianelf* )
 	  tmake_file="${tmake_file} arm/t-bpabi"
+	arm*-*-rtemseabi*)
+	  tm_file="${tm_file} rtems.h arm/rtems-eabi.h newlib-stdint.h"
+	  tmake_file="${tmake_file} arm/t-bpabi arm/t-rtems-eabi"
+	  ;;
 	  tm_file="${tm_file} arm/symbian.h"
 	  libgcc_tm_file="$libgcc_tm_file arm/symbian-lib.h"
diff --git a/gcc/config/arm/rtems-eabi.h b/gcc/config/arm/rtems-eabi.h
new file mode 100644
index 0000000..ced98a9
--- /dev/null
+++ b/gcc/config/arm/rtems-eabi.h
@@ -0,0 +1,29 @@ 
+/* Definitions for RTEMS based ARM systems using EABI.
+   Copyright (C) 2011 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
+   <>.  */
+    do {					\
+	builtin_define ("__rtems__");		\
+	builtin_define ("__USE_INIT_FINI__");	\
+	builtin_assert ("system=rtems");	\
+    } while (0)
diff --git a/gcc/config/arm/t-rtems-eabi b/gcc/config/arm/t-rtems-eabi
new file mode 100644
index 0000000..f0e714a
--- /dev/null
+++ b/gcc/config/arm/t-rtems-eabi
@@ -0,0 +1,8 @@ 
+# Custom RTEMS EABI multilibs
+MULTILIB_OPTIONS    = mthumb march=armv6-m/march=armv7/march=armv7-m
+MULTILIB_DIRNAMES   = thumb armv6-m armv7 armv7-m
+MULTILIB_EXCEPTIONS = march=armv6-m march=armv7 march=armv7-m