Patchwork ARC port (1/5): configuration file patches

login
register
mail settings
Submitter Joern Rennecke
Date Oct. 24, 2012, 3:12 a.m.
Message ID <20121023231235.c1lkwc0vkssk04gw-nzlynne@webmail.spamcop.net>
Download mbox | patch
Permalink /patch/193644/
State New
Headers show

Comments

Joern Rennecke - Oct. 24, 2012, 3:12 a.m.
Prerequisites to allow the port to build properly: the lock_length attribute:

http://gcc.gnu.org/ml/gcc-patches/2012-10/msg01890.html
http://gcc.gnu.org/ml/gcc-patches/2012-10/msg02120.html

And from Easwaran Raman  <eraman@google.com>:
         PR middle-end/54957
         * optabs.c (emit_cmp_and_jump_insn_1): Remove bogus assert.
         * stmt.c (get_outgoing_edge_probs): Check default_edge / stmt_bb
         for NULL before dereferencing.
         (emit_case_dispatch_table): Check default_edge for NULL before
         dereferencing.
         Provide sane basic block parameter to emit_case_dispatch_table.

http://gcc.gnu.org/bugzilla/attachment.cgi?id=28466

For testing the ARC port, most recently I have been using revision
192641 as a GCC baseline.

The other pieces of the toolchain can be found at:
https://github.com/foss-for-synopsys-dwc-arc-processors
There is also a gcc port there, but it's an older one, based on GCC 4.4 .
The intention is to eventually contribute all parts of the GNU toolchain
to the FSF, but some pieces need redesigning first, e.g. variable size
fragment handling (or the current lack thereof) in the gas port.

I hope I can polish up the port a bit more before the 4.8 code feature
freeze, but right now the priority is get the required infrastructure for
branch shortening hashed out.  And for this, it is useful for everyone
to be able to look at the ARC port - so here it is.
libgcc:

2012-10-09  Joern Rennecke  <joern.rennecke@embecosm.com>

	* config.host (arc-*-elf*, arc*-*-linux-uclibc*): New configurations.
gcc:

2012-10-09  Joern Rennecke  <joern.rennecke@embecosm.com>
	    Brendan Kehoe  <brendan@zen.org>

	* config.gcc (arc-*-elf*, arc*-*-linux-uclibc*): New configurations.

gcc/testsuite:

2012-08-17  Joern Rennecke  <joern.rennecke@embecosm.com>

	* gcc.c-torture/execute/20101011-1.c [__arc__] (DO_TEST): Define as 0.

libstdc++-v3:

2012-08-16  Joern Rennecke  <joern.rennecke@embecosm.com>
	* acinclude.m4 (GLIBCXX_ENABLE_SJLJ_EXCEPTIONS): Also check for
	_Unwind_SjLj_Register when deciding if to set enable_sjlj_exceptions.
	* configure: Regenerate.
Joseph S. Myers - Oct. 24, 2012, 4:46 p.m.
On Tue, 23 Oct 2012, Joern Rennecke wrote:

> +	tm_file="dbxelf.h elfos.h linux.h  ${tm_file}"

Should be using gnu-user.h linux.h glibc-stdint.h, not linux.h on its own.

Patch

Index: libgcc/config.host
===================================================================
--- libgcc/config.host	(revision 2572)
+++ libgcc/config.host	(working copy)
@@ -303,6 +303,14 @@ 
 	extra_parts="$extra_parts vms-dwarf2.o vms-dwarf2eh.o"
 	md_unwind_header=alpha/vms-unwind.h
 	;;
+arc-*-elf*)
+	tmake_file="arc/t-arc-newlib arc/t-arc"
+	extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o libgmon.a crtg.o crtgend.o"
+	;;
+arc*-*-linux-uclibc*)
+	tmake_file="${tmake_file} t-slibgcc-libgcc t-slibgcc-nolc-override arc/t-arc700-uClibc arc/t-arc"
+	extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o libgmon.a crtg.o crtgend.o"
+	;;
 arm-wrs-vxworks)
 	tmake_file="$tmake_file arm/t-arm arm/t-vxworks t-fdpbit"
 	extra_parts="$extra_parts crti.o crtn.o"
Index: gcc/testsuite/gcc.c-torture/execute/20101011-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/20101011-1.c	(revision 2572)
+++ gcc/testsuite/gcc.c-torture/execute/20101011-1.c	(working copy)
@@ -36,6 +36,9 @@ 
 #elif defined (__CRIS__)
   /* No SIGFPE for CRIS integer division.  */
 # define DO_TEST 0
+#elif defined (__arc__)
+  /* No SIGFPE for ARC integer division.  */
+# define DO_TEST 0
 #elif defined (__arm__) && defined (__ARM_EABI__)
 # ifdef __ARM_ARCH_EXT_IDIV__
   /* Hardware division instructions may not trap, and handle trapping
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 2572)
+++ gcc/config.gcc	(working copy)
@@ -813,6 +813,39 @@ 
 	tm_file="${tm_file} vms/vms.h alpha/vms.h"
 	tmake_file="${tmake_file} alpha/t-vms"
 	;;
+arc-*-elf*)
+	extra_headers="arc-simd.h"
+	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+	tmake_file="arc/t-arc-newlib arc/t-arc"
+	case x"${with_cpu}" in
+	  xarc600|xarc601|xarc700)
+		target_cpu_default="TARGET_CPU_$with_cpu"
+		;;
+	esac
+	;;
+arc*-*-linux-uclibc*)
+	extra_headers="arc-simd.h"
+	tm_file="dbxelf.h elfos.h linux.h  ${tm_file}"
+	tmake_file="arc/t-arc-uClibc arc/t-arc"
+	case x"${with_cpu}" in
+	  xarc600|xarc601|xarc700)
+		target_cpu_default="TARGET_CPU_$with_cpu"
+		;;
+	esac
+	if test x${with_endian} = x; then
+		case ${target} in
+		arc*be-*-* | arc*eb-*-*)	with_endian=big ;;
+		*)				with_endian=little ;;
+		esac
+	fi
+	case ${with_endian} in
+	big|little)		;;
+	*)	echo "with_endian=${with_endian} not supported."; exit 1 ;;
+	esac
+	case ${with_endian} in
+	big*)	tm_defines="DRIVER_ENDIAN_SELF_SPECS=\\\"%{!EL:%{!mlittle-endian:-mbig-endian}}\\\" ${tm_defines}"
+	esac
+        ;;
 arm-wrs-vxworks)
 	tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h"
 	extra_options="${extra_options} arm/vxworks.opt"
@@ -2976,6 +3009,17 @@ 
 		done
 		;;
 
+	arc*-*-*) # was:	arc*-*-linux-uclibc)
+		supported_defaults="cpu"
+		case $with_cpu in
+		  arc600|arc601|arc700)
+			;;
+		  *) echo "Unknown cpu type"
+			exit 1
+			;;
+		esac
+		;;
+
 	arm*-*-*)
 		supported_defaults="arch cpu float tune fpu abi mode tls"
 		for which in cpu tune; do
Index: libstdc++-v3/acinclude.m4
===================================================================
--- libstdc++-v3/acinclude.m4	(revision 2572)
+++ libstdc++-v3/acinclude.m4	(working copy)
@@ -2927,6 +2927,8 @@  void foo()
     if AC_TRY_EVAL(ac_compile); then
       if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
 	enable_sjlj_exceptions=yes
+      elif grep _Unwind_SjLj_Register conftest.s >/dev/null 2>&1 ; then
+	enable_sjlj_exceptions=yes
       elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
 	enable_sjlj_exceptions=no
       elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then