hello world on sh4-unknown-linux-gnu

kaz Kojima kkojima@rr.iij4u.or.jp
Fri Apr 6 18:00:00 GMT 2001


Alexandre Petit-Bianco <apbianco@cygnus.com> wrote:
> Can you send us patches when you get a chance to? Which version of gcc
> can be patched to produce a working toolchain?

Of course, I'd like to do so. I'll append tiny patches for boehm-gc
and libffi. New files in libffi/src/sh are put as
 http://dodo.nurs.or.jp/~kkojima/gnu-on-sh/gcc-cvs-libffi-sh-2add.tar.gz
though I've tested this libffi stuff for the little endian SH-4 only.
About gcc, I'm using the 20000330 version of cvs. I'll post the patches
needed to make gcj working to the gcc-patches mailing list.
	kaz
--
[boem-gc]
	* gcconfig.h: Add SH Linux.
[libffi]
	* configure.in: Add sh*-*-linux-* target.
	* Makefile.am: Add SH Linux target.
	* ffi.h.in: Likewise.
Index: gcconfig.h
===================================================================
RCS file: /cvs/gcc/egcs/boehm-gc/gcconfig.h,v
retrieving revision 1.16
diff -u -r1.16 gcconfig.h
--- gcconfig.h	2001年03月21日 18:38:16	1.16
+++ gcconfig.h	2001年04月06日 22:52:27
@@ -170,6 +170,10 @@
 # define ARM32
 # define mach_type_known
 # endif
+# if defined(LINUX) && defined(__sh__)
+# define SH
+# define mach_type_known
+# endif
 # if defined(__alpha) || defined(__alpha__)
 # define ALPHA
 # if !defined(LINUX)
@@ -342,6 +346,7 @@
 		 /* 		 ARM32 ==> Intel StrongARM	*/
 		 /* 		 IA64	 ==> Intel IA64		*/
 		 /*				 (e.g. Itanium)	*/
+		 /* 		 SH ==> Hitachi SuperH	*/
 
 
 /*
@@ -1221,6 +1226,22 @@
 # endif
 # endif
 #endif
+
+# ifdef SH
+# define CPP_WORDSZ 32
+# define MACH_TYPE "SH"
+# define ALIGNMENT 4
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define STACKBOTTOM ((ptr_t) 0x7c000000)
+# define USE_GENERIC_PUSH_REGS
+# define DYNAMIC_LOADING
+#	include <features.h>
+#	define LINUX_DATA_START
+	extern int _end;
+#	define DATAEND (&_end)
+# endif
+# endif
 
 #ifdef LINUX_DATA_START
 /* Some Linux distributions arrange to define __data_start. Some	*/
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/egcs/libffi/Makefile.am,v
retrieving revision 1.12
diff -u -r1.12 Makefile.am
--- Makefile.am	2001年03月27日 02:39:15	1.12
+++ Makefile.am	2001年04月06日 23:01:09
@@ -97,6 +97,7 @@
 TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S
 TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
 TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c
+TARGET_SRC_SH = src/sh/sysv.S src/sh/ffi.c
 
 ##libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c $(TARGET_SRC_@TARGET@)
 ## Work around automake deficiency
@@ -131,6 +132,9 @@
 endif
 if ARM
 libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
+endif
+if SH
+libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
 endif
 
 AM_CFLAGS = -fexceptions
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/libffi/configure.in,v
retrieving revision 1.13
diff -u -r1.13 configure.in
--- configure.in	2001年03月29日 00:03:27	1.13
+++ configure.in	2001年04月06日 23:01:27
@@ -64,6 +64,7 @@
 powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
 powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
 arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;;
+sh*-*-linux-*) TARGET=SH; TARGETDIR=sh;;
 esac
 
 if test $TARGETDIR = unknown; then
@@ -80,6 +81,7 @@
 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
+AM_CONDITIONAL(SH, test x$TARGET = xSH)
 
 AC_HEADER_STDC
 AC_CHECK_FUNCS(memcpy)
Index: include/ffi.h.in
===================================================================
RCS file: /cvs/gcc/egcs/libffi/include/ffi.h.in,v
retrieving revision 1.10
diff -u -r1.10 ffi.h.in
--- ffi.h.in	2001年03月27日 02:39:16	1.10
+++ ffi.h.in	2001年04月06日 23:01:29
@@ -239,6 +239,12 @@
 FFI_DEFAULT_ABI = FFI_SYSV,
 #endif
 
+ /* ---- SuperH ------------------- */
+#ifdef SH
+ FFI_SYSV,
+ FFI_DEFAULT_ABI = FFI_SYSV,
+#endif
+
 /* Leave this for debugging purposes */
 FFI_LAST_ABI
 


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /