Subject: egcs patch for mipseb support
To: None <tech-toolchain@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-newsmips
Date: 02/12/2000 17:18:25
Hi,

Currently, egcs in our gnusrc tree does not support mipseb target,
and I'm using the attached patch for newsmips.

This patch contains the following changes:

- add macros for mipseb to gnu/dist/gcc/config/mips/netbsd.h and
  switch mipsel/mipseb by -DTARGET_WORDS_BIG_ENDIAN definition
- add -DTARGET_WORDS_BIG_ENDIAN to CPPFLAGS in
  gnu/usr.bin/egcs/Makefile.inc if MACHINE_ARCH=="mipseb"

and more changes to build on dist/gcc:

- add mipseb target to dist/gcc/config.sub
- add mipseb-netbsd target to dist/gcc/configure{.in,}
- add dist/gcc/config/mips/t-mipseb to tmake_file to define
  TARGET_WORDS_BIG_ENDIAN
- set xmake_file=none to avoid to include config/mips/xm-mips.h

(-DTARGET_BIG_ENDIAN is already used in config/mips/mips.h,
  and gcc/config/mips/xm-mips.h defines HOST_WORDS_BIG_ENDIAN
  on mipseb machines.)

If nobody objects, I would like to commit this.
Comments?
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp


--- gnu/dist/gcc/config.sub	Mon Aug 17 02:36:45 1998
+++ /usr/src/gnu/dist/gcc/config.sub	Tue Feb  8 22:39:24 2000
@@ -154,7 +154,7 @@
 		| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
 		| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
 		| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
-		| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
+		| mips64 | mipsel | mipseb | mips64el | mips64orion | mips64orionel \
 		| mipstx39 | mipstx39el \
 		| sparc | sparclet | sparclite | sparc64 | v850)
 		basic_machine=$basic_machine-unknown
@@ -182,7 +182,7 @@
 	      | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
 	      | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
 	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
-	      | sparc64-* | mips64-* | mipsel-* \
+	      | sparc64-* | mips64-* | mipsel-* | mipseb-* \
 	      | mips64el-* | mips64orion-* | mips64orionel-*  \
 	      | mipstx39-* | mipstx39el-* \
 	      | f301-*)
--- gnu/dist/gcc/configure.in	Thu May 27 23:45:00 1999
+++ /usr/src/gnu/dist/gcc/configure.in	Fri Feb 11 00:08:31 2000
@@ -2013,6 +2013,15 @@
 		# On NetBSD, the headers are already okay, except for math.h.
 		fixincludes=fixinc.wrap
 		tmake_file=t-netbsd
+		xmake_file=none
+		;;
+	mipseb-*-netbsd*)
+		tm_file=mips/netbsd.h
+		xm_file=mips/xm-netbsd.h
+		# On NetBSD, the headers are already okay, except for math.h.
+		fixincludes=fixinc.wrap
+		tmake_file="t-netbsd mips/t-mipseb"
+		xmake_file=none
 		;;
 	mips*el-*-openbsd*)	# mips little endian
 		target_cpu_default="MASK_GAS|MASK_ABICALLS"
@@ -2408,6 +2417,7 @@
 		# On NetBSD, the headers are already okay, except for math.h.
 		fixincludes=fixinc.wrap
 		tmake_file=t-netbsd
+		xmake_file=none
 		;;
 	powerpc-*-eabiaix*)
 		tm_file=rs6000/eabiaix.h
--- gnu/dist/gcc/configure	Thu May 27 23:45:00 1999
+++ /usr/src/gnu/dist/gcc/configure	Mon Feb  7 17:43:36 2000
@@ -3992,6 +3992,15 @@
 		# On NetBSD, the headers are already okay, except for math.h.
 		fixincludes=fixinc.wrap
 		tmake_file=t-netbsd
+		xmake_file=none
+		;;
+	mipseb-*-netbsd*)
+		tm_file=mips/netbsd.h
+		xm_file=mips/xm-netbsd.h
+		# On NetBSD, the headers are already okay, except for math.h.
+		fixincludes=fixinc.wrap
+		tmake_file="t-netbsd mips/t-mipseb"
+		xmake_file=none
 		;;
 	mips*el-*-openbsd*)	# mips little endian
 		target_cpu_default="MASK_GAS|MASK_ABICALLS"
@@ -4387,6 +4396,7 @@
 		# On NetBSD, the headers are already okay, except for math.h.
 		fixincludes=fixinc.wrap
 		tmake_file=t-netbsd
+		xmake_file=none
 		;;
 	powerpc-*-eabiaix*)
 		tm_file=rs6000/eabiaix.h
--- gnu/dist/gcc/config/mips/netbsd.h	Wed Sep 29 22:19:13 1999
+++ /usr/src/gnu/dist/gcc/config/mips/netbsd.h	Fri Feb 11 00:25:46 2000
@@ -20,7 +20,11 @@
 
 /* Define default target values. */
 
+#ifdef TARGET_WORDS_BIG_ENDIAN
+#define TARGET_ENDIAN_DEFAULT MASK_BIG_ENDIAN
+#else
 #define TARGET_ENDIAN_DEFAULT 0
+#endif
 #define TARGET_DEFAULT MASK_GAS
 
 #ifdef hpcmips /* XXX should use distinct target name -uch */
@@ -45,10 +49,17 @@
 /* Define mips-specific netbsd predefines... */
 
 #undef CPP_PREDEFINES
+#ifdef TARGET_WORDS_BIG_ENDIAN
+#define CPP_PREDEFINES \
+ "-D__ANSI_COMPAT -DMIPSEB -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD \
+  -D__NetBSD__ -D__ELF__ -Dmips -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
+  -D_R3000 -Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
+#else
 #define CPP_PREDEFINES \
  "-D__ANSI_COMPAT -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD \
   -D__NetBSD__ -D__ELF__ -Dmips -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
   -D_R3000 -Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
+#endif
 
 /* Always uses gas.  */
 
--- gnu/usr.bin/egcs/Makefile.inc	Sun Oct 10 01:10:19 1999
+++ /usr/src/gnu/usr.bin/egcs/Makefile.inc	Wed Feb  9 22:58:51 2000
@@ -44,6 +44,10 @@
 CPPFLAGS+=-DDEFAULT_ELF
 .endif
 
+.if ${MACHINE_ARCH} == "mipseb"
+CPPFLAGS+=-DTARGET_WORDS_BIG_ENDIAN
+.endif
+
 .if (${MACHINE} == "hpcmips") # XXX
 CPPFLAGS+=-D${MACHINE}
 HOST_CPPFLAGS += -D${MACHINE}
--- /dev/null	Thu Feb 10 03:41:03 2000
+++ /usr/src/gnu/dist/gcc/config/mips/t-mipseb	Wed Feb  9 23:00:31 2000
@@ -0,0 +1 @@
+T_CFLAGS +=-DTARGET_WORDS_BIG_ENDIAN