Patchwork [1/6] Andes nds32: configure settings for nds32 target.

login
register
mail settings
Submitter Chung-Ju Wu
Date Sept. 8, 2013, 4:12 p.m.
Message ID <522CA1DF.5050401@gmail.com>
Download mbox | patch
Permalink /patch/273445/
State New
Headers show

Comments

Chung-Ju Wu - Sept. 8, 2013, 4:12 p.m.
On 7/24/13 11:46 PM, Chung-Ju Wu wrote:
> On 7/10/13 6:56 AM, Joseph S. Myers wrote:
>> On Mon, 8 Jul 2013, Chung-Ju Wu wrote:
>
> Thanks for the review comments.
> A revised patch is provided and here is a summary:
> 
>   1. Handle -march option within the compiler proper.
>      Simplify the handling of --with-arch in config.gcc.
>   2. The c-isr library is supported for all arch configuration.
>   3. Use tm_defines so that we can have only one t-mlibs used.
> 
> 

It has been a while since last v2 patch.
So I create a new v3 patch to resolve conflict with current trunk.

Is it OK to apply on the trunk?


Best regards,
jasonwucj

Patch

diff --git contrib/config-list.mk contrib/config-list.mk
index 9a141c2..08acc35 100644
--- contrib/config-list.mk
+++ contrib/config-list.mk
@@ -43,7 +43,9 @@  LIST = aarch64-elf aarch64-linux-gnu \
   mipsisa64-elfoabi mipsisa64r2el-elf mipsisa64sr71k-elf mipsisa64sb1-elf \
   mipsel-elf mips64-elf mips64vr-elf mips64orion-elf mips-rtems \
   mips-wrs-vxworks mipstx39-elf mmix-knuth-mmixware mn10300-elf moxie-elf \
-  moxie-uclinux moxie-rtems pdp11-aout picochip-elfOPT-enable-obsolete \
+  moxie-uclinux moxie-rtems \
+  nds32le-elf nds32be-elf \
+  pdp11-aout picochip-elfOPT-enable-obsolete \
   powerpc-darwin8 \
   powerpc-darwin7 powerpc64-darwin powerpc-freebsd6 powerpc-netbsd \
   powerpc-eabispe powerpc-eabisimaltivec powerpc-eabisim ppc-elf \
diff --git gcc/config.gcc gcc/config.gcc
index 36d5ae8..6ea8bba 100644
--- gcc/config.gcc
+++ gcc/config.gcc
@@ -418,6 +418,10 @@  mips*-*-*)
 	extra_headers="loongson.h"
 	extra_options="${extra_options} g.opt mips/mips-tables.opt"
 	;;
+nds32*)
+	cpu_type=nds32
+	extra_headers="nds32_intrinsic.h"
+	;;
 picochip-*-*)
         cpu_type=picochip
         ;;
@@ -2030,6 +2034,18 @@  mn10300-*-*)
 	use_collect2=no
 	use_gcc_stdint=wrap
 	;;
+nds32le-*-*)
+	target_cpu_default="0"
+	tm_defines="${tm_defines}"
+	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+	tmake_file="nds32/t-mlibs"
+	;;
+nds32be-*-*)
+	target_cpu_default="0|MASK_BIG_ENDIAN"
+	tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+	tmake_file="nds32/t-mlibs"
+	;;
 pdp11-*-*)
 	tm_file="${tm_file} newlib-stdint.h"
 	use_gcc_stdint=wrap
@@ -3645,6 +3661,39 @@  case "${target}" in
 		esac
 		;;
 
+	nds32*-*-*)
+		supported_defaults="arch nds32_lib"
+
+		# process --with-arch
+		case "${with_arch}" in
+		"" | v2 | v3 | v3m)
+			# OK
+			;;
+		*)
+			echo "Cannot accept --with-arch=$with_arch, available values are: v2 v3 v3m" 1>&2
+			exit 1
+			;;
+		esac
+
+		# process --with-nds32-lib
+		case "${with_nds32_lib}" in
+		"")
+			# the default library is newlib
+			with_nds32_lib=newlib
+			;;
+		newlib)
+			# OK
+			;;
+		mculib)
+			# OK
+			;;
+		*)
+			echo "Cannot accept --with-nds32-lib=$with_nds32_lib, available values are: newlib mculib" 1>&2
+			exit 1
+			;;
+		esac
+		;;
+
 	powerpc*-*-* | rs6000-*-*)
 		supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
 
diff --git libgcc/config.host libgcc/config.host
index 187391e..20f56d2 100644
--- libgcc/config.host
+++ libgcc/config.host
@@ -137,6 +137,9 @@  mips*-*-*)
 	cpu_type=mips
 	tmake_file=mips/t-mips
 	;;
+nds32*-*)
+	cpu_type=nds32
+	;;
 powerpc*-*-*)
 	cpu_type=rs6000
 	;;
@@ -831,6 +834,29 @@  moxie-*-rtems*)
 	# Don't use default.
 	extra_parts=
 	;;
+nds32*-elf*)
+	# Basic makefile fragment and extra_parts for crt stuff.
+	# We also append c-isr library implementation.
+	tmake_file="${tmake_file} nds32/t-nds32 nds32/t-nds32-isr"
+	extra_parts="crtbegin1.o crtend1.o libnds32_isr.a"
+	# Append library definition makefile fragment according to --with-nds32-lib=X setting.
+	case "${with_nds32_lib}" in
+	"" | newlib)
+		# Append library definition makefile fragment t-nds32-newlib.
+		# Append 'soft-fp' software floating point make rule fragment provided by gcc.
+		tmake_file="${tmake_file} nds32/t-nds32-newlib t-softfp-sfdf t-softfp"
+		;;
+	mculib)
+		# Append library definition makefile fragment t-nds32-mculib.
+		# The software floating point library is included in mculib.
+		tmake_file="${tmake_file} nds32/t-nds32-mculib"
+		;;
+	*)
+		echo "Cannot accept --with-nds32-lib=$with_nds32_lib, available values are: newlib mculib" 1>&2
+		exit 1
+		;;
+	esac
+	;;
 pdp11-*-*)
 	tmake_file="pdp11/t-pdp11 t-fdpbit"
 	;;