about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-12 20:50:37 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-12 20:50:37 +0000
commit3846ef75cf3309e2e8264c81fb510cdd54bee4fd (patch)
tree45ad5244c5af4a690d56f41da4ee36d864bc4242 /sysdeps/unix
parent55985355ade2a038b567dd9b58153a98384ae703 (diff)
downloadglibc-3846ef75cf3309e2e8264c81fb510cdd54bee4fd.tar.gz
glibc-3846ef75cf3309e2e8264c81fb510cdd54bee4fd.tar.xz
glibc-3846ef75cf3309e2e8264c81fb510cdd54bee4fd.zip
Update.
2000-06-12  Kazumoto Kojima  <kkojima@rr.iij4u.or.jp>
	    Yutaka Niibe  <gniibe@chroot.org>

	* sysdeps/sh/Dist: New file.
	* sysdeps/sh/Implies: New file.
	* sysdeps/sh/gmp-mparam.h: New file.
	* sysdeps/sh/init-first.c: New file.
	* sysdeps/sh/machine-gmon.h: New file.
	* sysdeps/sh/memcpy.S: New file.
	* sysdeps/sh/memprof.h: New file.
	* sysdeps/sh/memset.S: New file.
	* sysdeps/sh/sh3/__longjmp.S: New file.
	* sysdeps/sh/sh3/bits/endian.h: New file.
	* sysdeps/sh/sh3/bits/huge_val.h: New file.
	* sysdeps/sh/sh3/bits/setjmp.h: New file.
	* sysdeps/sh/sh3/bsd-_setjmp.S: New file.
	* sysdeps/sh/sh3/bsd-setjmp.S: New file.
	* sysdeps/sh/sh3/dl-machine.h: New file.
	* sysdeps/sh/sh3/elf/initfini.c: New file.
	* sysdeps/sh/sh3/elf/start.S: New file.
	* sysdeps/sh/sh3/setjmp.S: New file.
	* sysdeps/sh/sh3/sys/ucontext.h: New file.
	* sysdeps/sh/sh4/__longjmp.S: New file.
	* sysdeps/sh/sh4/bits/endian.h: New file.
	* sysdeps/sh/sh4/bits/huge_val.h: New file.
	* sysdeps/sh/sh4/bits/setjmp.h: New file.
	* sysdeps/sh/sh4/bsd-_setjmp.S: New file.
	* sysdeps/sh/sh4/bsd-setjmp.S: New file.
	* sysdeps/sh/sh4/dl-machine.h: New file.
	* sysdeps/sh/sh4/elf/initfini.c: New file.
	* sysdeps/sh/sh4/elf/start.S: New file.
	* sysdeps/sh/sh4/fpu/bits/fenv.h: New file.
	* sysdeps/sh/sh4/fpu/bits/huge_val.h: New file.
	* sysdeps/sh/sh4/fpu/bits/mathdef.h: New file.
	* sysdeps/sh/sh4/fpu/fclrexcpt.c: New file.
	* sysdeps/sh/sh4/fpu/fegetenv.c: New file.
	* sysdeps/sh/sh4/fpu/fegetround.c: New file.
	* sysdeps/sh/sh4/fpu/feholdexcpt.c: New file.
	* sysdeps/sh/sh4/fpu/fesetenv.c: New file.
	* sysdeps/sh/sh4/fpu/fesetround.c: New file.
	* sysdeps/sh/sh4/fpu/fpu_control.h: New file.
	* sysdeps/sh/sh4/fpu/fraiseexcpt.c: New file.
	* sysdeps/sh/sh4/fpu/fsetexcptflg.c: New file.
	* sysdeps/sh/sh4/fpu/ftestexcept.c: New file.
	* sysdeps/sh/sh4/fpu/libm-test-ulps: New file.
	* sysdeps/sh/sh4/setjmp.S: New file.
	* sysdeps/sh/sh4/sys/ucontext.h: New file.
	* sysdeps/sh/strlen.S: New file.
	* sysdeps/sh/sysdep.h: New file.
	* sysdeps/unix/sh/sysdep.S: New file.
	* sysdeps/unix/sh/sysdep.h: New file.
	* sysdeps/unix/sysv/linux/sh/Dist: New file.
	* sysdeps/unix/sysv/linux/sh/Makefile: New file.
	* sysdeps/unix/sysv/linux/sh/Versions: New file.
	* sysdeps/unix/sysv/linux/sh/bits/mman.h: New file.
	* sysdeps/unix/sysv/linux/sh/bits/resource.h: New file.
	* sysdeps/unix/sysv/linux/sh/brk.c: New file.
	* sysdeps/unix/sysv/linux/sh/chown.c: New file.
	* sysdeps/unix/sysv/linux/sh/clone.S: New file.
	* sysdeps/unix/sysv/linux/sh/fchown.c: New file.
	* sysdeps/unix/sysv/linux/sh/fxstat.c: New file.
	* sysdeps/unix/sysv/linux/sh/getegid.c: New file.
	* sysdeps/unix/sysv/linux/sh/geteuid.c: New file.
	* sysdeps/unix/sysv/linux/sh/getgroups.c: New file.
	* sysdeps/unix/sysv/linux/sh/getresgid.c: New file.
	* sysdeps/unix/sysv/linux/sh/getresuid.c: New file.
	* sysdeps/unix/sysv/linux/sh/getrlimit.c: New file.
	* sysdeps/unix/sysv/linux/sh/getrlimit64.c: New file.
	* sysdeps/unix/sysv/linux/sh/getuid.c: New file.
	* sysdeps/unix/sysv/linux/sh/lchown.c: New file.
	* sysdeps/unix/sysv/linux/sh/lxstat.c: New file.
	* sysdeps/unix/sysv/linux/sh/msgctl.c: New file.
	* sysdeps/unix/sysv/linux/sh/oldgetrlimit64.c: New file.
	* sysdeps/unix/sysv/linux/sh/pipe.S: New file.
	* sysdeps/unix/sysv/linux/sh/profil-counter.h: New file.
	* sysdeps/unix/sysv/linux/sh/semctl.c: New file.
	* sysdeps/unix/sysv/linux/sh/setegid.c: New file.
	* sysdeps/unix/sysv/linux/sh/seteuid.c: New file.
	* sysdeps/unix/sysv/linux/sh/setfsgid.c: New file.
	* sysdeps/unix/sysv/linux/sh/setfsuid.c: New file.
	* sysdeps/unix/sysv/linux/sh/setgid.c: New file.
	* sysdeps/unix/sysv/linux/sh/setgroups.c: New file.
	* sysdeps/unix/sysv/linux/sh/setregid.c: New file.
	* sysdeps/unix/sysv/linux/sh/setresgid.c: New file.
	* sysdeps/unix/sysv/linux/sh/setresuid.c: New file.
	* sysdeps/unix/sysv/linux/sh/setreuid.c: New file.
	* sysdeps/unix/sysv/linux/sh/setrlimit.c: New file.
	* sysdeps/unix/sysv/linux/sh/setuid.c: New file.
	* sysdeps/unix/sysv/linux/sh/sh3/register-dump.h: New file.
	* sysdeps/unix/sysv/linux/sh/sh4/register-dump.h: New file.
	* sysdeps/unix/sysv/linux/sh/shmctl.c: New file.
	* sysdeps/unix/sysv/linux/sh/sigcontextinfo.h: New file.
	* sysdeps/unix/sysv/linux/sh/socket.S: New file.
	* sysdeps/unix/sysv/linux/sh/sys/io.h: New file.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: New file.
	* sysdeps/unix/sysv/linux/sh/sys/user.h: New file.
	* sysdeps/unix/sysv/linux/sh/syscalls.list: New file.
	* sysdeps/unix/sysv/linux/sh/sysdep.S: New file.
	* sysdeps/unix/sysv/linux/sh/sysdep.h: New file.
	* sysdeps/unix/sysv/linux/sh/vfork.S: New file.
	* sysdeps/unix/sysv/linux/sh/xstat.c: New file.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sh/sysdep.S102
-rw-r--r--sysdeps/unix/sh/sysdep.h29
-rw-r--r--sysdeps/unix/sysv/linux/sh/Dist9
-rw-r--r--sysdeps/unix/sysv/linux/sh/Makefile12
-rw-r--r--sysdeps/unix/sysv/linux/sh/Versions6
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/mman.h93
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/resource.h205
-rw-r--r--sysdeps/unix/sysv/linux/sh/brk.c50
-rw-r--r--sysdeps/unix/sysv/linux/sh/chown.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/clone.S133
-rw-r--r--sysdeps/unix/sysv/linux/sh/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/fxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/getgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/sh/getresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/getresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/getrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/sh/msgctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/oldgetrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/pipe.S63
-rw-r--r--sysdeps/unix/sysv/linux/sh/profil-counter.h28
-rw-r--r--sysdeps/unix/sysv/linux/sh/semctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/sh/setregid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setreuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/register-dump.h151
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/register-dump.h262
-rw-r--r--sysdeps/unix/sysv/linux/sh/shmctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/sigcontextinfo.h25
-rw-r--r--sysdeps/unix/sysv/linux/sh/socket.S116
-rw-r--r--sysdeps/unix/sysv/linux/sh/sys/io.h48
-rw-r--r--sysdeps/unix/sysv/linux/sh/sys/ucontext.h109
-rw-r--r--sysdeps/unix/sysv/linux/sh/sys/user.h68
-rw-r--r--sysdeps/unix/sysv/linux/sh/syscalls.list54
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.S43
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.h132
-rw-r--r--sysdeps/unix/sysv/linux/sh/vfork.S112
-rw-r--r--sysdeps/unix/sysv/linux/sh/xstat.c1
52 files changed, 1883 insertions, 0 deletions
diff --git a/sysdeps/unix/sh/sysdep.S b/sysdeps/unix/sh/sysdep.S
new file mode 100644
index 0000000000..671eaba4ee
--- /dev/null
+++ b/sysdeps/unix/sh/sysdep.S
@@ -0,0 +1,102 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+#define _ERRNO_H
+#include <bits/errno.h>
+
+ENTRY(__syscall_error)
+#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
+	/* We translate the system's EWOULDBLOCK error into EAGAIN.
+	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
+	   EWOULDBLOCK_sys is the original number.  */
+	mov.l	.L1, r1
+	cmp/eq	r1, r0
+	bf	skip
+	nop
+	mov.l	.L2, r0
+skip:
+#endif
+	/* Store it in errno... */
+#ifndef SHARED
+#ifndef _LIBC_REENTRANT
+	mov.l	.L3, r1
+	mov.l	r0, @r1
+#else
+	mov.l	.L3, r1
+	sts.l	pr, @-r15
+	jsr	@r1
+	 mov.l	r0, @-r15
+	mov.l	@r15+, r1
+	lds.l	@r15+, pr
+	mov.l	r1, @r0
+#endif
+#else
+	mov.l	r12, @-r15
+#ifndef _LIBC_REENTRANT
+	mov	r0, r2
+        mov.l	0f, r12
+	mova	0f, r0
+	add	r0, r12
+	mov.l	.L3, r0
+	mov.l	@(r0,r12), r1
+	mov.l	r2, @r1
+#else
+	mov.l	r0, @-r15
+	sts.l	pr, @-r15
+        mov.l	0f, r12
+	mova	0f, r0
+	add	r0, r12
+	mov.l	.L3, r1
+	mova	.L3, r0
+	add	r0, r1
+	jsr	@r1
+	 nop
+	lds.l	@r15+, pr
+	mov.l	@r15+, r1
+	mov.l	r1, @r0
+#endif
+	mov.l	@r15+, r12
+#endif
+	/* And just kick back a -1.  */
+	rts
+	 mov	#-1, r0
+
+	.align	2
+#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
+.L1:	.long	EWOULDBLOCK_sys
+.L2:	.long	EAGAIN
+#endif
+#ifndef SHARED
+#ifndef _LIBC_REENTRANT
+.L3:	.long	C_SYMBOL_NAME(errno)
+#else
+.L3:	.long	C_SYMBOL_NAME(__errno_location)
+#endif
+#else
+0:
+	.long	_GLOBAL_OFFSET_TABLE_
+#ifndef _LIBC_REENTRANT
+.L3:	.long	C_SYMBOL_NAME(errno@GOT)
+#else
+.L3:	.long	C_SYMBOL_NAME(__errno_location@PLT)
+#endif
+#endif
+END(__syscall_error)
+
+weak_alias (__syscall_error, syscall_error)
diff --git a/sysdeps/unix/sh/sysdep.h b/sysdeps/unix/sh/sysdep.h
new file mode 100644
index 0000000000..6e8a1689bf
--- /dev/null
+++ b/sysdeps/unix/sh/sysdep.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdeps/unix/sysdep.h>
+#include <sysdeps/sh/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+#define ret	rts ; nop
+
+/* The sh move insn is s, d.  */
+#define MOVE(x,y)	mov x , y
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/Dist b/sysdeps/unix/sysv/linux/sh/Dist
new file mode 100644
index 0000000000..41c9f08d05
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/Dist
@@ -0,0 +1,9 @@
+clone.S
+ioperm.c
+pipe.S
+setresuid.c
+setresgid.c
+setfsuid.c
+setfsgid.c
+sys/io.h
+sys/user.h
diff --git a/sysdeps/unix/sysv/linux/sh/Makefile b/sysdeps/unix/sysv/linux/sh/Makefile
new file mode 100644
index 0000000000..57cd3d9e94
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/Makefile
@@ -0,0 +1,12 @@
+ifeq ($(subdir),io)
+sysdep_routines += pipe
+endif
+
+ifeq ($(subdir),misc)
+sysdep_routines += setfsgid setfsuid setresgid setresuid
+endif
+
+ifeq ($(subdir),signal)
+sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait	\
+		   rt_sigqueueinfo rt_sigaction rt_sigpending
+endif
diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions
new file mode 100644
index 0000000000..bd4b6933cf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/Versions
@@ -0,0 +1,6 @@
+libc {
+  GLIBC_2.2 {
+    # New rlimit interface
+    getrlimit; setrlimit; getrlimit64;
+  }
+}
diff --git a/sysdeps/unix/sysv/linux/sh/bits/mman.h b/sysdeps/unix/sysv/linux/sh/bits/mman.h
new file mode 100644
index 0000000000..0086250c05
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/bits/mman.h
@@ -0,0 +1,93 @@
+/* Definitions for POSIX memory map interface.  Linux/SH version.
+   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_MMAN_H
+# error "Never include this file directly.  Use <sys/mman.h> instead"
+#endif
+
+/* The following definitions basically come from the kernel headers.
+   But the kernel header is not namespace clean.  */
+
+
+/* Protections are chosen from these bits, OR'd together.  The
+   implementation does not necessarily support PROT_EXEC or PROT_WRITE
+   without PROT_READ.  The only guarantees are that no writing will be
+   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
+
+#define PROT_READ	0x1		/* Page can be read.  */
+#define PROT_WRITE	0x2		/* Page can be written.  */
+#define PROT_EXEC	0x4		/* Page can be executed.  */
+#define PROT_NONE	0x0		/* Page can not be accessed.  */
+
+/* Sharing types (must choose one and only one of these).  */
+#define MAP_SHARED	0x01		/* Share changes.  */
+#define MAP_PRIVATE	0x02		/* Changes are private.  */
+#ifdef __USE_MISC
+# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
+#endif
+
+/* Other flags.  */
+#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
+#ifdef __USE_MISC
+# define MAP_FILE	0
+# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
+# define MAP_ANON	MAP_ANONYMOUS
+#endif
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x0800		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x2000		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x4000		/* Don't check for reservations.  */
+#endif
+
+/* Flags to `msync'.  */
+#define MS_ASYNC	1		/* Sync memory asynchronously.  */
+#define MS_SYNC		4		/* Synchronous memory sync.  */
+#define MS_INVALIDATE	2		/* Invalidate the caches.  */
+
+/* Flags for `mlockall'.  */
+#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
+#define MCL_FUTURE	2		/* Lock all additions to address
+					   space.  */
+
+/* Flags for `mremap'.  */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE	1
+#endif
+
+/* Advice to `madvise'.  */
+#ifdef __USE_BSD
+# define MADV_NORMAL	 0	/* No further special treatment.  */
+# define MADV_RANDOM	 1	/* Expect random page references.  */
+# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
+# define MADV_WILLNEED	 3	/* Will need these pages.  */
+# define MADV_DONTNEED	 4	/* Don't need these pages.  */
+#endif
+
+/* The POSIX people had to invent similar names for the same things.  */
+#ifdef __USE_XOPEN2K
+# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
+# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
+# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
+# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
+# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/bits/resource.h b/sysdeps/unix/sysv/linux/sh/bits/resource.h
new file mode 100644
index 0000000000..710f1119c0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/bits/resource.h
@@ -0,0 +1,205 @@
+/* Bit values & structures for resource limits.  Linux version.
+   Copyright (C) 1994, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Transmute defines to enumerations.  The macro re-definitions are
+   necessary because some programs want to test for operating system
+   features with #ifdef RUSAGE_SELF.  In ISO C the reflexive
+   definition is a no-op.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+{
+  /* Per-process CPU limit, in seconds.  */
+  RLIMIT_CPU = 0,
+#define RLIMIT_CPU RLIMIT_CPU
+
+  /* Largest file that can be created, in bytes.  */
+  RLIMIT_FSIZE = 1,
+#define	RLIMIT_FSIZE RLIMIT_FSIZE
+
+  /* Maximum size of data segment, in bytes.  */
+  RLIMIT_DATA = 2,
+#define	RLIMIT_DATA RLIMIT_DATA
+
+  /* Maximum size of stack segment, in bytes.  */
+  RLIMIT_STACK = 3,
+#define	RLIMIT_STACK RLIMIT_STACK
+
+  /* Largest core file that can be created, in bytes.  */
+  RLIMIT_CORE = 4,
+#define	RLIMIT_CORE RLIMIT_CORE
+
+  /* Largest resident set size, in bytes.
+     This affects swapping; processes that are exceeding their
+     resident set size will be more likely to have physical memory
+     taken from them.  */
+  RLIMIT_RSS = 5,
+#define	RLIMIT_RSS RLIMIT_RSS
+
+  /* Number of open files.  */
+  RLIMIT_NOFILE = 7,
+  RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
+#define RLIMIT_NOFILE RLIMIT_NOFILE
+#define RLIMIT_OFILE RLIMIT_OFILE
+
+  /* Address space limit.  */
+  RLIMIT_AS = 9,
+#define RLIMIT_AS RLIMIT_AS
+
+  /* Number of processes.  */
+  RLIMIT_NPROC = 6,
+#define RLIMIT_NPROC RLIMIT_NPROC
+
+  /* Locked-in-memory address space.  */
+  RLIMIT_MEMLOCK = 8,
+#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
+
+  RLIMIT_NLIMITS = 10,
+  RLIM_NLIMITS = RLIMIT_NLIMITS
+#define RLIMIT_NLIMITS RLIMIT_NLIMITS
+#define RLIM_NLIMITS RLIM_NLIMITS
+};
+
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY ((unsigned long int)(~0UL))
+#else
+# define RLIM_INFINITY 0xffffffffffffffffuLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0xffffffffffffffffuLL
+#endif
+
+/* We can represent all limits.  */
+#define RLIM_SAVED_MAX	RLIM_INFINITY
+#define RLIM_SAVED_CUR	RLIM_INFINITY
+
+
+/* Type for resource quantity measurement.  */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
+struct rlimit
+  {
+    /* The current (soft) limit.  */
+    rlim_t rlim_cur;
+    /* The hard limit.  */
+    rlim_t rlim_max;
+  };
+
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+  {
+    /* The current (soft) limit.  */
+    rlim64_t rlim_cur;
+    /* The hard limit.  */
+    rlim64_t rlim_max;
+ };
+#endif
+
+/* Whose usage statistics do you want?  */
+enum __rusage_who
+{
+  /* The calling process.  */
+  RUSAGE_SELF = 0,
+#define RUSAGE_SELF RUSAGE_SELF
+
+  /* All of its terminated child processes.  */
+  RUSAGE_CHILDREN = -1,
+#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+
+  /* Both.  */
+  RUSAGE_BOTH = -2
+#define RUSAGE_BOTH RUSAGE_BOTH
+};
+
+#define __need_timeval
+#include <bits/time.h>		/* For `struct timeval'.  */
+
+/* Structure which says how much of each resource has been used.  */
+struct rusage
+  {
+    /* Total amount of user time used.  */
+    struct timeval ru_utime;
+    /* Total amount of system time used.  */
+    struct timeval ru_stime;
+    /* Maximum resident set size (in kilobytes).  */
+    long int ru_maxrss;
+    /* Amount of sharing of text segment memory
+       with other processes (kilobyte-seconds).  */
+    long int ru_ixrss;
+    /* Amount of data segment memory used (kilobyte-seconds).  */
+    long int ru_idrss;
+    /* Amount of stack memory used (kilobyte-seconds).  */
+    long int ru_isrss;
+    /* Number of soft page faults (i.e. those serviced by reclaiming
+       a page from the list of pages awaiting reallocation.  */
+    long int ru_minflt;
+    /* Number of hard page faults (i.e. those that required I/O).  */
+    long int ru_majflt;
+    /* Number of times a process was swapped out of physical memory.  */
+    long int ru_nswap;
+    /* Number of input operations via the file system.  Note: This
+       and `ru_oublock' do not include operations with the cache.  */
+    long int ru_inblock;
+    /* Number of output operations via the file system.  */
+    long int ru_oublock;
+    /* Number of IPC messages sent.  */
+    long int ru_msgsnd;
+    /* Number of IPC messages received.  */
+    long int ru_msgrcv;
+    /* Number of signals delivered.  */
+    long int ru_nsignals;
+    /* Number of voluntary context switches, i.e. because the process
+       gave up the process before it had to (usually to wait for some
+       resource to be available).  */
+    long int ru_nvcsw;
+    /* Number of involuntary context switches, i.e. a higher priority process
+       became runnable or the current process used up its time slice.  */
+    long int ru_nivcsw;
+  };
+
+/* Priority limits.  */
+#define PRIO_MIN	-20	/* Minimum priority a process can have.  */
+#define PRIO_MAX	20	/* Maximum priority a process can have.  */
+
+/* The type of the WHICH argument to `getpriority' and `setpriority',
+   indicating what flavor of entity the WHO argument specifies.  */
+enum __priority_which
+{
+  PRIO_PROCESS = 0,		/* WHO is a process ID.  */
+#define PRIO_PROCESS PRIO_PROCESS
+  PRIO_PGRP = 1,		/* WHO is a process group ID.  */
+#define PRIO_PGRP PRIO_PGRP
+  PRIO_USER = 2			/* WHO is a user ID.  */
+#define PRIO_USER PRIO_USER
+};
diff --git a/sysdeps/unix/sysv/linux/sh/brk.c b/sysdeps/unix/sysv/linux/sh/brk.c
new file mode 100644
index 0000000000..79c43b717c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/brk.c
@@ -0,0 +1,50 @@
+/* brk system call for Linux/SH.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sysdep.h>
+
+/* This must be initialized data because commons can't have aliases.  */
+void *__curbrk = 0;
+
+int
+__brk (void *addr)
+{
+  void *newbrk;
+
+  asm ("mov %1, r4\n"
+       "mov %2, r0\n"
+       "trapa #0\n"	/* do the system call */
+       "mov r0, %0;"	/* keep the return value */
+       : "=r"(newbrk) 
+       : "r"(addr), "i" (SYS_ify (brk))
+       : "r0");
+
+  __curbrk = newbrk;
+
+  if (newbrk < addr)
+    {
+      __set_errno (ENOMEM);
+      return -1;
+    }
+
+  return 0;
+}
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/sh/chown.c b/sysdeps/unix/sysv/linux/sh/chown.c
new file mode 100644
index 0000000000..1961622564
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/chown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/m68k/chown.c>
diff --git a/sysdeps/unix/sysv/linux/sh/clone.S b/sysdeps/unix/sysv/linux/sh/clone.S
new file mode 100644
index 0000000000..e181850be3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/clone.S
@@ -0,0 +1,133 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* clone() is even more special than fork() as it mucks with stacks
+   and invokes a function in the right context after its all over.  */
+
+#include <sysdep.h>
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
+
+        .text
+ENTRY(__clone)
+	/* sanity check arguments.  */
+	tst	r4, r4
+	bf/s	1f
+	 tst	r5, r5
+	bf/s	1f
+	 mov.l	.L1, r1
+#ifdef SHARED
+	mov.l	r12, @-r15
+	sts.l	pr, @-r15
+        mov.l	.LG, r12
+	mova	.LG, r0
+	add	r0, r12
+	mova	.L1, r0
+	add	r0, r1
+	jsr	@r1
+	 mov	#-EINVAL, r4
+	lds.l	@r15+, pr
+	rts
+	 mov.l	@r15+, r12
+#else
+	jmp	@r1
+	 mov	#-EINVAL, r4
+#endif
+	.align	2
+.L1:
+	.long	PLTJMP(C_SYMBOL_NAME(__syscall_error))
+1:
+	/* insert the args onto the new stack */
+	mov.l	r7, @-r5
+	/* save the function pointer as the 0th element */
+	mov.l	r4, @-r5
+
+	/* do the system call */
+	mov	r6, r4
+	mov	#+SYS_ify(clone), r0
+	trapa	#0
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	2f
+	mov.l	.L2, r1
+#ifdef SHARED
+	mov	r0, r4
+	mov.l	r12, @-r15
+	sts.l	pr, @-r15
+        mov.l	.LG, r12
+	mova	.LG, r0
+	add	r0, r12
+	mova	.L2, r0
+	add	r0, r1
+	jsr	@r1
+	 nop
+	lds.l	@r15+, pr
+	rts
+	 mov.l	@r15+, r12
+#else
+	jmp	@r1
+	 mov	r0, r4
+#endif
+	.align	2
+.L2:
+	.long	PLTJMP(C_SYMBOL_NAME(__syscall_error))
+
+2:
+	tst	r0, r0
+	bt	3f
+	rts
+	 nop
+3:
+	/* thread starts */
+	mov.l	@r15, r1
+	jsr	@r1
+	 mov.l	@(4,r15), r4
+
+	/* we are done, passing the return value through r0  */
+	mov.l	.L3, r1
+#ifdef SHARED
+	mov.l	r12, @-r15
+	sts.l	pr, @-r15
+	mov	r0, r4
+	mova	.LG, r0
+	mov.l	.LG, r12
+	add	r0, r12
+	mova	.L3, r0
+	add	r0, r1
+	jsr	@r1
+	 nop
+	lds.l	@r15+, pr
+	rts
+	 mov.l	@r15+, r12
+#else
+	jmp	@r1
+	 mov	r0, r4
+#endif
+	.align	2
+.LG:
+	.long	_GLOBAL_OFFSET_TABLE_
+.L3:
+	.long	PLTJMP(C_SYMBOL_NAME(_exit))
+PSEUDO_END (__clone)
+
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sh/fchown.c b/sysdeps/unix/sysv/linux/sh/fchown.c
new file mode 100644
index 0000000000..3a69ecc9e7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/fchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/sh/fxstat.c b/sysdeps/unix/sysv/linux/sh/fxstat.c
new file mode 100644
index 0000000000..4f219f0b9d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/fxstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/sh/getegid.c b/sysdeps/unix/sysv/linux/sh/getegid.c
new file mode 100644
index 0000000000..37b4b4a530
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/getegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/geteuid.c b/sysdeps/unix/sysv/linux/sh/geteuid.c
new file mode 100644
index 0000000000..ebcb555b5e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/geteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/getgroups.c b/sysdeps/unix/sysv/linux/sh/getgroups.c
new file mode 100644
index 0000000000..102ea24e14
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/getgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type.  */
+#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/sh/getresgid.c b/sysdeps/unix/sysv/linux/sh/getresgid.c
new file mode 100644
index 0000000000..b703a414cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/getresgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/getresuid.c b/sysdeps/unix/sysv/linux/sh/getresuid.c
new file mode 100644
index 0000000000..0b14cefe34
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/getresuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/getrlimit.c b/sysdeps/unix/sysv/linux/sh/getrlimit.c
new file mode 100644
index 0000000000..fc06dbd641
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/getrlimit.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/sh/getrlimit64.c b/sysdeps/unix/sysv/linux/sh/getrlimit64.c
new file mode 100644
index 0000000000..fef018f471
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/getrlimit64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/sh/getuid.c b/sysdeps/unix/sysv/linux/sh/getuid.c
new file mode 100644
index 0000000000..d682c79a49
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/getuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/lchown.c b/sysdeps/unix/sysv/linux/sh/lchown.c
new file mode 100644
index 0000000000..c89de99ba2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/lchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/sh/lxstat.c b/sysdeps/unix/sysv/linux/sh/lxstat.c
new file mode 100644
index 0000000000..2371cd9719
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/lxstat.c
@@ -0,0 +1,2 @@
+#include <sysdeps/unix/sysv/linux/i386/lxstat.c>
+
diff --git a/sysdeps/unix/sysv/linux/sh/msgctl.c b/sysdeps/unix/sysv/linux/sh/msgctl.c
new file mode 100644
index 0000000000..9f9b8431a3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/msgctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/sh/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/sh/oldgetrlimit64.c
new file mode 100644
index 0000000000..4c27e957bf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/oldgetrlimit64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/sh/pipe.S b/sysdeps/unix/sysv/linux/sh/pipe.S
new file mode 100644
index 0000000000..c5c87b3449
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/pipe.S
@@ -0,0 +1,63 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+ENTRY (__libc_pipe)
+	mov	#+__NR_pipe, r0
+	trapa	#0
+	mov     r0, r3
+	mov	#-12, r2
+	shad	r2, r3
+	not	r3, r3			// r1=0 means r0 = -1 to -4095
+	tst	r3, r3			// i.e. error in linux
+	bf	1f
+	mov.l	.L2, r1
+#ifdef SHARED
+	mov	r0, r4
+	mov.l	r12, @-r15
+	sts.l	pr, @-r15
+        mov.l	0f, r12
+	mova	0f, r0
+	add	r0, r12
+	mova	.L2, r0
+	add	r0, r1
+	jsr	@r1
+	 nop
+	lds.l	@r15+, pr
+	rts
+	 mov.l	@r15+, r12
+	.align 2
+0:
+	.long	_GLOBAL_OFFSET_TABLE_
+#else
+	jmp	@r1
+	 mov	r0, r4
+#endif
+1:
+	mov.l	r0, @r4
+	mov.l	r1, @(4, r4)
+	rts
+	 mov	#0, r0
+	.align	2
+.L2:
+	.long	PLTJMP(C_SYMBOL_NAME(__syscall_error))
+PSEUDO_END (__libc_pipe)
+
+weak_alias (__libc_pipe, __pipe)
+weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sh/profil-counter.h b/sysdeps/unix/sysv/linux/sh/profil-counter.h
new file mode 100644
index 0000000000..f55c956230
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/profil-counter.h
@@ -0,0 +1,28 @@
+/* Low-level statistical profiling support function.  Linux/SH version.
+   Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <signal.h>
+
+static void
+profil_counter (int signo, int _a2, int _a3, int _a4, struct sigcontext sc)
+{
+  void *pc;
+  pc = (void *) sc.sc_pc;
+  profil_count (pc);
+}
diff --git a/sysdeps/unix/sysv/linux/sh/semctl.c b/sysdeps/unix/sysv/linux/sh/semctl.c
new file mode 100644
index 0000000000..e9b1a483c9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/semctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setegid.c b/sysdeps/unix/sysv/linux/sh/setegid.c
new file mode 100644
index 0000000000..2e3a54c893
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/seteuid.c b/sysdeps/unix/sysv/linux/sh/seteuid.c
new file mode 100644
index 0000000000..18e41d08c1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/seteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setfsgid.c b/sysdeps/unix/sysv/linux/sh/setfsgid.c
new file mode 100644
index 0000000000..0886712569
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setfsgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setfsuid.c b/sysdeps/unix/sysv/linux/sh/setfsuid.c
new file mode 100644
index 0000000000..a9f22eb8ab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setfsuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setgid.c b/sysdeps/unix/sysv/linux/sh/setgid.c
new file mode 100644
index 0000000000..377021d9ec
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setgroups.c b/sysdeps/unix/sysv/linux/sh/setgroups.c
new file mode 100644
index 0000000000..0e7086278f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type.  */
+#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setregid.c b/sysdeps/unix/sysv/linux/sh/setregid.c
new file mode 100644
index 0000000000..99c57ad20f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setregid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setregid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setresgid.c b/sysdeps/unix/sysv/linux/sh/setresgid.c
new file mode 100644
index 0000000000..daca1a4833
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setresgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setresuid.c b/sysdeps/unix/sysv/linux/sh/setresuid.c
new file mode 100644
index 0000000000..3aeabe9ad7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setresuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setreuid.c b/sysdeps/unix/sysv/linux/sh/setreuid.c
new file mode 100644
index 0000000000..8ad61226e9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setreuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setreuid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setrlimit.c b/sysdeps/unix/sysv/linux/sh/setrlimit.c
new file mode 100644
index 0000000000..bfaef74c38
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setrlimit.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/sh/setuid.c b/sysdeps/unix/sysv/linux/sh/setuid.c
new file mode 100644
index 0000000000..de394379be
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/setuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setuid.c>
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/register-dump.h b/sysdeps/unix/sysv/linux/sh/sh3/register-dump.h
new file mode 100644
index 0000000000..969d8cbedd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/register-dump.h
@@ -0,0 +1,151 @@
+/* Dump registers.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sys/uio.h>
+#include <stdio-common/_itoa.h>
+
+/* We will print the register dump in this format:
+
+  R0: XXXXXXXX   R1: XXXXXXXX   R2: XXXXXXXX   R3: XXXXXXXX
+  R4: XXXXXXXX   R5: XXXXXXXX   R6: XXXXXXXX   R7: XXXXXXXX
+  R8: XXXXXXXX   R9: XXXXXXXX  R10: XXXXXXXX  R11: XXXXXXXX
+ R12: XXXXXXXX  R13: XXXXXXXX  R14: XXXXXXXX  R15: XXXXXXXX
+
+MACL: XXXXXXXX MACH: XXXXXXXX
+
+  PC: XXXXXXXX   PR: XXXXXXXX  GBR: XXXXXXXX   SR: XXXXXXXX
+
+ FR0: XXXXXXXX  FR1: XXXXXXXX  FR2: XXXXXXXX  FR3: XXXXXXXX 
+ FR4: XXXXXXXX  FR5: XXXXXXXX  FR6: XXXXXXXX  FR7: XXXXXXXX 
+ FR8: XXXXXXXX  FR9: XXXXXXXX FR10: XXXXXXXX FR11: XXXXXXXX 
+FR12: XXXXXXXX FR13: XXXXXXXX FR14: XXXXXXXX FR15: XXXXXXXX 
+
+ XR0: XXXXXXXX  XR1: XXXXXXXX  XR2: XXXXXXXX  XR3: XXXXXXXX 
+ XR4: XXXXXXXX  XR5: XXXXXXXX  XR6: XXXXXXXX  XR7: XXXXXXXX 
+ XR8: XXXXXXXX  XR9: XXXXXXXX XR10: XXXXXXXX XR11: XXXXXXXX 
+XR12: XXXXXXXX XR13: XXXXXXXX XR14: XXXXXXXX XR15: XXXXXXXX 
+
+FPSCR: XXXXXXXX FPUL: XXXXXXXX
+
+ */
+
+static void
+hexvalue (unsigned long int value, char *buf, size_t len)
+{
+  char *cp = _itoa_word (value, buf + len, 16, 0);
+  while (cp > buf)
+    *--cp = '0';
+}
+
+static void
+register_dump (int fd, struct sigcontext *ctx)
+{
+  char regs[22][8];
+  struct iovec iov[112];
+  size_t nr = 0;
+
+#define ADD_STRING(str) \
+  iov[nr].iov_base = (char *) str;					      \
+  iov[nr].iov_len = strlen (str);					      \
+  ++nr
+#define ADD_MEM(str, len) \
+  iov[nr].iov_base = str;						      \
+  iov[nr].iov_len = len;						      \
+  ++nr
+
+  /* Generate strings of register contents.  */
+  hexvalue (ctx->sc_regs[0], regs[0], 8);
+  hexvalue (ctx->sc_regs[1], regs[1], 8);
+  hexvalue (ctx->sc_regs[2], regs[2], 8);
+  hexvalue (ctx->sc_regs[3], regs[3], 8);
+  hexvalue (ctx->sc_regs[4], regs[4], 8);
+  hexvalue (ctx->sc_regs[5], regs[5], 8);
+  hexvalue (ctx->sc_regs[6], regs[6], 8);
+  hexvalue (ctx->sc_regs[7], regs[7], 8);
+  hexvalue (ctx->sc_regs[8], regs[8], 8);
+  hexvalue (ctx->sc_regs[9], regs[9], 8);
+  hexvalue (ctx->sc_regs[10], regs[10], 8);
+  hexvalue (ctx->sc_regs[11], regs[11], 8);
+  hexvalue (ctx->sc_regs[12], regs[12], 8);
+  hexvalue (ctx->sc_regs[13], regs[13], 8);
+  hexvalue (ctx->sc_regs[14], regs[14], 8);
+  hexvalue (ctx->sc_regs[15], regs[15], 8);
+  hexvalue (ctx->sc_macl, regs[16], 8);
+  hexvalue (ctx->sc_mach, regs[17], 8);
+  hexvalue (ctx->sc_pc, regs[18], 8);
+  hexvalue (ctx->sc_pr, regs[19], 8);
+  hexvalue (ctx->sc_gbr, regs[20], 8);
+  hexvalue (ctx->sc_sr, regs[21], 8);
+
+  /* Generate the output.  */
+  ADD_STRING ("Register dump:\n\n  R0: ");
+  ADD_MEM (regs[0], 8);
+  ADD_STRING ("   R1: ");
+  ADD_MEM (regs[1], 8);
+  ADD_STRING ("   R2: ");
+  ADD_MEM (regs[2], 8);
+  ADD_STRING ("   R3: ");
+  ADD_MEM (regs[3], 8);
+  ADD_STRING ("\n  R4: ");
+  ADD_MEM (regs[4], 8);
+  ADD_STRING ("   R5: ");
+  ADD_MEM (regs[5], 8);
+  ADD_STRING ("   R6: ");
+  ADD_MEM (regs[6], 8);
+  ADD_STRING ("   R7: ");
+  ADD_MEM (regs[7], 8);
+  ADD_STRING ("\n  R8: ");
+  ADD_MEM (regs[8], 8);
+  ADD_STRING ("   R9: ");
+  ADD_MEM (regs[9], 8);
+  ADD_STRING ("  R10: ");
+  ADD_MEM (regs[10], 8);
+  ADD_STRING ("  R11: ");
+  ADD_MEM (regs[11], 8);
+  ADD_STRING ("\n R12: ");
+  ADD_MEM (regs[12], 8);
+  ADD_STRING ("  R13: ");
+  ADD_MEM (regs[13], 8);
+  ADD_STRING ("  R14: ");
+  ADD_MEM (regs[14], 8);
+  ADD_STRING ("  R15: ");
+  ADD_MEM (regs[15], 8);
+
+  ADD_STRING ("\n\nMACL: ");
+  ADD_MEM (regs[16], 8);
+  ADD_STRING (" MACH: ");
+  ADD_MEM (regs[17], 8);
+
+  ADD_STRING ("\n\n  PC: ");
+  ADD_MEM (regs[18], 8);
+  ADD_STRING ("   PR: ");
+  ADD_MEM (regs[19], 8);
+  ADD_STRING ("  GBR: ");
+  ADD_MEM (regs[20], 8);
+  ADD_STRING ("   SR: ");
+  ADD_MEM (regs[21], 8);
+
+  ADD_STRING ("\n");
+
+  /* Write the stuff out.  */
+  writev (fd, iov, nr);
+}
+
+
+#define REGISTER_DUMP register_dump (fd, &ctx)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h b/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
new file mode 100644
index 0000000000..ba9988deff
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
@@ -0,0 +1,262 @@
+/* Dump registers.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sys/uio.h>
+#include <stdio-common/_itoa.h>
+
+/* We will print the register dump in this format:
+
+  R0: XXXXXXXX   R1: XXXXXXXX   R2: XXXXXXXX   R3: XXXXXXXX
+  R4: XXXXXXXX   R5: XXXXXXXX   R6: XXXXXXXX   R7: XXXXXXXX
+  R8: XXXXXXXX   R9: XXXXXXXX  R10: XXXXXXXX  R11: XXXXXXXX
+ R12: XXXXXXXX  R13: XXXXXXXX  R14: XXXXXXXX  R15: XXXXXXXX
+
+MACL: XXXXXXXX MACH: XXXXXXXX
+
+  PC: XXXXXXXX   PR: XXXXXXXX  GBR: XXXXXXXX   SR: XXXXXXXX
+
+ FR0: XXXXXXXX  FR1: XXXXXXXX  FR2: XXXXXXXX  FR3: XXXXXXXX 
+ FR4: XXXXXXXX  FR5: XXXXXXXX  FR6: XXXXXXXX  FR7: XXXXXXXX 
+ FR8: XXXXXXXX  FR9: XXXXXXXX FR10: XXXXXXXX FR11: XXXXXXXX 
+FR12: XXXXXXXX FR13: XXXXXXXX FR14: XXXXXXXX FR15: XXXXXXXX 
+
+ XR0: XXXXXXXX  XR1: XXXXXXXX  XR2: XXXXXXXX  XR3: XXXXXXXX 
+ XR4: XXXXXXXX  XR5: XXXXXXXX  XR6: XXXXXXXX  XR7: XXXXXXXX 
+ XR8: XXXXXXXX  XR9: XXXXXXXX XR10: XXXXXXXX XR11: XXXXXXXX 
+XR12: XXXXXXXX XR13: XXXXXXXX XR14: XXXXXXXX XR15: XXXXXXXX 
+
+FPSCR: XXXXXXXX FPUL: XXXXXXXX
+
+ */
+
+static void
+hexvalue (unsigned long int value, char *buf, size_t len)
+{
+  char *cp = _itoa_word (value, buf + len, 16, 0);
+  while (cp > buf)
+    *--cp = '0';
+}
+
+static void
+register_dump (int fd, struct sigcontext *ctx)
+{
+  char regs[22][8];
+  char fpregs[34][8];
+  struct iovec iov[112];
+  size_t nr = 0;
+
+#define ADD_STRING(str) \
+  iov[nr].iov_base = (char *) str;					      \
+  iov[nr].iov_len = strlen (str);					      \
+  ++nr
+#define ADD_MEM(str, len) \
+  iov[nr].iov_base = str;						      \
+  iov[nr].iov_len = len;						      \
+  ++nr
+
+  /* Generate strings of register contents.  */
+  hexvalue (ctx->sc_regs[0], regs[0], 8);
+  hexvalue (ctx->sc_regs[1], regs[1], 8);
+  hexvalue (ctx->sc_regs[2], regs[2], 8);
+  hexvalue (ctx->sc_regs[3], regs[3], 8);
+  hexvalue (ctx->sc_regs[4], regs[4], 8);
+  hexvalue (ctx->sc_regs[5], regs[5], 8);
+  hexvalue (ctx->sc_regs[6], regs[6], 8);
+  hexvalue (ctx->sc_regs[7], regs[7], 8);
+  hexvalue (ctx->sc_regs[8], regs[8], 8);
+  hexvalue (ctx->sc_regs[9], regs[9], 8);
+  hexvalue (ctx->sc_regs[10], regs[10], 8);
+  hexvalue (ctx->sc_regs[11], regs[11], 8);
+  hexvalue (ctx->sc_regs[12], regs[12], 8);
+  hexvalue (ctx->sc_regs[13], regs[13], 8);
+  hexvalue (ctx->sc_regs[14], regs[14], 8);
+  hexvalue (ctx->sc_regs[15], regs[15], 8);
+  hexvalue (ctx->sc_macl, regs[16], 8);
+  hexvalue (ctx->sc_mach, regs[17], 8);
+  hexvalue (ctx->sc_pc, regs[18], 8);
+  hexvalue (ctx->sc_pr, regs[19], 8);
+  hexvalue (ctx->sc_gbr, regs[20], 8);
+  hexvalue (ctx->sc_sr, regs[21], 8);
+
+  /* Generate the output.  */
+  ADD_STRING ("Register dump:\n\n  R0: ");
+  ADD_MEM (regs[0], 8);
+  ADD_STRING ("   R1: ");
+  ADD_MEM (regs[1], 8);
+  ADD_STRING ("   R2: ");
+  ADD_MEM (regs[2], 8);
+  ADD_STRING ("   R3: ");
+  ADD_MEM (regs[3], 8);
+  ADD_STRING ("\n  R4: ");
+  ADD_MEM (regs[4], 8);
+  ADD_STRING ("   R5: ");
+  ADD_MEM (regs[5], 8);
+  ADD_STRING ("   R6: ");
+  ADD_MEM (regs[6], 8);
+  ADD_STRING ("   R7: ");
+  ADD_MEM (regs[7], 8);
+  ADD_STRING ("\n  R8: ");
+  ADD_MEM (regs[8], 8);
+  ADD_STRING ("   R9: ");
+  ADD_MEM (regs[9], 8);
+  ADD_STRING ("  R10: ");
+  ADD_MEM (regs[10], 8);
+  ADD_STRING ("  R11: ");
+  ADD_MEM (regs[11], 8);
+  ADD_STRING ("\n R12: ");
+  ADD_MEM (regs[12], 8);
+  ADD_STRING ("  R13: ");
+  ADD_MEM (regs[13], 8);
+  ADD_STRING ("  R14: ");
+  ADD_MEM (regs[14], 8);
+  ADD_STRING ("  R15: ");
+  ADD_MEM (regs[15], 8);
+
+  ADD_STRING ("\n\nMACL: ");
+  ADD_MEM (regs[16], 8);
+  ADD_STRING (" MACH: ");
+  ADD_MEM (regs[17], 8);
+
+  ADD_STRING ("\n\n  PC: ");
+  ADD_MEM (regs[18], 8);
+  ADD_STRING ("   PR: ");
+  ADD_MEM (regs[19], 8);
+  ADD_STRING ("  GBR: ");
+  ADD_MEM (regs[20], 8);
+  ADD_STRING ("   SR: ");
+  ADD_MEM (regs[21], 8);
+
+  ADD_STRING ("\n");
+
+  if (ctx->sc_ownedfp != NULL)
+    {
+      hexvalue (ctx->sc_fpregs[0], fpregs[0], 8);
+      hexvalue (ctx->sc_fpregs[1], fpregs[1], 8);
+      hexvalue (ctx->sc_fpregs[2], fpregs[2], 8);
+      hexvalue (ctx->sc_fpregs[3], fpregs[3], 8);
+      hexvalue (ctx->sc_fpregs[4], fpregs[4], 8);
+      hexvalue (ctx->sc_fpregs[5], fpregs[5], 8);
+      hexvalue (ctx->sc_fpregs[6], fpregs[6], 8);
+      hexvalue (ctx->sc_fpregs[7], fpregs[7], 8);
+      hexvalue (ctx->sc_fpregs[8], fpregs[8], 8);
+      hexvalue (ctx->sc_fpregs[9], fpregs[9], 8);
+      hexvalue (ctx->sc_fpregs[10], fpregs[10], 8);
+      hexvalue (ctx->sc_fpregs[11], fpregs[11], 8);
+      hexvalue (ctx->sc_fpregs[12], fpregs[12], 8);
+      hexvalue (ctx->sc_fpregs[13], fpregs[13], 8);
+      hexvalue (ctx->sc_fpregs[14], fpregs[14], 8);
+      hexvalue (ctx->sc_fpregs[15], fpregs[15], 8);
+      hexvalue (ctx->sc_xfpregs[0], fpregs[16], 8);
+      hexvalue (ctx->sc_xfpregs[1], fpregs[17], 8);
+      hexvalue (ctx->sc_xfpregs[2], fpregs[18], 8);
+      hexvalue (ctx->sc_xfpregs[3], fpregs[19], 8);
+      hexvalue (ctx->sc_xfpregs[4], fpregs[20], 8);
+      hexvalue (ctx->sc_xfpregs[5], fpregs[21], 8);
+      hexvalue (ctx->sc_xfpregs[6], fpregs[22], 8);
+      hexvalue (ctx->sc_xfpregs[7], fpregs[23], 8);
+      hexvalue (ctx->sc_xfpregs[8], fpregs[24], 8);
+      hexvalue (ctx->sc_xfpregs[9], fpregs[25], 8);
+      hexvalue (ctx->sc_xfpregs[10], fpregs[26], 8);
+      hexvalue (ctx->sc_xfpregs[11], fpregs[27], 8);
+      hexvalue (ctx->sc_xfpregs[12], fpregs[28], 8);
+      hexvalue (ctx->sc_xfpregs[13], fpregs[29], 8);
+      hexvalue (ctx->sc_xfpregs[14], fpregs[30], 8);
+      hexvalue (ctx->sc_xfpregs[15], fpregs[31], 8);
+      hexvalue (ctx->sc_fpscr, fpregs[32], 8);
+      hexvalue (ctx->sc_fpul, fpregs[33], 8);
+
+      ADD_STRING ("\n\n FR0: ");
+      ADD_MEM (fpregs[0], 8);
+      ADD_STRING ("  FR1: ");
+      ADD_MEM (fpregs[1], 8);
+      ADD_STRING ("  FR2: ");
+      ADD_MEM (fpregs[2], 8);
+      ADD_STRING ("  FR3: ");
+      ADD_MEM (fpregs[3], 8);
+      ADD_STRING ("\n FR4: ");
+      ADD_MEM (fpregs[4], 8);
+      ADD_STRING ("  FR5: ");
+      ADD_MEM (fpregs[5], 8);
+      ADD_STRING ("  FR6: ");
+      ADD_MEM (fpregs[6], 8);
+      ADD_STRING ("  FR7: ");
+      ADD_MEM (fpregs[7], 8);
+      ADD_STRING ("\n FR8: ");
+      ADD_MEM (fpregs[8], 8);
+      ADD_STRING ("  FR9: ");
+      ADD_MEM (fpregs[9], 8);
+      ADD_STRING (" FR10: ");
+      ADD_MEM (fpregs[10], 8);
+      ADD_STRING (" FR11: ");
+      ADD_MEM (fpregs[11], 8);
+      ADD_STRING ("\nFR12: ");
+      ADD_MEM (fpregs[12], 8);
+      ADD_STRING (" FR13: ");
+      ADD_MEM (fpregs[13], 8);
+      ADD_STRING (" FR14: ");
+      ADD_MEM (fpregs[14], 8);
+      ADD_STRING (" FR15: ");
+      ADD_MEM (fpregs[15], 8);
+      ADD_STRING ("\n\n XR0: ");
+      ADD_MEM (fpregs[16], 8);
+      ADD_STRING ("  XR1: ");
+      ADD_MEM (fpregs[17], 8);
+      ADD_STRING ("  XR2: ");
+      ADD_MEM (fpregs[18], 8);
+      ADD_STRING ("  XR3: ");
+      ADD_MEM (fpregs[19], 8);
+      ADD_STRING ("\n XR4: ");
+      ADD_MEM (fpregs[20], 8);
+      ADD_STRING ("  XR5: ");
+      ADD_MEM (fpregs[21], 8);
+      ADD_STRING ("  XR6: ");
+      ADD_MEM (fpregs[22], 8);
+      ADD_STRING ("  XR7: ");
+      ADD_MEM (fpregs[23], 8);
+      ADD_STRING ("\n XR8: ");
+      ADD_MEM (fpregs[24], 8);
+      ADD_STRING ("  XR9: ");
+      ADD_MEM (fpregs[25], 8);
+      ADD_STRING (" XR10: ");
+      ADD_MEM (fpregs[26], 8);
+      ADD_STRING (" XR11: ");
+      ADD_MEM (fpregs[27], 8);
+      ADD_STRING ("\nXR12: ");
+      ADD_MEM (fpregs[28], 8);
+      ADD_STRING (" XR13: ");
+      ADD_MEM (fpregs[29], 8);
+      ADD_STRING (" XR14: ");
+      ADD_MEM (fpregs[30], 8);
+      ADD_STRING (" XR15: ");
+      ADD_MEM (fpregs[31], 8);
+
+      ADD_STRING ("\n\nFPSCR: ");
+      ADD_MEM (fpregs[32], 8);
+      ADD_STRING (" FPUL: ");
+      ADD_MEM (fpregs[33], 8);
+
+      ADD_STRING ("\n");
+    }
+
+  /* Write the stuff out.  */
+  writev (fd, iov, nr);
+}
+
+
+#define REGISTER_DUMP register_dump (fd, &ctx)
diff --git a/sysdeps/unix/sysv/linux/sh/shmctl.c b/sysdeps/unix/sysv/linux/sh/shmctl.c
new file mode 100644
index 0000000000..7eac6380dd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/shmctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/sh/sigcontextinfo.h b/sysdeps/unix/sysv/linux/sh/sigcontextinfo.h
new file mode 100644
index 0000000000..f35322fef0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sigcontextinfo.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Philip Blundell <philb@gnu.org>, 1999.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#define SIGCONTEXT int _a2, int _a3, int _a4, struct sigcontext
+
+#define SIGCONTEXT_EXTRA_ARGS _a2, _a3, _a4,
+#define GET_PC(ctx)	((void *) ctx.sc_pc)
+#define GET_FRAME(ctx)	((void *) ctx.sc_regs[14])
+#define GET_STACK(ctx)	((void *) ctx.sc_regs[15])
diff --git a/sysdeps/unix/sysv/linux/sh/socket.S b/sysdeps/unix/sysv/linux/sh/socket.S
new file mode 100644
index 0000000000..814380e61d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/socket.S
@@ -0,0 +1,116 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+#include <socketcall.h>
+
+#define P(a, b) P2(a, b)
+#define P2(a, b) a##b
+
+	.text
+/* The socket-oriented system calls are handled unusally in Linux.
+   They are all gated through the single `socketcall' system call number.
+   `socketcall' takes two arguments: the first is the subcode, specifying
+   which socket function is being called; and the second is a pointer to
+   the arguments to the specific function.
+
+   The .S files for the other calls just #define socket and #include this.  */
+
+#ifndef __socket
+#define __socket P(__,socket)
+#endif
+
+#define PUSHARGS_1	mov.l r4,@-r15
+#define PUSHARGS_2	mov.l r5,@-r15; PUSHARGS_1
+#define PUSHARGS_3	mov.l r6,@-r15; PUSHARGS_2
+#define PUSHARGS_4	mov.l r7,@-r15; PUSHARGS_3
+#define PUSHARGS_5	PUSHARGS_4	/* Caller has already pushed arg 5 */
+#define PUSHARGS_6	PUSHARGS_4	/* Caller has already pushed arg 5,6 */
+
+#define POPARGS_1	add #4,r15
+#define POPARGS_2	add #8,r15
+#define POPARGS_3	add #12,r15
+#define POPARGS_4	add #16,r15
+#define POPARGS_5	add #16,r15
+#define POPARGS_6	add #16,r15 
+
+#ifndef NARGS
+#define NARGS 3			/* If we were called with no wrapper, this is really socket() */
+#endif
+
+.globl __socket
+ENTRY (__socket)
+	/* This will not work in the case of a socket call being interrupted
+	   by a signal.  If the signal handler uses any stack the arguments
+	   to socket will be trashed.  The results of a restart of any
+	   socket call are then unpredictable. */
+
+	/* Push args onto the stack.  */
+	P(PUSHARGS_,NARGS)
+
+        /* Do the system call trap.  */
+	mov #+P(SOCKOP_,socket), r4
+	mov r15, r5
+	mov.l .L1,r0
+	trapa #0
+
+	/* Pop args off the stack */
+	P(POPARGS_,NARGS)
+
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	1f
+
+	mov.l .L2, r1
+#ifdef SHARED
+	mov	r0, r2
+	mov.l	r12, @-r15
+	sts.l	pr, @-r15
+        mov.l	0f, r12
+	mova	0f, r0
+	add	r0, r12
+	mova	.L2, r0
+	add	r0, r1
+	jsr @r1
+	 mov	r2, r0
+	lds.l	@r15+, pr
+	rts
+	 mov.l	@r15+, r12
+	.align 2
+0:
+	.long	_GLOBAL_OFFSET_TABLE_
+#else
+	jmp @r1
+	 nop
+#endif
+1:
+	/* Successful; return the syscall's value.  */
+	rts
+	 nop
+	.align 2
+.L1:
+	.long	SYS_ify(socketcall)
+.L2:
+	.long	PLTJMP(C_SYMBOL_NAME(__syscall_error))
+
+PSEUDO_END (__socket)
+
+weak_alias (__socket, socket)
diff --git a/sysdeps/unix/sysv/linux/sh/sys/io.h b/sysdeps/unix/sysv/linux/sh/sys/io.h
new file mode 100644
index 0000000000..5cb7a26caa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sys/io.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef	_SYS_IO_H
+
+#define	_SYS_IO_H	1
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* If TURN_ON is TRUE, request for permission to do direct i/o on the
+   port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
+   permission off for that range.  This call requires root privileges.  */
+extern int ioperm (unsigned long int __from, unsigned long int __num,
+		   int __turn_on) __THROW;
+
+/* Set the I/O privilege level to LEVEL.  If LEVEL is nonzero,
+   permission to access any I/O port is granted.  This call requires
+   root privileges. */
+extern int iopl (int __level) __THROW;
+
+/* The functions that actually perform reads and writes.  */
+extern unsigned char inb (unsigned long int port) __THROW;
+extern unsigned short int inw (unsigned long int port) __THROW;
+extern unsigned long int inl (unsigned long int port) __THROW;
+
+extern void outb (unsigned char value, unsigned long int port) __THROW;
+extern void outw (unsigned short value, unsigned long int port) __THROW;
+extern void outl (unsigned long value, unsigned long int port) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_IO_H */
diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
new file mode 100644
index 0000000000..b0570606c4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
@@ -0,0 +1,109 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Where is System V/SH ABI?  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+/* We need the signal context definitions even if they are not used
+   included in <signal.h>.  */
+#include <bits/sigcontext.h>
+
+
+typedef int greg_t;
+
+/* Number of general registers.  */
+#define NGREG	16
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NGREG];
+
+#ifdef __USE_GNU
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  R0 = 0,
+#define R0	R0
+  R1 = 1,
+#define R1	R1
+  R2 = 2,
+#define R2	R2
+  R3 = 3,
+#define R3	R3
+  R4 = 4,
+#define R4	R4
+  R5 = 5,
+#define R5	R5
+  R6 = 6,
+#define R6	R6
+  R7 = 7,
+#define R7	R7
+  R8 = 8,
+#define R8	R8
+  R9 = 9,
+#define R9	R9
+  R10 = 10,
+#define R10	R10
+  R11 = 11,
+#define R11	R11
+  R12 = 12,
+#define R12	R12
+  R13 = 13,
+#define R13	R13
+  R14 = 14,
+#define R14	R14
+  R15 = 15,
+#define R15	R15
+};
+#endif
+
+typedef int freg_t;
+
+/* Number of FPU registers.  */
+#define NFREG	16
+
+/* Structure to describe FPU registers.  */
+typedef freg_t fpregset_t[NFREG];
+
+/* Context to describe whole processor state.  */
+typedef struct
+  {
+    gregset_t gregs;
+    fpregset_t fpregs;
+    fpregset_t xfpregs;
+    unsigned int fpscr;
+    unsigned int fpul;
+    unsigned int macl;
+    unsigned int mach;
+  } mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+  {
+    unsigned long int uc_flags;
+    struct ucontext *uc_link;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    __sigset_t uc_sigmask;
+  } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/sh/sys/user.h b/sysdeps/unix/sysv/linux/sh/sys/user.h
new file mode 100644
index 0000000000..7ea3cf67b3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sys/user.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_USER_H
+#define _SYS_USER_H	1
+
+#include <features.h>
+
+/* <sys/ptrace.h> and <linux/ptrace.h> both define the PTRACE_* macros.
+   This leads to compilation problems with programs which include both
+   user.h and ptrace.h (eg: GDB).  Do not include <linux/ptrace.h> here. */
+#include <asm/ptrace.h>
+
+struct user_fp
+{
+  struct fp_reg
+  {
+    unsigned int sign1:1;
+    unsigned int unused:15;
+    unsigned int sign2:1;
+    unsigned int exponent:14;
+    unsigned int j:1;
+    unsigned int mantissa1:31;
+    unsigned int mantissa0:32;
+  } fpregs[8];
+  unsigned int fpsr:32;
+  unsigned int fpcr:32;
+};
+
+struct user
+{
+  struct pt_regs regs;		/* General registers */
+  int u_fpvalid;		/* True if math co-processor being used. */
+
+  unsigned long int u_tsize;	/* Text segment size (pages). */
+  unsigned long int u_dsize;	/* Data segment size (pages). */
+  unsigned long int u_ssize;	/* Stack segment size (pages). */
+
+  unsigned long start_code;	/* Starting virtual address of text. */
+  unsigned long start_stack;	/* Starting virtual address of stack. */
+
+  long int signal;     		/* Signal that caused the core dump. */
+  int reserved;			/* No longer used */
+  struct pt_regs *u_ar0;	/* help gdb to find the general registers. */
+
+  unsigned long magic;		/* uniquely identify a core file */
+  char u_comm[32];		/* User command that was responsible */
+  int u_debugreg[8];
+  struct user_fp u_fp;		/* Floating point registers */
+  struct user_fp_struct *u_fp0;	/* help gdb to find the FP registers. */
+};
+
+#endif  /* sys/user.h */
diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list
new file mode 100644
index 0000000000..5446f4488e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/syscalls.list
@@ -0,0 +1,54 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+
+s_ioctl		ioctl	ioctl		3	__syscall_ioctl
+s_ipc		msgget	ipc		5	__syscall_ipc
+s_llseek	llseek _llseek		5	__syscall__llseek
+s_chown		chown	chown		3	__syscall_chown
+s_fchown	fchown	fchown		3	__syscall_fchown
+s_lchown	lchown	lchown		3	__syscall_lchown
+s_execve	execve execve		3	__syscall_execve
+rt_sigaction	-	rt_sigaction	4	__syscall_rt_sigaction
+rt_sigpending	-	rt_sigpending	2	__syscall_rt_sigpending
+rt_sigprocmask	-	rt_sigprocmask	4	__syscall_rt_sigprocmask
+rt_sigqueueinfo	-	rt_sigqueueinfo	3	__syscall_rt_sigqueueinfo
+rt_sigsuspend	-	rt_sigsuspend	2	__syscall_rt_sigsuspend
+rt_sigtimedwait	-	rt_sigtimedwait	4	__syscall_rt_sigtimedwait
+s_getcwd	getcwd getcwd		2	__syscall_getcwd
+s_getdents	getdents getdents	3	__syscall_getdents
+s_getgroups	getgroups getgroups	2	__syscall_getgroups
+s_getpriority	getpriority getpriority	2	__syscall_getpriority
+s_getegid	getegid	getegid		0	__syscall_getegid
+s_geteuid	geteuid	geteuid		0	__syscall_geteuid
+s_getuid	getuid	getuid		0	__syscall_getuid
+getresgid	-	getresgid	3	getresgid
+getresuid	-	getresuid	3	getresuid
+s_getrlimit	getrlimit getrlimit	2	__syscall_getrlimit
+s_poll		poll poll		3	__syscall_poll
+s_pread64	pread64	pread		5	__syscall_pread
+s_ptrace	ptrace	ptrace		4	__syscall_ptrace
+s_pwrite64	pwrite64 pwrite		5	__syscall_pwrite
+s_reboot	reboot	reboot		3	__syscall_reboot
+s_setrlimit	setrlimit setrlimit	3	__syscall_setrlimit
+s_sigaction	sigaction sigaction	3	__syscall_sigaction
+s_sigpending	sigpending sigpending	1	__syscall_sigpending
+s_sigprocmask	sigprocmask sigprocmask	3	__syscall_sigprocmask
+s_sigsuspend	sigsuspend sigsuspend	3	__syscall_sigsuspend
+s_setfsgid	setfsgid setfsgid	1	__syscall_setfsgid
+s_setfsuid	setfsuid setfsuid	1	__syscall_setfsuid
+s_setgid	setgid	setgid		1	__syscall_setgid
+s_setgroups	setgroups setgroups	2	__syscall_setgroups
+s_setregid	setregid setregid	2	__syscall_setregid
+s_setresgid	setresgid setresgid	3	__syscall_setresgid
+s_setresuid	setresuid setresuid	3	__syscall_setresuid
+s_setreuid	setreuid setreuid	2	__syscall_setreuid
+s_setuid	setuid	setuid		1	__syscall_setuid
+s_sysctl	sysctl	_sysctl		1	__syscall__sysctl
+s_ugetrlimit	getrlimit ugetrlimit	2	__syscall_ugetrlimit
+s_ustat		ustat	ustat		2	__syscall_ustat
+sys_fstat	fxstat fstat		2	__syscall_fstat
+sys_lstat	lxstat lstat		2	__syscall_lstat
+sys_mknod	xmknod	mknod		3	__syscall_mknod
+sys_readv	readv	readv		3	__syscall_readv
+sys_stat	xstat stat		2	__syscall_stat
+sys_writev	writev	writev		3	__syscall_writev
+syscall		-	syscall		5	syscall
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S
new file mode 100644
index 0000000000..6f9bea1238
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.S
@@ -0,0 +1,43 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* We define errno here, to be consistent with Linux/i386.  */
+
+	.section .bss
+	.globl C_SYMBOL_NAME(errno)
+	.type C_SYMBOL_NAME(errno), @object
+	.size C_SYMBOL_NAME(errno), 4
+C_SYMBOL_NAME(errno):
+	.space	4
+weak_alias (errno, _errno)
+	.text
+
+/* The syscall stubs jump here when they detect an error.
+   The code for Linux is almost identical to the canonical Unix
+   code, except that the error number in R0 is negated.  */
+
+#undef CALL_MCOUNT
+#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers R0.  */
+
+ENTRY (__syscall_error)
+	neg r4, r0
+
+#define __syscall_error __syscall_error_1
+#include <sysdeps/unix/sh/sysdep.S>
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h
new file mode 100644
index 0000000000..6024b9fdac
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -0,0 +1,132 @@
+/* Copyright (C) 1992, 93, 95-99, 2000 Free Software Foundation,
+   Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
+   Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _LINUX_SH_SYSDEP_H
+#define _LINUX_SH_SYSDEP_H 1
+
+/* There is some commonality.  */
+#include <sysdeps/unix/sh/sysdep.h>
+
+/* For Linux we can use the system call table in the header file
+	/usr/include/asm/unistd.h
+   of the kernel.  But these symbols do not follow the SYS_* syntax
+   so we have to redefine the `SYS_ify' macro here.  */
+#undef SYS_ify
+#define SYS_ify(syscall_name)	(__NR_##syscall_name)
+
+
+#ifdef __ASSEMBLER__
+
+/* Linux uses a negative return value to indicate syscall errors,
+   unlike most Unices, which use the condition codes' carry flag.
+
+   Since version 2.1 the return value of a system call might be
+   negative even if the call succeeded.  E.g., the `lseek' system call
+   might return a large offset.  Therefore we must not anymore test
+   for < 0, but test for a real error by making sure the value in R0
+   is a real error number.  Linus said he will make sure the no syscall
+   returns a value in -1 .. -4095 as a valid result so we can savely
+   test with -4095.  */
+
+#define _IMM12 #-12
+#undef	PSEUDO
+#ifdef SHARED
+#define	PSEUDO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name); \
+    DO_CALL (args, syscall_name); \
+    mov r0,r1; \
+    mov _IMM12,r2; \
+    shad r2,r1; \
+    not r1,r1; \
+    tst r1,r1; \
+    bf 1f; \
+    mov r0,r4; \
+    mov.l r12,@-r15; \
+    sts.l pr,@-r15; \
+    mov.l 0f,r12; \
+    mova 0f,r0; \
+    add r0,r12; \
+    mov.l 2f,r1; \
+    mova 2f,r0; \
+    add r0,r1; \
+    jsr @r1; \
+     nop; \
+    lds.l @r15+,pr; \
+    rts; \
+     mov.l @r15+,r12; \
+    .align 2; \
+ 2: .long PLTJMP(C_SYMBOL_NAME(__syscall_error)); \
+ 0: .long _GLOBAL_OFFSET_TABLE_; \
+ 1:
+#else
+#define	PSEUDO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name); \
+    DO_CALL (args, syscall_name); \
+    mov r0,r1; \
+    mov _IMM12,r2; \
+    shad r2,r1; \
+    not r1,r1; \
+    tst r1,r1; \
+    bf 1f; \
+    mov.l 2f,r1; \
+    jmp @r1; \
+     mov r0, r4; \
+    .align 2; \
+ 2: .long PLTJMP(C_SYMBOL_NAME(__syscall_error)); \
+ 1:
+#endif
+
+#undef	PSEUDO_END
+#define	PSEUDO_END(name) \
+  SYSCALL_ERROR_HANDLER \
+  END (name)
+
+#define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
+
+#define SYSCALL_INST0	trapa #0
+#define SYSCALL_INST1	trapa #0
+#define SYSCALL_INST2	trapa #0
+#define SYSCALL_INST3	trapa #0
+#define SYSCALL_INST4	trapa #0
+#define SYSCALL_INST5	trapa #1
+#define SYSCALL_INST6	trapa #2
+
+#undef	DO_CALL
+#define DO_CALL(args, syscall_name) \
+    mov.l 1f,r0; \
+    SYSCALL_INST##args;	\
+    bra 2f; \
+     nop; \
+    .align 2; \
+ 1: .long SYS_ify(syscall_name); \
+ 2:
+
+#else /* not __ASSEMBLER__ */
+
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+  __syscall_##name(args)
+
+#endif	/* __ASSEMBLER__ */
+
+#endif /* linux/sh/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/sh/vfork.S b/sysdeps/unix/sysv/linux/sh/vfork.S
new file mode 100644
index 0000000000..27381fb3e0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/vfork.S
@@ -0,0 +1,112 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+/* Clone the calling process, but without copying the whole address space.
+   The calling process is suspended until the new process exits or is
+   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
+   and the process ID of the new process to the old process.  */
+
+ENTRY (__vfork)
+
+#ifdef __NR_vfork
+	mov	#+__NR_vfork, r0
+	trapa	#0
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	1f
+	mov.w	.L1, r1
+	cmp/eq	r1, r0
+	bt	2f
+	mov.l	.L2, r1
+#ifdef SHARED
+	mov	r0, r4
+	mov.l	r12, @-r15
+	sts.l	pr, @-r15
+	mov.l	0f, r12
+	mova	0f, r0
+	add	r0, r12
+	mova	.L2, r0
+	add	r0, r1
+	jsr	@r1
+	 nop
+	lds.l	@r15+, pr
+	rts
+	 mov.l	@r15+, r12
+	.align	2
+0:
+	.long	_GLOBAL_OFFSET_TABLE_
+#else
+	jmp	@r1
+	 mov	r0, r4
+#endif
+.L1:
+	.word	-ENOSYS
+1:
+	rts
+	 nop
+2:
+#endif
+
+	/* If we don't have vfork, fork is close enough.  */
+	mov	#+__NR_fork, r0
+	trapa	#0
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	1f
+	mov.l	.L2, r1
+#ifdef SHARED
+	mov	r0, r4
+	mov.l	r12, @-r15
+	sts.l	pr, @-r15
+        mov.l	0f, r12
+	mova	0f, r0
+	add	r0, r12
+	mova	.L2, r0
+	add	r0, r1
+	jsr	@r1
+	 nop
+	lds.l	@r15+, pr
+	rts
+	 mov.l	@r15+, r12
+	.align	2
+0:
+	.long	_GLOBAL_OFFSET_TABLE_
+#else
+	jmp	@r1
+	 mov	r0, r4
+#endif
+	.align	2
+.L2:
+	.long	PLTJMP(C_SYMBOL_NAME(__syscall_error))
+1:
+	rts
+	 nop
+	
+PSEUDO_END (__vfork)
+
+weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/sh/xstat.c b/sysdeps/unix/sysv/linux/sh/xstat.c
new file mode 100644
index 0000000000..e9869f5508
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/xstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/xstat.c>