aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog27
-rw-r--r--newlib/configure.host4
-rw-r--r--newlib/libc/include/machine/setjmp.h5
-rw-r--r--newlib/libc/machine/sh/Makefile.am4
-rw-r--r--newlib/libc/machine/sh/Makefile.in8
-rw-r--r--newlib/libc/machine/sh/asm.h11
-rwxr-xr-xnewlib/libc/machine/sh/configure114
-rw-r--r--newlib/libc/machine/sh/configure.in7
-rw-r--r--newlib/libc/machine/sh/setjmp.S134
-rw-r--r--newlib/libc/sys/sh/crt0.S67
-rw-r--r--newlib/libc/sys/sh/trap.S28
11 files changed, 403 insertions, 6 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 16d5405..a4f4ea9 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,30 @@
+2002-02-08 Alexandre Oliva <aoliva@redhat.com>
+
+ Contribute sh64-elf.
+ 2001-03-13 Alexandre Oliva <aoliva@redhat.com>
+ * configure.host (newlib_cflags) [sh*-*-*]: Enable long long
+ support in printf.
+ 2001-01-29 Alexandre Oliva <aoliva@redhat.com>
+ * libc/machine/sh/setjmp.S [SH5]: Switch to SHmedia mode before
+ any labels.
+ 2001-01-24 Alexandre Oliva <aoliva@redhat.com>
+ * libc/sys/sh/trap.S (___trap34) [SH5]: Don't trash r2.
+ 2000-12-16 Alexandre Oliva <aoliva@redhat.com>
+ * libc/machine/sh/configure.in: Rework conditionals.
+ * libc/machine/sh/Makefile.am: Likewise.
+ * libc/machine/sh/configure, libc/machine/sh/Makefile.in: Rebuilt.
+ 2000-12-01 Alexandre Oliva <aoliva@redhat.com>
+ * configure.host: Match `sh*'.
+ * libc/include/machine/setjmp.h: Define for SH5.
+ * libc/machine/sh/configure.in: Detect SH5.
+ * libc/machine/sh/configure: Rebuilt.
+ * libc/machine/sh/Makefile.am: Use only setjmp.S for SH5.
+ * libc/machine/sh/Makefile.in: Rebuilt.
+ * libc/machine/sh/asm.h: Adjust for SH5.
+ * libc/machine/sh/setjmp.S: Implement in SHmedia.
+ * libc/sys/sh/crt0.S: Likewise.
+ * libc/sys/sh/trap.S: Likewise.
+
2002-02-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/machine/i386/Makefile.am: (mach_add_src): Remove.
diff --git a/newlib/configure.host b/newlib/configure.host
index b28e469..d4d6acf 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -150,7 +150,7 @@ case "${host_cpu}" in
powerpc*)
machine_dir=powerpc
;;
- sh)
+ sh | sh64)
machine_dir=sh
;;
sparc*)
@@ -474,7 +474,7 @@ case "${host}" in
syscall_dir=syscalls
;;
sh*-*-*)
- newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY"
+ newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY -DWANT_PRINTF_LONG_LONG"
syscall_dir=syscalls
;;
sparc-sun-sunos*)
diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h
index 3e57f6e..c7f1463 100644
--- a/newlib/libc/include/machine/setjmp.h
+++ b/newlib/libc/include/machine/setjmp.h
@@ -93,7 +93,12 @@ typedef int jmp_buf[_JBLEN];
#endif
#ifdef __sh__
+#if __SH5__
+#define _JBLEN 50
+#define _JBTYPE long long
+#else
#define _JBLEN 20
+#endif /* __SH5__ */
#endif
#ifdef __v800
diff --git a/newlib/libc/machine/sh/Makefile.am b/newlib/libc/machine/sh/Makefile.am
index 1aab718..9cb5293 100644
--- a/newlib/libc/machine/sh/Makefile.am
+++ b/newlib/libc/machine/sh/Makefile.am
@@ -6,7 +6,11 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
+if SH64
+lib_a_SOURCES = setjmp.S
+else
lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strcmp.S
+endif
memcpy.o: asm.h
memset.o: asm.h
diff --git a/newlib/libc/machine/sh/Makefile.in b/newlib/libc/machine/sh/Makefile.in
index 5d4b826..e6998fe 100644
--- a/newlib/libc/machine/sh/Makefile.in
+++ b/newlib/libc/machine/sh/Makefile.in
@@ -83,8 +83,8 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strcmp.S
+@SH64_TRUE@lib_a_SOURCES = @SH64_TRUE@setjmp.S
+@SH64_FALSE@lib_a_SOURCES = @SH64_FALSE@memcpy.S memset.S setjmp.S strcpy.S strcmp.S
ACLOCAL_AMFLAGS = -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
@@ -98,7 +98,9 @@ DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
lib_a_LIBADD =
-lib_a_OBJECTS = memcpy.o memset.o setjmp.o strcpy.o strcmp.o
+@SH64_TRUE@lib_a_OBJECTS = setjmp.o
+@SH64_FALSE@lib_a_OBJECTS = memcpy.o memset.o setjmp.o strcpy.o \
+@SH64_FALSE@strcmp.o
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
diff --git a/newlib/libc/machine/sh/asm.h b/newlib/libc/machine/sh/asm.h
index ed27fdb..cfdaa81 100644
--- a/newlib/libc/machine/sh/asm.h
+++ b/newlib/libc/machine/sh/asm.h
@@ -5,8 +5,19 @@
#endif
#define _ASM_LABEL(x) x
+#if __SH5__
+# if __SH5__ == 32 && __SHMEDIA__
+# define TEXT .section .text..SHmedia32, "ax"
+# else
+# define TEXT .text
+# endif
+
+# define _ENTRY(name) \
+ TEXT; .align 4; .globl name; name:
+#else
#define _ENTRY(name) \
.text; .align 2; .globl name; name:
+#endif /* __SH5__ */
#define ENTRY(name) \
_ENTRY(_C_LABEL(name))
diff --git a/newlib/libc/machine/sh/configure b/newlib/libc/machine/sh/configure
index 6d988d6..3dda65e 100755
--- a/newlib/libc/machine/sh/configure
+++ b/newlib/libc/machine/sh/configure
@@ -1425,6 +1425,115 @@ fi
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1430: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1445 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1451: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1462 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1468: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1479 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+cat > conftest.$ac_ext <<EOF
+#line 1510 "configure"
+#include "confdefs.h"
+
+#if __SH5__
+ sh5
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "sh5" >/dev/null 2>&1; then
+ rm -rf conftest*
+ have_sh64=yes
+else
+ rm -rf conftest*
+ have_sh64=no
+fi
+rm -f conftest*
+
+
+
+if test $have_sh64 = yes; then
+ SH64_TRUE=
+ SH64_FALSE='#'
+else
+ SH64_TRUE='#'
+ SH64_FALSE=
+fi
+
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@@ -1608,6 +1717,9 @@ s%@aext@%$aext%g
s%@libm_machine_dir@%$libm_machine_dir%g
s%@machine_dir@%$machine_dir%g
s%@sys_dir@%$sys_dir%g
+s%@CPP@%$CPP%g
+s%@SH64_TRUE@%$SH64_TRUE%g
+s%@SH64_FALSE@%$SH64_FALSE%g
CEOF
EOF
@@ -1616,7 +1728,7 @@ cat >> $CONFIG_STATUS <<\EOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
diff --git a/newlib/libc/machine/sh/configure.in b/newlib/libc/machine/sh/configure.in
index ffd2797..7fb5afd 100644
--- a/newlib/libc/machine/sh/configure.in
+++ b/newlib/libc/machine/sh/configure.in
@@ -9,4 +9,11 @@ AC_CONFIG_AUX_DIR(../../../..)
NEWLIB_CONFIGURE(../../..)
+AC_EGREP_CPP([sh5], [
+#if __SH5__
+ sh5
+#endif
+], [have_sh64=yes], [have_sh64=no])
+AM_CONDITIONAL(SH64, [test $have_sh64 = yes])
+
AC_OUTPUT(Makefile)
diff --git a/newlib/libc/machine/sh/setjmp.S b/newlib/libc/machine/sh/setjmp.S
index 363e8f2..9508496 100644
--- a/newlib/libc/machine/sh/setjmp.S
+++ b/newlib/libc/machine/sh/setjmp.S
@@ -1,6 +1,77 @@
+/* We want to pretend we're in SHmedia mode, even when assembling for
+ SHcompact. */
+#if __SH5__ == 32 && ! __SHMEDIA__
+# undef __SHMEDIA__
+# define __SHMEDIA__ 1
+#endif
+
+#if __SHMEDIA__
+ .mode SHmedia
+#endif
+
#include "asm.h"
ENTRY(setjmp)
+#if __SH5__
+ ptabs r18, tr0
+ gettr tr5, r5
+ gettr tr6, r6
+ gettr tr7, r7
+ st.q r2, 0*8, r18
+ st.q r2, 1*8, r10
+ st.q r2, 2*8, r11
+ st.q r2, 3*8, r12
+ st.q r2, 4*8, r13
+ st.q r2, 5*8, r14
+ st.q r2, 6*8, r15
+ st.q r2, 7*8, r28
+ st.q r2, 8*8, r29
+ st.q r2, 9*8, r30
+ st.q r2, 10*8, r31
+ st.q r2, 11*8, r32
+ st.q r2, 12*8, r33
+ st.q r2, 13*8, r34
+ st.q r2, 14*8, r35
+ st.q r2, 15*8, r44
+ st.q r2, 16*8, r45
+ st.q r2, 17*8, r46
+ st.q r2, 18*8, r47
+ st.q r2, 19*8, r48
+ st.q r2, 20*8, r49
+ st.q r2, 21*8, r50
+ st.q r2, 22*8, r51
+ st.q r2, 23*8, r52
+ st.q r2, 24*8, r53
+ st.q r2, 25*8, r54
+ st.q r2, 26*8, r55
+ st.q r2, 27*8, r56
+ st.q r2, 28*8, r57
+ st.q r2, 29*8, r58
+ st.q r2, 30*8, r59
+ st.q r2, 31*8, r5
+ st.q r2, 32*8, r6
+ st.q r2, 33*8, r7
+#if ! __SH4_NOFPU__
+ fst.d r2, 34*8, dr12
+ fst.d r2, 35*8, dr14
+ fst.d r2, 36*8, dr36
+ fst.d r2, 37*8, dr38
+ fst.d r2, 38*8, dr40
+ fst.d r2, 39*8, dr42
+ fst.d r2, 40*8, dr44
+ fst.d r2, 41*8, dr46
+ fst.d r2, 42*8, dr48
+ fst.d r2, 43*8, dr50
+ fst.d r2, 44*8, dr52
+ fst.d r2, 45*8, dr54
+ fst.d r2, 46*8, dr56
+ fst.d r2, 47*8, dr58
+ fst.d r2, 48*8, dr60
+ fst.d r2, 49*8, dr62
+#endif
+ movi 0, r2
+ blink tr0, r63
+#else
#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
add #(13*4),r4
#else
@@ -28,8 +99,70 @@ ENTRY(setjmp)
rts
mov #0,r0
+#endif /* __SH5__ */
ENTRY(longjmp)
+#if __SH5__
+ ld.q r2, 0*8, r18
+ ptabs r18, tr0
+ ld.q r2, 1*8, r10
+ ld.q r2, 2*8, r11
+ ld.q r2, 3*8, r12
+ ld.q r2, 4*8, r13
+ ld.q r2, 5*8, r14
+ ld.q r2, 6*8, r15
+ ld.q r2, 7*8, r28
+ ld.q r2, 8*8, r29
+ ld.q r2, 9*8, r30
+ ld.q r2, 10*8, r31
+ ld.q r2, 11*8, r32
+ ld.q r2, 12*8, r33
+ ld.q r2, 13*8, r34
+ ld.q r2, 14*8, r35
+ ld.q r2, 15*8, r44
+ ld.q r2, 16*8, r45
+ ld.q r2, 17*8, r46
+ ld.q r2, 18*8, r47
+ ld.q r2, 19*8, r48
+ ld.q r2, 20*8, r49
+ ld.q r2, 21*8, r50
+ ld.q r2, 22*8, r51
+ ld.q r2, 23*8, r52
+ ld.q r2, 24*8, r53
+ ld.q r2, 25*8, r54
+ ld.q r2, 26*8, r55
+ ld.q r2, 27*8, r56
+ ld.q r2, 28*8, r57
+ ld.q r2, 29*8, r58
+ ld.q r2, 30*8, r59
+ ld.q r2, 31*8, r5
+ ld.q r2, 32*8, r6
+ ld.q r2, 33*8, r7
+ ptabs r5, tr5
+ ptabs r6, tr6
+ ptabs r7, tr7
+#if ! __SH4_NOFPU__
+ fld.d r2, 34*8, dr12
+ fld.d r2, 35*8, dr14
+ fld.d r2, 36*8, dr36
+ fld.d r2, 37*8, dr38
+ fld.d r2, 38*8, dr40
+ fld.d r2, 39*8, dr42
+ fld.d r2, 40*8, dr44
+ fld.d r2, 41*8, dr46
+ fld.d r2, 42*8, dr48
+ fld.d r2, 43*8, dr50
+ fld.d r2, 44*8, dr52
+ fld.d r2, 45*8, dr54
+ fld.d r2, 46*8, dr56
+ fld.d r2, 47*8, dr58
+ fld.d r2, 48*8, dr60
+ fld.d r2, 49*8, dr62
+#endif
+ movi 1, r2
+ cmvne r3, r3, r2
+ blink tr0, r63
+#else
mov.l @r4+,r8
mov.l @r4+,r9
mov.l @r4+,r10
@@ -55,3 +188,4 @@ ENTRY(longjmp)
movt r0
retr4: rts
nop
+#endif /* __SH5__ */
diff --git a/newlib/libc/sys/sh/crt0.S b/newlib/libc/sys/sh/crt0.S
index 88c9fac..6eccf3a 100644
--- a/newlib/libc/sys/sh/crt0.S
+++ b/newlib/libc/sys/sh/crt0.S
@@ -1,3 +1,69 @@
+
+#ifdef __SH5__
+ .section .data,"aw"
+ .global ___data
+___data:
+
+ .section .rodata,"a"
+ .global ___rodata
+___rodata:
+
+#if __SH5__ == 64
+ .section .text,"ax"
+#define LOAD_ADDR(sym, reg) \
+ movi (sym >> 48) & 65535, reg; \
+ shori (sym >> 32) & 65535, reg; \
+ shori (sym >> 16) & 65535, reg; \
+ shori sym & 65535, reg
+#else
+ .mode SHmedia
+ .section .text..SHmedia32,"ax"
+#define LOAD_ADDR(sym, reg) \
+ movi (sym >> 16) & 65535, reg; \
+ shori sym & 65535, reg
+#endif
+ .global start
+start:
+ LOAD_ADDR (_stack, r15)
+
+ pt/l zero_bss_loop, tr0
+ pt/l _atexit, tr1
+ pt/l _init, tr5
+ pt/l _main, tr6
+ pt/l _exit, tr7
+
+ ! zero out bss
+ LOAD_ADDR (_edata, r0)
+ LOAD_ADDR (_end, r1)
+zero_bss_loop:
+ stx.q r0, r63, r63
+ addi r0, 8, r0
+ bgt/l r1, r0, tr0
+
+ LOAD_ADDR (___data, r26)
+ LOAD_ADDR (___rodata, r27)
+
+#if ! __SH4_NOFPU__
+ getcon cr0, r0
+ movi 1, r1
+ shlli r1, 15, r1
+ or r1, r0, r0
+ putcon r0, cr0
+#endif
+
+ ! arrange for exit to call fini
+ LOAD_ADDR (_fini, r2)
+ blink tr1, r18
+
+ ! call init
+ blink tr5, r18
+
+ ! call the mainline
+ blink tr6, r18
+
+ ! call exit
+ blink tr7, r18
+#else
.section .text
.global start
start:
@@ -46,6 +112,7 @@ main_k:
.long _main
exit_k:
.long _exit
+#endif
#ifdef __ELF__
.section .stack,"aw"
diff --git a/newlib/libc/sys/sh/trap.S b/newlib/libc/sys/sh/trap.S
index 4512293..0eb6e5d 100644
--- a/newlib/libc/sys/sh/trap.S
+++ b/newlib/libc/sys/sh/trap.S
@@ -1,3 +1,30 @@
+#if __SH5__
+ .mode SHmedia
+#if __SH5__ == 32 && __SHMEDIA__
+ .section .text..SHmedia32, "ax"
+#else
+ .text
+#endif
+ .global ___trap34
+___trap34:
+ movi 34, r0
+ trapa r0
+ pt/l ret, tr1
+ ptabs/l r18, tr0
+ beqi r1, 0, tr1
+#if __SH5__ == 64
+ movi ((_errno >> 48) & 65535), r0
+ shori ((_errno >> 32) & 65535), r0
+ shori ((_errno >> 16) & 65535), r0
+#else
+ movi ((_errno >> 16) & 65535), r0
+#endif
+ shori (_errno & 65535), r0
+ stx.l r0, r63, r1
+ret:
+ blink tr0, r63
+
+#else
.text
.global ___trap34
___trap34:
@@ -13,3 +40,4 @@ ret:
.align 2
perrno:
.long _errno
+#endif /* ! __SH5__ */