This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] m32r-linux support to glibc.


This is a patch for glibc to support m32r-linux-gnu target. (Renesas M32R)

Please comit it to mainline.


You haven't listened to what you've been told.  The code will not be
added to glibc.  You have to maintain the code as an add-on yourself.

This patch is a patch for glibc not using add-on style to support m32r-linux-gnu target.


Please commit it and regenerate configure.

Regards,

Kazuhiro Inaoka
2004-10-19  Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>

	* shlib-versions: Added m32r target.
	* configure.in: check for m32r assembler line separator

2004-10-08  Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>

	* sysdeps/unix/sysv/linux/m32r/mmap.S (__mmap): Use sys_mmap2.

2004-10-05  Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>

	* sysdeps/m32r/dl-macihne.h (elf_machine_rela_relative): Replace
	static inline by auto inline, add always_inline attribute.
	(elf_machine_rela): Likewise.
	(elf_machine_lazy_rel): Likewise.
	(elf_machine_runtime_setup): add always_inline attribute.
	* sysdeps/unix/sysv/linux/m32r/bits/mman.h: Define PROT_GROWSDOWN
	and PROT_GROWSUP.
	* sysdeps/unix/sysv/linux/m32r/sysdep.h (SYSCALL_ERROR_HANDLER):
	Define RTLD_PRIVATE_ERRNO variant.  include <dl-sysdep.h>.

2004-09-09  Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>

	* sysdeps/m32r/init-first.c: Remove file

2004-09-09  Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>

	* sysdeps/m32r/Implies: New file
	* sysdeps/m32r/Makefile: New file
	* sysdeps/m32r/__longjmp.S: New file
	* sysdeps/m32r/bits/endian.h: New file
	* sysdeps/m32r/bits/huge_val.h: New file
	* sysdeps/m32r/bits/setjmp.h: New file
	* sysdeps/m32r/bsd-_setjmp.S: New file
	* sysdeps/m32r/bsd-setjmp.S: New file
	* sysdeps/m32r/dl-machine.h: New file
	* sysdeps/m32r/elf/start.S: New file
	* sysdeps/m32r/gmp-mparam.h: New file
	* sysdeps/m32r/init-first.c: New file
	* sysdeps/m32r/m32r-mcount.S: New file
	* sysdeps/m32r/machine-gmon.h: New file
	* sysdeps/m32r/memcpy.S: New file
	* sysdeps/m32r/memset.S: New file
	* sysdeps/m32r/memusage.h: New file
	* sysdeps/m32r/setjmp.S: New file
	* sysdeps/m32r/stackinfo.h: New file
	* sysdeps/m32r/strlen.S: New file
	* sysdeps/m32r/sys/ucontext.h: New file
	* sysdeps/m32r/sysdep.h: New file
	* sysdeps/unix/m32r/Makefile: New file
	* sysdeps/unix/m32r/sysdep.S: New file
	* sysdeps/unix/m32r/sysdep.h: New file
	* sysdeps/unix/sysv/linux/m32r/Dist: New file
	* sysdeps/unix/sysv/linux/m32r/Makefile: New file
	* sysdeps/unix/sysv/linux/m32r/Versions: New file
	* sysdeps/unix/sysv/linux/m32r/bits/fcntl.h: New file
	* sysdeps/unix/sysv/linux/m32r/bits/mman.h: New file
	* sysdeps/unix/sysv/linux/m32r/bits/resource.h: New file
	* sysdeps/unix/sysv/linux/m32r/brk.c: New file
	* sysdeps/unix/sysv/linux/m32r/chown.c: New file
	* sysdeps/unix/sysv/linux/m32r/clone.S: New file
	* sysdeps/unix/sysv/linux/m32r/fchown.c: New file
	* sysdeps/unix/sysv/linux/m32r/fcntl.c: New file
	* sysdeps/unix/sysv/linux/m32r/flushcache.S: New file
	* sysdeps/unix/sysv/linux/m32r/fxstat.c: New file
	* sysdeps/unix/sysv/linux/m32r/getegid.c: New file
	* sysdeps/unix/sysv/linux/m32r/geteuid.c: New file
	* sysdeps/unix/sysv/linux/m32r/getgroups.c: New file
	* sysdeps/unix/sysv/linux/m32r/getresgid.c: New file
	* sysdeps/unix/sysv/linux/m32r/getresuid.c: New file
	* sysdeps/unix/sysv/linux/m32r/getrlimit.c: New file
	* sysdeps/unix/sysv/linux/m32r/getrlimit64.c: New file
	* sysdeps/unix/sysv/linux/m32r/getuid.c: New file
	* sysdeps/unix/sysv/linux/m32r/lchown.c: New file
	* sysdeps/unix/sysv/linux/m32r/lockf64.c: New file
	* sysdeps/unix/sysv/linux/m32r/lxstat.c: New file
	* sysdeps/unix/sysv/linux/m32r/m32r-stub.c: New file
	* sysdeps/unix/sysv/linux/m32r/mmap.S: New file
	* sysdeps/unix/sysv/linux/m32r/msgctl.c: New file
	* sysdeps/unix/sysv/linux/m32r/pipe.S: New file
	* sysdeps/unix/sysv/linux/m32r/profil-counter.h: New file
	* sysdeps/unix/sysv/linux/m32r/semctl.c: New file
	* sysdeps/unix/sysv/linux/m32r/setegid.c: New file
	* sysdeps/unix/sysv/linux/m32r/seteuid.c: New file
	* sysdeps/unix/sysv/linux/m32r/setfsgid.c: New file
	* sysdeps/unix/sysv/linux/m32r/setfsuid.c: New file
	* sysdeps/unix/sysv/linux/m32r/setgid.c: New file
	* sysdeps/unix/sysv/linux/m32r/setgroups.c: New file
	* sysdeps/unix/sysv/linux/m32r/setregid.c: New file
	* sysdeps/unix/sysv/linux/m32r/setresgid.c: New file
	* sysdeps/unix/sysv/linux/m32r/setresuid.c: New file
	* sysdeps/unix/sysv/linux/m32r/setreuid.c: New file
	* sysdeps/unix/sysv/linux/m32r/setrlimit.c: New file
	* sysdeps/unix/sysv/linux/m32r/setuid.c: New file
	* sysdeps/unix/sysv/linux/m32r/shmctl.c: New file
	* sysdeps/unix/sysv/linux/m32r/sigcontextinfo.h: New file
	* sysdeps/unix/sysv/linux/m32r/socket.S: New file
	* sysdeps/unix/sysv/linux/m32r/sys/cachectl.h: New file
	* sysdeps/unix/sysv/linux/m32r/sys/io.h: New file
	* sysdeps/unix/sysv/linux/m32r/sys/tas.h: New file
	* sysdeps/unix/sysv/linux/m32r/sys/ucontext.h: New file
	* sysdeps/unix/sysv/linux/m32r/sys/user.h: New file
	* sysdeps/unix/sysv/linux/m32r/syscall.S: New file
	* sysdeps/unix/sysv/linux/m32r/syscalls.list: New file
	* sysdeps/unix/sysv/linux/m32r/sysdep.S: New file
	* sysdeps/unix/sysv/linux/m32r/sysdep.h: New file
	* sysdeps/unix/sysv/linux/m32r/vfork.S: New file
	* sysdeps/unix/sysv/linux/m32r/xstat.c: New file
2004-09-09  Kazuhiro Inaoka  <inaoka.kazuhiro@renesas.com>

	* sysdeps/m32r/pspinlock.c: New file.
	* sysdeps/m32r/pt-machine.h: New file.
--- shlib-versions.org	2004-10-19 14:41:25.000000000 +0900
+++ shlib-versions	2004-10-19 14:42:20.000000000 +0900
@@ -25,6 +25,7 @@
 cris-.*-linux.*		DEFAULT			GLIBC_2.2
 x86_64-.*-linux.*       DEFAULT			GLIBC_2.2.5
 powerpc64-.*-linux.*	DEFAULT			GLIBC_2.3
+m32r-.*-linux.*		DEFAULT			GLIBC_2.3
 .*-.*-gnu-gnu.*		DEFAULT			GLIBC_2.2.6
 
 # Configuration		Library=version		Earliest symbol set (optional)
@@ -65,6 +66,7 @@
 sparc.*-.*-linux.*	ld=ld-linux.so.2
 alpha.*-.*-linux.*	ld=ld-linux.so.2
 arm.*-.*-linux.*	ld=ld-linux.so.2
+m32r.*-.*-linux.*	ld=ld-linux.so.2
 sh.*-.*-linux.*		ld=ld-linux.so.2	GLIBC_2.2
 ia64-.*-linux.*		ld=ld-linux-ia64.so.2	GLIBC_2.2
 mips.*-.*-linux.*	ld=ld.so.1		GLIBC_2.0 GLIBC_2.2
--- configure.in.org	2004-10-19 14:40:49.000000000 +0900
+++ configure.in	2004-10-19 13:48:49.000000000 +0900
@@ -1625,6 +1625,10 @@
     libc_cv_asm_line_sep='@'
     AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep)
     ;;
+  m32r*)
+    libc_cv_asm_line_sep='!'
+    AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep)
+    ;;
   hppa*linux*)
   AC_CACHE_CHECK(for assembler line separator,
 		 libc_cv_asm_line_sep, [dnl
diff --exclude CVS -uNr sysdeps.org/m32r/Implies sysdeps/m32r/Implies
--- sysdeps.org/m32r/Implies	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/Implies	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,3 @@
+wordsize-32
+ieee754/flt-32
+ieee754/dbl-64
diff --exclude CVS -uNr sysdeps.org/m32r/Makefile sysdeps/m32r/Makefile
--- sysdeps.org/m32r/Makefile	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/Makefile	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,7 @@
+# m32r/ELF specific definitions.
+
+# The assembler on m32r needs the -fPIC flag even when it's assembler code.
+#ASFLAGS-.os = -fPIC
+ifeq ($(subdir),gmon)
+sysdep_routines += m32r-mcount
+endif
diff --exclude CVS -uNr sysdeps.org/m32r/__longjmp.S sysdeps/m32r/__longjmp.S
--- sysdeps.org/m32r/__longjmp.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/__longjmp.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,43 @@
+/* longjmp for M32R.
+   Copyright (C) 2003, 2004 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 _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+/* __longjmp(jmpbuf, val) */
+
+ENTRY (__longjmp)
+	ld	r8, @r0+
+	ld	r9, @r0+
+	ld	r10, @r0+
+	ld	r11, @r0+
+	ld	r12, @r0+
+	ld	r13, @r0+
+	ld	r2, @r0+	/* lr */
+	ld	r15, @r0	/* sp */
+
+	mv	r0,r1
+	bnez	r0, 1f		/* get the return value in place */
+	ldi	r0, #1		/* can't let setjmp() return zero! */
+	.fillinsn
+1:
+	jmp	r2
+END (__longjmp)
diff --exclude CVS -uNr sysdeps.org/m32r/bits/endian.h sysdeps/m32r/bits/endian.h
--- sysdeps.org/m32r/bits/endian.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/bits/endian.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,13 @@
+/* M32R is bi-endian. */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#ifdef __LITTLE_ENDIAN__
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#define __FLOAT_WORD_ORDER __LITTLE_ENDIAN
+#else
+#define __BYTE_ORDER __BIG_ENDIAN
+#define __FLOAT_WORD_ORDER __BIG_ENDIAN
+#endif
diff --exclude CVS -uNr sysdeps.org/m32r/bits/huge_val.h sysdeps/m32r/bits/huge_val.h
--- sysdeps.org/m32r/bits/huge_val.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/bits/huge_val.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,56 @@
+/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity).
+   Used by <stdlib.h> and <math.h> functions for overflow.
+   M32R version.
+   Copyright (C) 1992, 95, 96, 97, 98, 99, 2000, 2004
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _MATH_H
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
+
+/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
+
+#if __GNUC_PREREQ(3,3)
+# define HUGE_VAL	(__builtin_huge_val())
+#elif __GNUC_PREREQ(2,96)
+# define HUGE_VAL	(__extension__ 0x1.0p2047)
+#elif defined __GNUC__
+
+#  define HUGE_VAL \
+  (__extension__							      \
+   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
+    { __l: 0x000000007ff00000ULL }).__d)
+
+#else /* not GCC */
+
+# include <endian.h>
+
+typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
+
+# if __BYTE_ORDER == __BIG_ENDIAN
+#  define __HUGE_VAL_bytes	{ 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
+# endif
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  define __HUGE_VAL_bytes	{ 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
+# endif
+
+static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
+# define HUGE_VAL	(__huge_val.__d)
+
+#endif	/* GCC.  */
diff --exclude CVS -uNr sysdeps.org/m32r/bits/setjmp.h sysdeps/m32r/bits/setjmp.h
--- sysdeps.org/m32r/bits/setjmp.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/bits/setjmp.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,55 @@
+/* Copyright (C) 2003, 2004 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.  */
+
+/* Define the machine-dependent type `jmp_buf'.  M32R version. */
+#ifndef _BITS_SETJMP_H
+#define _BITS_SETJMP_H  1
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+#ifndef _ASM
+typedef struct
+  {
+    /* Callee-saved registers r8 through r15.  */
+    int __regs[8];
+
+    /* Program counter.  */
+    void * __pc;
+  } __jmp_buf[1];
+#endif
+
+#define JB_R8  0
+#define JB_R9  1
+#define JB_R10 2
+#define JB_R11 3
+#define JB_R12 4
+#define JB_FP  5
+#define JB_LR  6
+#define JB_SP  7
+#define JB_PC  8
+
+#define JB_SIZE		(4 * 9)
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((void *) (address) < &(jmpbuf)[0].__regs[JB_SP])
+
+#endif  /* bits/setjmp.h */
diff --exclude CVS -uNr sysdeps.org/m32r/bsd-_setjmp.S sysdeps/m32r/bsd-_setjmp.S
--- sysdeps.org/m32r/bsd-_setjmp.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/bsd-_setjmp.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,43 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  M32R version.
+   Copyright (C) 2003, 2004 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.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+ENTRY (_setjmp)
+#ifdef SHARED
+	mv	r2,lr
+	bl.s	.+4
+	ld24	r1,#_GLOBAL_OFFSET_TABLE_
+	add	r1,lr
+	mv	lr,r2
+
+	ld24	r2,C_SYMBOL_NAME(__sigsetjmp)
+	add	r2,r1
+	ld	r2,@r2
+#else
+	LDIMM   (r2, C_SYMBOL_NAME(__sigsetjmp))
+#endif
+	ldi     r1, #0		/* Pass a second argument of zero.  */
+	jmp     r2
+END (_setjmp)
+libc_hidden_def(_setjmp)
diff --exclude CVS -uNr sysdeps.org/m32r/bsd-setjmp.S sysdeps/m32r/bsd-setjmp.S
--- sysdeps.org/m32r/bsd-setjmp.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/bsd-setjmp.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,42 @@
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  M32R version.
+   Copyright (C) 2003, 2004 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.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+ENTRY (setjmp)
+#ifdef SHARED
+	mv	r2,lr
+	bl.s	.+4
+	ld24	r1,#_GLOBAL_OFFSET_TABLE_
+	add	r1,lr
+	mv	lr,r2
+
+	ld24	r2,C_SYMBOL_NAME(__sigsetjmp)
+	add	r2,r1
+	ld	r2,@r2
+#else
+	LDIMM	(r2, C_SYMBOL_NAME(__sigsetjmp))
+#endif
+	ldi	r1, #1		/* Pass a second argument of one.  */
+	jmp	r2
+END (setjmp)
diff --exclude CVS -uNr sysdeps.org/m32r/dl-machine.h sysdeps/m32r/dl-machine.h
--- sysdeps.org/m32r/dl-machine.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/dl-machine.h	2004-10-05 14:30:49.000000000 +0900
@@ -0,0 +1,784 @@
+/* Machine-dependent ELF dynamic relocation inline functions.  M32R version.
+   Copyright (C) 2003, 2004 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 dl_machine_h
+#define dl_machine_h
+
+/* Only dummy. This doesn't work. */
+
+#define ELF_MACHINE_NAME "M32R"
+
+#include <sys/param.h>
+
+#include <assert.h>
+
+/* Define the M32R_OLD_ABI, if you want to keep compatibility with
+  an old Renesas relocs */
+#ifdef M32R_OLD_ABI
+#define R_M32R_16_SAMPLE                1
+#define R_M32R_32_SAMPLE                2
+#define R_M32R_24_SAMPLE                3
+#define R_M32R_10_PCREL_SAMPLE          4
+#define R_M32R_18_PCREL_SAMPLE          5
+#define R_M32R_26_PCREL_SAMPLE          6
+#define R_M32R_HI16_ULO_SAMPLE          7
+#define R_M32R_HI16_SLO_SAMPLE          8
+#define R_M32R_LO16_SAMPLE              9
+#define R_M32R_SDA16_SAMPLE             10
+
+#define R_M32R_GOT24_SAMPLE             11 /* conflict */
+#define R_M32R_26_PLTREL_SAMPLE         12 /* conflict */
+#define R_M32R_GOT16_HI_ULO_SAMPLE      13
+#define R_M32R_GOT16_HI_SLO_SAMPLE      14
+#define R_M32R_GOT16_LO_SAMPLE          15
+#define R_M32R_GOTPC24_SAMPLE           16
+#define R_M32R_COPY_SAMPLE              17
+#define R_M32R_GLOB_DAT_SAMPLE          18
+#define R_M32R_JMP_SLOT_SAMPLE          19
+#define R_M32R_RELATIVE_SAMPLE          20
+#define R_M32R_GNU_VTINHERIT_SAMPLE     21
+#define R_M32R_GNU_VTENTRY_SAMPLE       22
+#endif /* M32R_OLD_ABI */
+
+/* Return nonzero iff ELF header is compatible with the running host.  */
+static inline int __attribute__ ((unused))
+elf_machine_matches_host (const Elf32_Ehdr *ehdr)
+{
+  return (ehdr->e_machine == EM_M32R);
+}
+
+
+/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
+   first element of the GOT.  This must be inlined in a function which
+   uses global data.  */
+static inline Elf32_Addr __attribute__ ((unused))
+elf_machine_dynamic (void)
+{
+  register Elf32_Addr *got;
+  asm ("   bl.s .+4\n"
+       "   ld24 %0,#_GLOBAL_OFFSET_TABLE_\n"
+       "   add %0,lr" :"=r" (got) : : "lr" );
+  return *got;
+}
+
+
+/* Return the run-time load address of the shared object.  */
+static inline Elf32_Addr __attribute__ ((unused))
+elf_machine_load_address (void)
+{
+  Elf32_Addr addr;
+  asm ("	ld24 r0,#here\n\t"
+       "	add r0,r12\n\t"
+       "	ld r0,@r0\n\t"
+       "here: \n\t"
+       "	ld24 r1,#_GLOBAL_OFFSET_TABLE_\n\t"
+       "	mv r2,r12\n\t"
+       "	sub r2,r1\n\t"
+       "	sub r2,r0\n\t"
+       "	mv %0,r2"
+       : "=r" (addr) : : "r0", "r1", "r2" );
+  return addr;
+}
+
+
+/* Set up the loaded object described by L so its unrelocated PLT
+   entries will jump to the on-demand fixup code in dl-runtime.c.  */
+
+static inline int __attribute__ ((unused, always_inline))
+elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+{
+  Elf32_Addr *got;
+  extern void _dl_runtime_resolve (Elf32_Word);
+  extern void _dl_runtime_profile (Elf32_Word);
+
+  if (l->l_info[DT_JMPREL] && lazy)
+    {
+      /* The GOT entries for functions in the PLT have not yet been filled
+	 in.  Their initial contents will arrange when called to load an
+	 offset into the .rela.plt section and _GLOBAL_OFFSET_TABLE_[1],
+	 and then jump to _GLOBAL_OFFSET_TABLE[2].  */
+      got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
+      got[1] = (Elf32_Addr) l;	/* Identify this shared object.	 */
+
+      /* The got[2] entry contains the address of a function which gets
+	 called to get the address of a so far unresolved function and
+	 jump to it.  The profiling extension of the dynamic linker allows
+	 to intercept the calls to collect information.	 In this case we
+	 don't store the address in the GOT so that all future calls also
+	 end in this function.	*/
+      if (profile)
+	{
+	  got[2] = (Elf32_Addr) &_dl_runtime_profile;
+	  /* Say that we really want profiling and the timers are started.  */
+	  GL(dl_profile_map) = l;
+	}
+      else
+	/* This function will get called to fix up the GOT entry indicated by
+	   the offset on the stack, and then jump to the resolved address.  */
+	got[2] = (Elf32_Addr) &_dl_runtime_resolve;
+    }
+  return lazy;
+}
+
+/* This code is used in dl-runtime.c to call the `fixup' function
+   and then redirect to the address it returns.	 */
+
+#define ELF_MACHINE_RUNTIME_FIXUP_ARGS int plt_type
+
+#ifdef SHARED
+#define FUN_ADDR( func )	"\n\
+	bl.s .+4                           \n\
+	ld24 r12,#_GLOBAL_OFFSET_TABLE_    \n\
+	add r12,lr                         \n\
+	ld24 r4,#" #func "                 \n\
+	add r4,r12                         \n\
+	ld r4,@r4"
+#else
+#define FUN_ADDR( func )	"\
+	seth r4,#high( " #func " ) \n\
+	or3 r4,r4,#low( " #func " )"
+#endif
+
+#define FGR_SAVE	""
+#define FGR_LOAD	""
+
+#ifdef M32R_OLD_NEWABI
+#define LOAD_ARGS_FROM_STACK( name ) "\n\
+	mv r7,lr                                \n\
+	; OLD_PLT to keep compatible mode only  \n\
+        bl.s .+4                                \n\
+        .fillinsn                               \n\
+	addi lr,# " #name " -.                  \n\
+	beq r6,lr,1f                            \n\
+	; OLT_PLT ABI                           \n\
+	pop r4     ; link map address           \n\
+	pop r5     ; reloc offset               \n\
+	.fillinsn                               \n\
+1:                                              \n\
+	mv lr,r7"
+#else
+#define LOAD_ARGS_FROM_STACK( name ) "\n\
+	; DELETE FOR NEW ABI pop r4 ; link map address \n\
+	; DELETE FOR NEW ABI pop r5 ; reloc offset\n"
+#endif
+
+#ifndef PROF
+# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
+	.text                                 \n\
+	.globl _dl_runtime_resolve            \n\
+	.type _dl_runtime_resolve, @function  \n\
+                                              \n\
+	.balign 4                             \n\
+_dl_runtime_resolve:                          \n\
+        " LOAD_ARGS_FROM_STACK( _dl_runtime_resolve ) "      \n\
+	push r0                               \n\
+	push r1                               \n\
+	push r2                               \n\
+	push r3                               \n\
+	push r12                              \n\
+	" FGR_SAVE "                          \n\
+	push lr                               \n\
+                                              \n\
+	; fixup( ELF_MACHINE_RUNTIME_TRAMPOLINE, link_map, reloc_offset ) \n\
+	;mv r0,***   ; plt_type (dummy)       \n\
+                                              \n\
+	mv r1,r4     ; link map address       \n\
+	mv r2,r5     ; reloc offset           \n\
+                                              \n\
+	" FUN_ADDR( fixup ) "                 \n\
+                                              \n\
+	jl r4			; Call resolver. \n\
+	mv r4,r0 ; value                      \n\
+                                              \n\
+	pop lr			; Get register content back. \n\
+	" FGR_LOAD "                          \n\
+	pop r12                               \n\
+	pop r3                                \n\
+	pop r2                                \n\
+	pop r1                                \n\
+	pop r0                                \n\
+                                              \n\
+	jmp r4			; Jump to function address. \n\
+                                              \n\
+	.balign 4                             \n\
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve  \n\
+                                              \n\
+	.globl _dl_runtime_profile            \n\
+	.type _dl_runtime_profile, @function  \n\
+                                              \n\
+	.balign 4                             \n\
+_dl_runtime_profile:                          \n\
+        " LOAD_ARGS_FROM_STACK( _dl_runtime_profile ) "      \n\
+	push r0                               \n\
+	push r1                               \n\
+	push r2                               \n\
+	push r3                               \n\
+	push r12                              \n\
+	" FGR_SAVE "                          \n\
+	push lr                               \n\
+                                              \n\
+	; profile_fixup( ELF_MACHINE_RUNTIME_TRAMPOLINE, link_map, reloc_offset ) \n\
+	;mv r0,***   ; plt_type (dummy)       \n\
+	mv r1,r4     ; link map address       \n\
+	mv r2,r5     ; reloc offset           \n\
+                                              \n\
+	" FUN_ADDR( profile_fixup ) "         \n\
+                                              \n\
+	jl r4			; Call resolver. \n\
+	mv r4,r0 ; value                      \n\
+                                              \n\
+	pop lr			; Get register content back. \n\
+	" FGR_LOAD "                          \n\
+	pop r12                               \n\
+	pop r3                                \n\
+	pop r2                                \n\
+	pop r1                                \n\
+	pop r0                                \n\
+                                              \n\
+	jmp r4			; Jump to function address. \n\
+                                              \n\
+	.balign 4                             \n\
+	.size _dl_runtime_profile, .-_dl_runtime_profile \n\
+	.previous                             \n\
+");
+#else
+# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
+	.text                                 \n\
+	.globl _dl_runtime_resolve            \n\
+	.globl _dl_runtime_profile            \n\
+	.type _dl_runtime_resolve, @function  \n\
+	.type _dl_runtime_profile, @function  \n\
+                                              \n\
+	.balign 4                             \n\
+_dl_runtime_resolve:                          \n\
+_dl_runtime_profile:                          \n\
+        " LOAD_ARGS_FROM_STACK( _dl_runtime_resolve ) "      \n\
+	push r0                               \n\
+	push r1                               \n\
+	push r2                               \n\
+	push r3                               \n\
+	push r12                              \n\
+	" FGR_SAVE "                          \n\
+	push lr                               \n\
+                                              \n\
+	; fixup( ELF_MACHINE_RUNTIME_TRAMPOLINE, link_map, reloc_offset ) \n\
+	;mv r0,***   ; plt_type (dummy)       \n\
+	mv r1,r4     ; link map address       \n\
+	mv r2,r5     ; reloc offset           \n\
+                                              \n\
+	" FUN_ADDR( fixup ) "                 \n\
+                                              \n\
+	jl r4			; Call resolver. \n\
+	mv r4,r0 ; value                      \n\
+                                              \n\
+	pop lr			; Get register content back. \n\
+	" FGR_LOAD "                          \n\
+	pop r12                               \n\
+	pop r3                                \n\
+	pop r2                                \n\
+	pop r1                                \n\
+	pop r0                                \n\
+                                              \n\
+	jmp r4			; Jump to function address. \n\
+                                              \n\
+	.balign 4                             \n\
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve \n\
+	.size _dl_runtime_profile, .-_dl_runtime_profile \n\
+	.previous                             \n\
+");
+#endif
+
+/* Mask identifying addresses reserved for the user program,
+   where the dynamic linker should not map anything.  */
+#define ELF_MACHINE_USER_ADDRESS_MASK	0x80000000UL
+
+/* Initial entry point code for the dynamic linker.
+   The C function `_dl_start' is the real entry point;
+   its return value is the user program's entry point.	*/
+
+#define RTLD_START asm ("\
+.text\n\
+.globl _start\n\
+.globl _dl_start_user\n\
+_start:\n\
+	mv r0,r15\n\
+	bl _dl_start\n\
+_dl_start_user:\n\
+	; Save the user entry point address in r8.\n\
+	mv r8,r0\n\
+	; Point r12 at the GOT.\n\
+	bl.s .+4\n\
+	ld24 r12,#_GLOBAL_OFFSET_TABLE_\n\
+	add r12,lr\n\
+	; Store the highest stack address\n\
+	ld24 r0,#__libc_stack_end		; __libc_stack_end@GOT \n\
+	add r0,r12\n\
+	ld r0,@r0\n\
+	st r15,@r0\n\
+	; See if we were run as a command with the executable file\n\
+	; name as an extra leading argument.\n\
+	ld24 r0,#_dl_skip_args			; _dl_skip_args@GOT \n\
+	add r0,r12\n\
+	ld r0,@r0\n\
+	ld r0,@r0\n\
+	; Get the original argument count.\n\
+	ld r1,@r15\n\
+	; Subtract _dl_skip_args from it.\n\
+	sub r1,r0\n\
+	; Adjust the stack pointer to skip _dl_skip_args words.\n\
+	slli r0,#2\n\
+	add r15,r0\n\
+	; Store back the modified argument count.\n\
+	st r1,@r15\n\
+	; Compute argv address and envp.\n\
+	mv r2,r15\n\
+	addi r2,#4\n\
+	mv r3,r1\n\
+	addi r3,#1\n\
+	slli r3,#2\n\
+	add r3,r2\n\
+	ld24 r0,#_rtld_local\n\
+	add r0,r12\n\
+	ld r0,@r0\n\
+	ld r0,@r0\n\
+	; Call _dl_init.\n\
+	bl _dl_init				; _dl_init@PLT \n\
+	.fillinsn\n\
+1:	; Pass our finalizer function to the user in r4, as per ELF ABI.\n\
+	ld24 r0,#_dl_fini			; _dl_fini@GOT \n\
+	add r0,r12\n\
+	ld r0,@r0\n\
+	; Jump to the user's entry point.\n\
+	jmp r8\n\
+.previous\n\
+");
+
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#ifdef M32R_OLD_ABI
+/* for oldtype relocation compatibility */
+#define elf_machine_type_class(type) \
+  ((((type) == R_M32R_JMP_SLOT || (type) == R_M32R_JMP_SLOT_SAMPLE) * ELF_RTYPE_CLASS_PLT)   \
+   | (((type) == R_M32R_COPY || (type) == R_M32R_COPY_SAMPLE) * ELF_RTYPE_CLASS_COPY))
+#else
+#define elf_machine_type_class(type) \
+  ((((type) == R_M32R_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)   \
+   | (((type) == R_M32R_COPY) * ELF_RTYPE_CLASS_COPY))
+#endif
+	
+/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
+#ifdef M32R_OLD_ABI
+/* for oldtype relocation compatibility */
+#define ELF_MACHINE_JMP_SLOT	\
+	R_M32R_JMP_SLOT || ELFW(R_TYPE)(reloc->r_info) == R_M32R_JMP_SLOT_SAMPLE
+#else
+#define ELF_MACHINE_JMP_SLOT	R_M32R_JMP_SLOT
+#endif
+
+/* M32R never uses Elf32_Rel relocations.	 */
+#define ELF_MACHINE_NO_REL 1
+
+/* We define an initialization functions.  This is called very early in
+   _dl_sysdep_start.  */
+#define DL_PLATFORM_INIT dl_platform_init ()
+
+static inline void __attribute__ ((unused))
+dl_platform_init (void)
+{
+  if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
+    /* Avoid an empty string which would disturb us.  */
+    GLRO(dl_platform) = NULL;
+}
+
+static inline Elf32_Addr
+elf_machine_fixup_plt (struct link_map *map, lookup_t t,
+		       const Elf32_Rela *reloc,
+		       Elf32_Addr *reloc_addr, Elf32_Addr value)
+{
+  return *reloc_addr = value;
+}
+
+/* Return the final value of a plt relocation.	*/
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+		       Elf32_Addr value)
+{
+  return value + reloc->r_addend;
+}
+
+#endif /* !dl_machine_h */
+
+#ifdef RESOLVE
+
+extern char **_dl_argv;
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+   MAP is the object containing the reloc.  */
+
+auto inline void
+__attribute ((always_inline))
+elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
+		 const Elf32_Sym *sym, const struct r_found_version *version,
+		 void *const reloc_addr_arg)
+{
+  Elf32_Addr *const reloc_addr = reloc_addr_arg;
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+  Elf32_Addr value;
+
+#define COPY_UNALIGNED_WORD(swp, twp, align) \
+  { \
+    void *__s = (swp), *__t = (twp); \
+    unsigned char *__s1 = __s, *__t1 = __t; \
+    unsigned short *__s2 = __s, *__t2 = __t; \
+    unsigned long *__s4 = __s, *__t4 = __t; \
+    switch ((align)) \
+    { \
+    case 0: \
+      *__t4 = *__s4; \
+      break; \
+    case 2: \
+      *__t2++ = *__s2++; \
+      *__t2 = *__s2; \
+      break; \
+    default: \
+      *__t1++ = *__s1++; \
+      *__t1++ = *__s1++; \
+      *__t1++ = *__s1++; \
+      *__t1 = *__s1; \
+      break; \
+    } \
+  }
+#define COPY_UNALIGNED_HWORD(swp, twp, align) \
+  { \
+    void *__s = (swp), *__t = (twp); \
+    unsigned char *__s1 = __s, *__t1 = __t; \
+    unsigned short *__s2 = __s, *__t2 = __t; \
+    switch ((align)) \
+    { \
+    case 0: \
+      *__t2 = *__s2; \
+      break; \
+    default: \
+      *__t1++ = *__s1++; \
+      *__t1 = *__s1; \
+      break; \
+    } \
+  }
+
+#ifdef M32R_OLD_ABI
+/* for oldtype relocation compatibility */
+  if (__builtin_expect (r_type == R_M32R_RELATIVE || r_type == R_M32R_RELATIVE_SAMPLE, 0))
+#else
+  if (__builtin_expect (r_type == R_M32R_RELATIVE, 0))
+#endif
+    {
+#ifndef RTLD_BOOTSTRAP
+      if (map != &GL(dl_rtld_map)) /* Already done in rtld itself.	 */
+#endif
+	{
+	  if (reloc->r_addend)
+	    value = map->l_addr + reloc->r_addend;
+	  else
+	    {
+	      COPY_UNALIGNED_WORD (reloc_addr_arg, &value,
+                                   (int) reloc_addr_arg & 3);
+	      value += map->l_addr;
+	    }
+	  COPY_UNALIGNED_WORD (&value, reloc_addr_arg,
+                               (int) reloc_addr_arg & 3);
+	}
+    }
+#ifndef RTLD_BOOTSTRAP
+  else if (__builtin_expect (r_type == R_M32R_NONE, 0))
+    return;
+#endif
+  else
+    {
+      const Elf32_Sym *const refsym = sym;
+#ifndef RTLD_BOOTSTRAP
+      Elf32_Addr tmp_value;
+#endif
+      value = RESOLVE (&sym, version, r_type);
+      if (sym)
+	value += sym->st_value;
+      value += reloc->r_addend;
+
+      switch (r_type)
+	{
+#ifdef M32R_OLD_ABI
+	case R_M32R_COPY_SAMPLE:
+#endif
+	case R_M32R_COPY:
+	  if (sym == NULL)
+	    /* This can happen in trace mode if an object could not be
+	       found.  */
+	    break;
+          if (sym->st_size > refsym->st_size
+	      || (sym->st_size < refsym->st_size && GLRO(dl_verbose)))
+	    {
+	      const char *strtab;
+
+	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
+	      _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+				_dl_argv[0] ?: "<program name unknown>",
+				strtab + refsym->st_name);
+	    }
+	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
+						   refsym->st_size));
+	  break;
+#ifdef M32R_OLD_ABI
+	case R_M32R_GLOB_DAT_SAMPLE:
+#endif
+	case R_M32R_GLOB_DAT:
+#if 0 /* 20021129 1 -> 0 */
+	case R_M32R_32:
+	  *reloc_addr = value;
+	  break;
+#endif /* 20021129 1 -> 0 */
+#ifdef M32R_OLD_ABI
+	case R_M32R_JMP_SLOT_SAMPLE:
+#endif
+	case R_M32R_JMP_SLOT:
+	  elf_machine_fixup_plt(map, 0, reloc, reloc_addr, value);
+	  break;
+#if 1 /* 20021129 0 -> 1 */
+#ifdef M32R_OLD_ABI
+	case R_M32R_32_SAMPLE:
+#endif
+	case R_M32R_32_RELA:
+#ifndef RTLD_BOOTSTRAP
+#ifdef M32R_OLD_ABI
+	case R_M32R_24_SAMPLE:
+	case R_M32R_16_SAMPLE:
+	case R_M32R_HI16_ULO_SAMPLE:
+	case R_M32R_HI16_SLO_SAMPLE:
+	case R_M32R_LO16_SAMPLE:
+	case R_M32R_SDA16_SAMPLE:
+#endif
+	case R_M32R_24_RELA:
+	case R_M32R_16_RELA:
+	case R_M32R_HI16_ULO_RELA:
+	case R_M32R_HI16_SLO_RELA:
+	case R_M32R_LO16_RELA:
+	case R_M32R_SDA16_RELA:
+#endif
+	  {
+#ifndef RTLD_BOOTSTRAP
+	   /* This is defined in rtld.c, but nowhere in the static
+	      libc.a; make the reference weak so static programs can
+	      still link.  This declaration cannot be done when
+	      compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because
+	      rtld.c contains the common defn for _dl_rtld_map, which
+	      is incompatible with a weak decl in the same file.  */
+# ifndef SHARED
+	    weak_extern (GL(dl_rtld_map));
+# endif
+	    if (map == &GL(dl_rtld_map))
+	      /* Undo the relocation done here during bootstrapping.
+		 Now we will relocate it anew, possibly using a
+		 binding found in the user program or a loaded library
+		 rather than the dynamic linker's built-in definitions
+		 used while loading those libraries.  */
+	      value -= map->l_addr + refsym->st_value + reloc->r_addend;
+#endif
+#ifdef M32R_OLD_ABI
+	    if (r_type == R_M32R_32_SAMPLE
+	        || r_type == R_M32R_32_RELA)
+#else
+	    if (r_type == R_M32R_32_RELA)
+#endif
+	      {
+	         COPY_UNALIGNED_WORD (&value, reloc_addr_arg,
+                                      (int) reloc_addr_arg & 3);
+	      }
+#ifndef RTLD_BOOTSTRAP
+#ifdef M32R_OLD_ABI
+	    else if (r_type == R_M32R_16_SAMPLE
+	             || r_type == R_M32R_16_RELA)
+#else
+	    else if (r_type == R_M32R_16_RELA)
+#endif
+	      {
+	         COPY_UNALIGNED_HWORD (&value, reloc_addr_arg,
+                                       (int) reloc_addr_arg & 3);
+	      }
+	    else 
+	      {
+	         COPY_UNALIGNED_WORD (reloc_addr_arg, &tmp_value,
+                                      (int) reloc_addr_arg & 3);
+	         switch (r_type)
+	           {
+#ifdef M32R_OLD_ABI
+	           case R_M32R_24_SAMPLE:
+	             if (value & 0xff000000)
+	               {
+	                  _dl_signal_error (0, map->l_name, NULL,
+	                                    "R_M32R_24 relocation overflow");
+	               }
+	             value = (tmp_value & ~0xffffff) | (value & 0xffffff);
+	             break;
+#endif
+	           case R_M32R_24_RELA:
+	             if (value & 0xff000000)
+	               {
+	                  _dl_signal_error (0, map->l_name, NULL,
+	                                    "R_M32R_24_RELA relocation overflow");
+	               }
+	             value = (tmp_value & ~0xffffff) | (value & 0xffffff);
+	             break;
+#ifdef M32R_OLD_ABI
+	           case R_M32R_HI16_ULO_SAMPLE:
+#endif
+	           case R_M32R_HI16_ULO_RELA:
+	             value = (tmp_value & ~0xffff) | ((value >>16) & 0xffff);
+	             break;
+#ifdef M32R_OLD_ABI
+	           case R_M32R_HI16_SLO_SAMPLE:
+#endif
+	           case R_M32R_HI16_SLO_RELA:
+	             if (value & 0x8000)
+	               value += 0x10000;
+	             value = (tmp_value & ~0xffff) | ((value >>16) & 0xffff);
+	             break;
+#ifdef M32R_OLD_ABI
+	           case R_M32R_LO16_SAMPLE:
+	           case R_M32R_SDA16_SAMPLE:
+#endif
+	           case R_M32R_LO16_RELA:
+	           case R_M32R_SDA16_RELA:
+	             value = (tmp_value & ~0xffff) | (value & 0xffff);
+	             break;
+	           }
+	         COPY_UNALIGNED_WORD (&value, reloc_addr_arg,
+                                      (int) reloc_addr_arg & 3);
+	      }
+#endif
+	    break;
+	  }
+#ifndef RTLD_BOOTSTRAP
+#ifdef M32R_OLD_ABI
+	case R_M32R_26_PCREL_SAMPLE:
+	  COPY_UNALIGNED_WORD (reloc_addr_arg, &tmp_value,
+                               (int) reloc_addr_arg & 3);
+	  value += (signed long)(tmp_value & 0xffffff) << 2;
+	  value = value - (Elf32_Addr) reloc_addr;
+	  if ((signed long)value < -0x2000000 || 0x1fffffc < (signed long)value)
+	    {
+	      _dl_signal_error (0, map->l_name, NULL,
+	                        "R_M32R_26_PCREL relocation overflow");
+	    }
+	  value = (tmp_value & ~0xffffff) | ((value >> 2) & 0xffffff);
+	  COPY_UNALIGNED_WORD (&value, reloc_addr_arg,                                                         (int) reloc_addr_arg & 3);
+	  break;
+#endif
+	case R_M32R_26_PCREL_RELA:
+	  COPY_UNALIGNED_WORD (reloc_addr_arg, &tmp_value,
+                               (int) reloc_addr_arg & 3);
+	  value += (signed long)(tmp_value & 0xffffff) << 2;
+	  value = value - (Elf32_Addr) reloc_addr;
+	  if ((signed long)value < -0x2000000 || 0x1fffffc < (signed long)value)
+	    {
+	      _dl_signal_error (0, map->l_name, NULL,
+	                        "R_M32R_26_PCREL_RELA relocation overflow");
+	    }
+	  value = (tmp_value & ~0xffffff) | ((value >> 2) & 0xffffff);
+	  COPY_UNALIGNED_WORD (&value, reloc_addr_arg,
+                               (int) reloc_addr_arg & 3);
+	  break;
+#ifdef M32R_OLD_ABI
+	case R_M32R_18_PCREL_SAMPLE:
+	  COPY_UNALIGNED_WORD (reloc_addr_arg, &tmp_value,
+                               (int) reloc_addr_arg & 3);
+	  value += (signed long)(tmp_value & 0xffff) << 2;
+	  value = value - (Elf32_Addr) reloc_addr;
+	  if ((signed long)value < -0x20000 || 0x1fffc < (signed long)value)
+	    {
+	      _dl_signal_error (0, map->l_name, NULL,
+	                        "R_M32R_18_PCREL relocation overflow");
+	    }
+	  value = (tmp_value & ~0xffff) | ((value >> 2) & 0xffff);
+	  COPY_UNALIGNED_WORD (&value, reloc_addr_arg,
+                               (int) reloc_addr_arg & 3);
+	  break;
+#endif
+	case R_M32R_18_PCREL_RELA:
+	  COPY_UNALIGNED_WORD (reloc_addr_arg, &tmp_value,
+                               (int) reloc_addr_arg & 3);
+	  value += (signed long)(tmp_value & 0xffff) << 2;
+	  value = value - (Elf32_Addr) reloc_addr;
+	  if ((signed long)value < -0x20000 || 0x1fffc < (signed long)value)
+	    {
+	      _dl_signal_error (0, map->l_name, NULL,
+	                        "R_M32R_18_PCREL_RELA relocation overflow");
+	    }
+	  value = (tmp_value & ~0xffff) | ((value >> 2) & 0xffff);
+	  COPY_UNALIGNED_WORD (&value, reloc_addr_arg,
+                               (int) reloc_addr_arg & 3);
+	  break;
+#endif
+#endif /* 20021129 0 -> 1 */
+	default:
+	  _dl_reloc_bad_type (map, r_type, 0);
+	  break;
+	}
+    }
+}
+
+auto inline void
+__attribute ((always_inline))
+elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
+                           void *const reloc_addr_arg)
+{
+  Elf32_Addr value;
+
+  if (reloc->r_addend)
+    value = l_addr + reloc->r_addend;
+  else
+    {
+      COPY_UNALIGNED_WORD (reloc_addr_arg, &value, (int) reloc_addr_arg & 3);
+      value += l_addr;
+    }
+  COPY_UNALIGNED_WORD (&value, reloc_addr_arg, (int) reloc_addr_arg & 3);
+
+#undef COPY_UNALIGNED_WORD
+#undef COPY_UNALIGNED_HWORD
+}
+
+auto inline void
+__attribute ((always_inline))
+elf_machine_lazy_rel (struct link_map *map,
+		      Elf32_Addr l_addr, const Elf32_Rela *reloc)
+{
+  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
+  /* Check for unexpected PLT reloc type.  */
+#ifdef M32R_OLD_ABI
+  if (ELF32_R_TYPE (reloc->r_info) == R_M32R_JMP_SLOT
+      || ELF32_R_TYPE (reloc->r_info) == R_M32R_JMP_SLOT_SAMPLE)
+#else
+  if (ELF32_R_TYPE (reloc->r_info) == R_M32R_JMP_SLOT)
+#endif
+      *reloc_addr += l_addr;
+  else 
+      _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1);
+}
+
+#endif /* RESOLVE */
diff --exclude CVS -uNr sysdeps.org/m32r/elf/start.S sysdeps/m32r/elf/start.S
--- sysdeps.org/m32r/elf/start.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/elf/start.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,81 @@
+/* Startup code for M32R & ELF.
+   Copyright (C) 2003, 2004 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.  */
+
+/* This is the canonical entry point, usually the first thing in the text
+   segment.
+
+	Note that the code in the .init section has already been run.
+	This includes _init and _libc_init
+
+
+	At this entry point, most registers' values are unspecified, except:
+
+   r0		Contains a function pointer to be registered with `atexit'.
+   		This is how the dynamic linker arranges to have DT_FINI
+		functions called for shared libraries that have been loaded
+		before this code runs.
+
+   sp		The stack contains the arguments and environment:
+   		@(0,sp)			argc
+		@(4,sp)			argv[0]
+		...
+		@((4*argc),sp)		NULL
+		@((4*(argc+1)),sp)	envp[0]
+		...
+					NULL
+*/
+
+#include "sysdep.h"
+#include "bp-sym.h"
+
+	.text
+	.globl _start
+_start:
+	/* Clear the frame pointer since this is the outermost frame.  */
+	ldi	r13, #0
+
+	/* Pop argc off the stack and save a pointer to argv */
+	pop	r1
+	mv	r2, sp
+
+	/* Push the last arguments to main() onto the stack */
+	push	r0
+	LDIMM	(r0, __libc_csu_fini)
+	push	r0
+
+	/* Set up the other arguments for main() that go in registers */
+	LDIMM	(r0, BP_SYM (main))
+	LDIMM	(r3, __libc_csu_init)
+
+	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
+
+	/* Let the libc call main and exit with its return code.  */
+	LDIMM	(r4, BP_SYM (__libc_start_main))
+	jl	r4
+	/* should never get here....*/
+	LDIMM	(r4, abort)
+	jl	r4
+
+/* Define a symbol for the first piece of initialized data.  */
+	.data
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
diff --exclude CVS -uNr sysdeps.org/m32r/gmp-mparam.h sysdeps/m32r/gmp-mparam.h
--- sysdeps.org/m32r/gmp-mparam.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/gmp-mparam.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,30 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP 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 MP 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 MP 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 BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
+#define BITS_PER_LONGINT 32
+#define BITS_PER_INT 32
+#define BITS_PER_SHORTINT 16
+#define BITS_PER_CHAR 8
+
+#define IEEE_DOUBLE_BIG_ENDIAN 0
+#define IEEE_DOUBLE_MIXED_ENDIAN 1
diff --exclude CVS -uNr sysdeps.org/m32r/m32r-mcount.S sysdeps/m32r/m32r-mcount.S
--- sysdeps.org/m32r/m32r-mcount.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/m32r-mcount.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,67 @@
+/* m32r-specific implemetation of profiling support.
+   Copyright (C) 2003 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>
+
+	ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(_mcount)
+	ASM_TYPE_DIRECTIVE(C_SYMBOL_NAME(_mcount), function)
+	.balign 4
+C_LABEL(_mcount)
+	/* Save the caller-clobbered registers.  */
+	push r0
+	push r1
+	push r2
+	push r3
+	push r4
+	push r5
+	push r6
+	push r7
+	push lr
+	ld r0,@(36,sp)
+	mv r1,lr
+
+#ifdef __PIC__
+	push r12
+	bl.s .+4
+	ld24 r12,#_GLOBAL_OFFSET_TABLE_
+	add r12,lr
+	ld24 lr,#__mcount_internal
+	add lr,r12
+	ld lr,@(lr)
+	jl lr
+	pop r12
+#else
+	bl __mcount_internal
+#endif
+	/* Pop the saved registers.  Please note that `mcount' has no
+	   return value.  */
+	pop lr
+	pop r7
+	pop r6
+	pop r5
+	pop r4
+	pop r3
+	pop r2
+	pop r1
+	pop r0
+	ret
+	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
+
+#undef mcount
+weak_alias(_mcount, mcount)
diff --exclude CVS -uNr sysdeps.org/m32r/machine-gmon.h sysdeps/m32r/machine-gmon.h
--- sysdeps.org/m32r/machine-gmon.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/machine-gmon.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,34 @@
+/* Machine-dependent definitions for profiling support.  M32R version.
+   Copyright (C) 2003, 2004 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.  */
+
+/* NOTYET  */
+
+/* We must not pollute the global namespace.  */
+#define mcount_internal __mcount_internal
+
+void mcount_internal (u_long frompc, u_long selfpc);
+
+#define _MCOUNT_DECL(frompc, selfpc) \
+void mcount_internal (u_long frompc, u_long selfpc)
+
+
+/* Define MCOUNT as empty since we have the implementation in another
+   file.  */
+#define MCOUNT
+
diff --exclude CVS -uNr sysdeps.org/m32r/memcpy.S sysdeps/m32r/memcpy.S
--- sysdeps.org/m32r/memcpy.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/memcpy.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,62 @@
+/* Copyright (C) 2003, 2004 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 <endian.h>
+
+/*
+ * void *memcpy(void *dst, const void *src, size_t n);
+ * No overlap between the memory of DST and of SRC are assumed.
+ *
+ *        dst: r0
+ *        src: r1
+ *        n  : r2
+ */
+
+ENTRY(memcpy)
+	mv	r4, r0
+	mv	r7, r0
+	or	r7, r1
+	beq	r0, r1, end_memcopy
+	beqz	r2, end_memcopy
+
+	and3	r7, r7, #3
+	bnez	r7, byte_copy
+	srl3	r3, r2, #2
+	and3	r2, r2, #3
+	beqz	r3, byte_copy
+	addi	r4, #-4
+word_copy:
+	ld	r7, @r1+
+	addi	r3, #-1
+	st	r7, @+r4
+	bnez	r3, word_copy
+	beqz	r2, end_memcopy
+	addi	r4, #4
+byte_copy:
+	ldb	r7, @r1
+	addi	r1, #1
+	addi	r2, #-1
+	stb	r7, @r4
+	addi	r4, #1
+	bnez	r2, byte_copy
+end_memcopy:
+	jmp	r14
+	nop
+END(memcpy)
+libc_hidden_builtin_def (memcpy)
diff --exclude CVS -uNr sysdeps.org/m32r/memset.S sysdeps/m32r/memset.S
--- sysdeps.org/m32r/memset.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/memset.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,76 @@
+/* Copyright (C) 2003, 2004 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>
+
+/*  void *memset(void *dst, int val, int len);
+ *
+ *	dst: r0
+ *	val: r1
+ *	len: r2
+ *	ret: r0
+ */
+
+ENTRY(memset)
+	mv      r4, r0
+	beqz	r2, end_memset
+	cmpui	r2, #4
+	bc	byte_set
+; case  len >= 4
+	and3	r3, r4, #3
+	beqz	r3, word_set
+; case  miss align
+	addi	r3, #-4
+	neg	r3, r3			; r3 = -(r3 - 4)
+miss_align:
+	stb	r1, @r4
+	addi	r4, #1
+	addi	r2, #-1
+	addi	r3, #-1
+	bnez	r3, miss_align
+	cmpui	r2, #4
+	bc	byte_set
+word_set:
+	and3	r1, r1, #0x00ff		; r1: abababab <-- ??????ab
+	sll3	r3, r1, #8
+	or	r1, r3
+	sll3	r3, r1, #16
+	or	r1, r3
+	addi	r2, #-4
+	addi	r4, #-4
+word_set_loop:
+	st	r1, @+r4
+	addi	r2, #-4
+	bgtz    r2, word_set_loop
+	bnez	r2, byte_set_wrap
+	st	r1, @+r4
+	jmp	r14
+byte_set_wrap:
+	addi	r2, #4
+	addi	r4, #4
+	beqz	r2, end_memset
+byte_set:
+	addi	r2, #-1
+	stb	r1, @r4
+	addi	r4, #1
+	bnez	r2, byte_set
+end_memset:
+	jmp	r14
+	nop
+END(memset)
+libc_hidden_builtin_def (memset)
diff --exclude CVS -uNr sysdeps.org/m32r/memusage.h sysdeps/m32r/memusage.h
--- sysdeps.org/m32r/memusage.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/memusage.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,21 @@
+/* Copyright (C) 2003, 2004 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.  */
+
+#define GETSP() ({ register uintptr_t stack_ptr asm ("r15"); stack_ptr; })
+
+#include <sysdeps/generic/memusage.h>
diff --exclude CVS -uNr sysdeps.org/m32r/setjmp.S sysdeps/m32r/setjmp.S
--- sysdeps.org/m32r/setjmp.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/setjmp.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,53 @@
+/* setjmp for M32R.
+   Copyright (C) 2003, 2004 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 _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+ENTRY (__sigsetjmp)
+	mv 	r2, r0
+	/* Save registers */
+	st	r8, @r0	
+	st	r9, @+r0
+	st	r10, @+r0
+	st	r11, @+r0
+	st	r12, @+r0
+	st	r13, @+r0
+	st	r14, @+r0		/* lr */
+	st	r15, @+r0		/* sp */
+	mv 	r0, r2
+
+	/* Make a tail call to __sigjmp_save; it takes the same args.  */
+#ifdef SHARED
+	mv	r2,lr
+	bl.s	.+4
+	ld24	r3,#_GLOBAL_OFFSET_TABLE_
+	add	r3,lr
+	mv	lr,r2
+
+	ld24	r2,C_SYMBOL_NAME(__sigjmp_save)
+	add	r2,r3
+	ld	r2,@r2
+#else
+	LDIMM	(r2, C_SYMBOL_NAME(__sigjmp_save))
+#endif
+	jmp	r2
+END (__sigsetjmp)
diff --exclude CVS -uNr sysdeps.org/m32r/stackinfo.h sysdeps/m32r/stackinfo.h
--- sysdeps.org/m32r/stackinfo.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/stackinfo.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,28 @@
+/* Copyright (C) 2003, 2004 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.  */
+
+/* This file contains a bit of information about the stack allocation
+   of the processor.  */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H	1
+
+/* On SH the stack grows down.  */
+#define _STACK_GROWS_DOWN	1
+
+#endif	/* stackinfo.h */
diff --exclude CVS -uNr sysdeps.org/m32r/strlen.S sysdeps/m32r/strlen.S
--- sysdeps.org/m32r/strlen.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/strlen.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,77 @@
+/* Copyright (C) 2003, 2004 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 <endian.h>
+
+/* size_t strlen (const char *s)  */
+
+ENTRY(strlen)
+	mv	r6, r0
+	ldi	r2, #0
+	and3	r0, r0, #3
+	bnez	r0, strlen_byte
+;
+strlen_word:
+	ld	r0, @r6+
+;
+	seth	r5, #high(0x01010101)
+	or3	r5, r5, #low(0x01010101)
+	sll3	r7, r5, #7
+strlen_word_loop:
+	ld	r1, @r6+
+	not	r4, r0		; NOTE: If a null char. exists, return 0.
+	sub	r0, r5		; if ((x - 0x01010101) & ~x & 0x80808080)
+	and	r4, r7		;     return 0;
+	and	r4, r0
+	bnez	r4, strlen_last_bytes
+	addi	r2, #4
+;
+	ld	r0, @r6+
+	not	r4, r1		; NOTE: If a null char. exists, return 0.
+	sub	r1, r5		; if ((x - 0x01010101) & ~x & 0x80808080)
+	and	r4, r7		;     return 0;
+	and	r4, r1
+	bnez	r4, strlen_last_bytes
+	addi	r2, #4
+	bra	strlen_word_loop
+;
+strlen_byte:
+	ldb	r1, @r6
+	addi	r6, #1
+	beqz	r1, strlen_exit
+	addi	r2, #1
+	bra	strlen_byte
+;
+strlen_last_bytes:
+	ldi	r0, #4
+	addi	r6, #-8
+;
+strlen_byte_loop:
+	ldb	r1, @r6
+	addi	r6, #1
+	addi	r0, #-1
+	beqz	r1, strlen_exit
+	addi	r2, #1
+	bnez	r0, strlen_byte_loop
+;
+strlen_exit:
+	mv	r0, r2
+	jmp	r14
+END(strlen)
+libc_hidden_builtin_def (strlen)
diff --exclude CVS -uNr sysdeps.org/m32r/sys/ucontext.h sysdeps/m32r/sys/ucontext.h
--- sysdeps.org/m32r/sys/ucontext.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/sys/ucontext.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,102 @@
+/* Copyright (C) 2003, 2004 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_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+typedef int greg_t;
+
+/* Number of general registers.  */
+#define NGREG	16
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NGREG];
+
+/* 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
+};
+
+#if 0
+/* FIXME */
+typedef int freg_t;
+
+/* Number of FPU registers.  */
+#define NFREG	16
+
+/* Structure to describe FPU registers.  */
+typedef freg_t fpregset_t[NFREG];
+#endif
+
+/* Context to describe whole processor state.  */
+typedef struct
+  {
+    gregset_t gregs;
+#if 0
+    fpregset_t fpregs;
+    fpregset_t xfpregs;
+#endif
+  } mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+  {
+    unsigned long int uc_flags;
+    struct ucontext *uc_link;
+    __sigset_t uc_sigmask;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    long int uc_filler[5];
+  } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --exclude CVS -uNr sysdeps.org/m32r/sysdep.h sysdeps/m32r/sysdep.h
--- sysdeps.org/m32r/sysdep.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/m32r/sysdep.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,92 @@
+/* Assembler macros for M32R.
+   Copyright (C) 2003, 2004 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/generic/sysdep.h>
+
+#ifdef	__ASSEMBLER__
+
+/* Syntactic details of assembler.  */
+
+#ifdef HAVE_ELF
+
+#define ALIGNARG(log2) log2
+/* For ELF we need the `.type' directive to make shared libs work right.  */
+#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,@##typearg
+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+
+#define PLTJMP(_x)	_x
+#define GOT(_x)	_x
+
+#else
+
+#define ALIGNARG(log2) log2
+#define ASM_TYPE_DIRECTIVE(name,type)	/* Nothing is specified.  */
+#define ASM_SIZE_DIRECTIVE(name)	/* Nothing is specified.  */
+
+#define PLTJMP(_x)	_x
+#define GOT(_x)	_x
+
+#endif
+
+/* If compiled for profiling, call `mcount' at the start of each function.  */
+#ifdef	PROF
+#ifdef	__PIC__
+#define CALL_MCOUNT \
+	push r14 ! \
+	ld24 r14,#mcount ! \
+	add r14,r12 ! \
+	ld r14,@r14 ! \
+	jl r14 ! \
+	pop r14
+#else
+#define CALL_MCOUNT \
+	push r14 ! \
+	seth r14,#high(mcount) ! \
+	or3 r14,r14,#low(mcount) ! \
+	jl r14 ! \
+	pop r14
+#endif
+#else
+#define CALL_MCOUNT		/* Do nothing.  */
+#endif
+
+#undef CALL_MCOUNT		/* Do nothing.  */
+#define CALL_MCOUNT		/* Do nothing.  */
+
+/* Define an entry point visible from C.  */
+#define	ENTRY(name)							      \
+  ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name)				!     \
+  ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function)			!     \
+  .balign 4								!     \
+  C_LABEL(name)								!     \
+  CALL_MCOUNT
+
+#undef	END
+#define END(name)							      \
+  ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
+
+#ifdef	NO_UNDERSCORES
+/* Since C identifiers are not normally prefixed with an underscore
+   on this system, the asm identifier `syscall_error' intrudes on the
+   C name space.  Make sure we use an innocuous name.  */
+#define	syscall_error	__syscall_error
+#define mcount		_mcount
+#endif
+
+#endif	/* __ASSEMBLER__ */
diff --exclude CVS -uNr sysdeps.org/unix/m32r/Makefile sysdeps/unix/m32r/Makefile
--- sysdeps.org/unix/m32r/Makefile	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/m32r/Makefile	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,4 @@
+# m32r/ELF specific definitions.
+
+# The assembler on m32r needs the -fPIC flag even when it's assembler code.
+ASFLAGS-.os = -fPIC
diff --exclude CVS -uNr sysdeps.org/unix/m32r/sysdep.S sysdeps/unix/m32r/sysdep.S
--- sysdeps.org/unix/m32r/sysdep.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/m32r/sysdep.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,76 @@
+/* Copyright (C) 2003, 2004 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.  */
+	ldi	r1, #EWOULDBLOCK_sys
+	bne	r1, r0, skip
+	ldi	r0, #EAGAIN
+skip:
+#endif
+	/* Store it in errno... */
+#ifndef SHARED
+#ifndef _LIBC_REENTRANT
+	LDIMM	(r1, C_SYMBOL_NAME(errno))
+	st	r0, @r1
+#else
+	push	r0
+	push	lr
+	LDIMM	(r1, C_SYMBOL_NAME(__errno_location))
+	jl	r1
+	pop	lr
+	pop	r1
+	st	r1, @r0
+#endif
+#else
+	push	r12
+	push	lr
+	bl.s	.+4
+	ld24	r12,#_GLOBAL_OFFSET_TABLE_
+	add	r12, lr
+#ifndef _LIBC_REENTRANT
+	mv	r2, r0
+	LDIMM	(r1, C_SYMBOL_NAME(errno))
+	add	r1, r12
+	ld	r1, @r1
+	st	r2, @r1
+#else
+	push	r0
+	LDIMM	(r1, C_SYMBOL_NAME(__errno_location))
+	add	r1, r12
+	ld	r1, @r1
+	jl	r1
+	pop	r1
+	st	r1, @r0
+#endif
+	pop	lr
+	pop	r12
+#endif
+	/* And just kick back a -1.  */
+	ldi	r0, #-1
+	ret
+END(__syscall_error)
+
+weak_alias (__syscall_error, syscall_error)
diff --exclude CVS -uNr sysdeps.org/unix/m32r/sysdep.h sysdeps/unix/m32r/sysdep.h
--- sysdeps.org/unix/m32r/sysdep.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/m32r/sysdep.h	2004-10-19 13:54:51.000000000 +0900
@@ -0,0 +1,33 @@
+/* Copyright (C) 2003, 2004 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/m32r/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+#define ret	jmp r14
+
+/* The m32r move insn is d, s.  */
+#define MOVE(x,y)	mv y,x
+
+#define LDIMM(reg,x) \
+	seth	reg, #high(x)       ! \
+	or3	reg, reg, #low(x)
+
+#endif
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/Dist sysdeps/unix/sysv/linux/m32r/Dist
--- sysdeps.org/unix/sysv/linux/m32r/Dist	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/Dist	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,9 @@
+clone.S
+pipe.S
+flushcache.S
+setresuid.c
+setresgid.c
+setfsuid.c
+setfsgid.c
+sys/io.h
+sys/user.h
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/Makefile sysdeps/unix/sysv/linux/m32r/Makefile
--- sysdeps.org/unix/sysv/linux/m32r/Makefile	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/Makefile	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,15 @@
+# m32r/ELF specific definitions.
+gnulib := -lgcc
+
+# The assembler on m32r needs the -fPIC flag even when it's assembler code.
+ASFLAGS-.os = -fPIC
+
+ifeq ($(subdir),io)
+sysdep_routines += pipe
+endif
+
+ifeq ($(subdir),misc)
+sysdep_routines += m32r-stub tas \
+		   cachectl flushcache
+sysdep_headers += sys/io.h sys/tas.h sys/cachectl.h
+endif
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/Versions sysdeps/unix/sysv/linux/m32r/Versions
--- sysdeps.org/unix/sysv/linux/m32r/Versions	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/Versions	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,33 @@
+libc {
+  GLIBC_2.2 {
+    # functions used in other libraries
+    __xstat64; __fxstat64; __lxstat64;
+
+    # Needed by gcc
+    _flush_cache;
+
+    # a*
+    alphasort64;
+
+    # c*
+    cachectl; cacheflush;
+
+    # g*
+    glob64;
+
+    # New rlimit interface
+    getrlimit; setrlimit; getrlimit64;
+
+    # r*
+    readdir64; readdir64_r;
+
+    # s*
+    scandir64;
+
+    # t*
+    tas;
+
+    # v*
+    versionsort64;
+  }
+}
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/bits/fcntl.h sysdeps/unix/sysv/linux/m32r/bits/fcntl.h
--- sysdeps.org/unix/sysv/linux/m32r/bits/fcntl.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/bits/fcntl.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,155 @@
+/* O_*, F_*, FD_* bit values for Linux.
+   Copyright (C) 2003, 2004 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	_FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+
+#include <sys/types.h>
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+   located on an ext2 file system */
+#define O_ACCMODE	   0003
+#define O_RDONLY	     00
+#define O_WRONLY	     01
+#define O_RDWR		     02
+#define O_CREAT		   0100	/* not fcntl */
+#define O_EXCL		   0200	/* not fcntl */
+#define O_NOCTTY	   0400	/* not fcntl */
+#define O_TRUNC		  01000	/* not fcntl */
+#define O_APPEND	  02000
+#define O_NONBLOCK	  04000
+#define O_NDELAY	O_NONBLOCK
+#define O_SYNC		 010000
+#define O_FSYNC		 O_SYNC
+#define O_ASYNC		 020000
+
+#ifdef __USE_GNU
+# define O_DIRECT	 040000	/* Direct disk access.  */
+# define O_DIRECTORY	0200000	/* Must be a directory.  */
+# define O_NOFOLLOW	0400000	/* Do not follow links.  */
+#endif
+
+/* For now Linux has synchronisity options for data and read operations.
+   We define the symbols here but let them do the same as O_SYNC since
+   this is a superset.  */
+#if defined __USE_POSIX199309 || defined __USE_UNIX98
+# define O_DSYNC	O_SYNC	/* Synchronize data.  */
+# define O_RSYNC	O_SYNC	/* Synchronize read operations.  */
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE	0100000
+#endif
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#ifndef __USE_FILE_OFFSET64
+# define F_GETLK	5	/* Get record locking info.  */
+# define F_SETLK	6	/* Set record locking info (non-blocking).  */
+# define F_SETLKW	7	/* Set record locking info (blocking).  */
+#else
+# define F_GETLK	F_GETLK64  /* Get record locking info.  */
+# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
+# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
+#endif
+#define F_GETLK64	12	/* Get record locking info.  */
+#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	14	/* Set record locking info (blocking).  */
+
+#if defined __USE_BSD || defined __USE_XOPEN2K
+# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETSIG	10	/* Set number of signal to be sent.  */
+# define F_GETSIG	11	/* Get number of signal to be sent.  */
+#endif
+
+/* For F_[GET|SET]FL.  */
+#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
+
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		0	/* Read lock.  */
+#define F_WRLCK		1	/* Write lock.  */
+#define F_UNLCK		2	/* Remove lock.  */
+
+/* For old implementation of bsd flock().  */
+#define F_EXLCK		4	/* or 3 */
+#define F_SHLCK		8	/* or 4 */
+
+#ifdef __USE_BSD
+/* Operations for bsd flock(), also used by the kernel implementation.  */
+# define LOCK_SH	1	/* shared lock */
+# define LOCK_EX	2	/* exclusive lock */
+# define LOCK_NB	4	/* or'd with one of the above to prevent
+				   blocking */
+# define LOCK_UN	8	/* remove lock */
+#endif
+
+struct flock
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+#endif
+
+/* Define some more compatibility macros to be backward compatible with
+   BSD systems which did not managed to hide these kernel macros.  */
+#ifdef	__USE_BSD
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
+#endif /* Use BSD.  */
+
+/* Advise to `posix_fadvise'.  */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
+# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
+# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.  */
+# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
+# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
+# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
+#endif
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/bits/mman.h sysdeps/unix/sysv/linux/m32r/bits/mman.h
--- sysdeps.org/unix/sysv/linux/m32r/bits/mman.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/bits/mman.h	2004-10-05 14:30:49.000000000 +0900
@@ -0,0 +1,98 @@
+/* Definitions for POSIX memory map interface.  Linux/M32R version.
+   Copyright (C) 2003, 2004 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.  */
+#define PROT_GROWSDOWN  0x01000000      /* Extend change to start of
+					   growsdown vma (mprotect only).  */
+#define PROT_GROWSUP    0x02000000      /* Extend change to start of
+					   growsup vma (mprotect only).  */
+
+
+/* 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 --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/bits/resource.h sysdeps/unix/sysv/linux/m32r/bits/resource.h
--- sysdeps.org/unix/sysv/linux/m32r/bits/resource.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/bits/resource.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,209 @@
+/* Bit values & structures for resource limits.  Linux/M32R version.
+   Copyright (C) 2003, 2004 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
+
+  /* Maximum number of file locks.  */
+  RLIMIT_LOCKS = 10,
+#define RLIMIT_LOCKS RLIMIT_LOCKS
+
+  RLIMIT_NLIMITS = 11,
+  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 --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/brk.c sysdeps/unix/sysv/linux/m32r/brk.c
--- sysdeps.org/unix/sysv/linux/m32r/brk.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/brk.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,50 @@
+/* brk system call for Linux/M32R.
+   Copyright (C) 2003, 2004 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;
+  register long r7 asm ("r7") = SYS_ify (brk);
+  register long r0 asm ("r0") = (long)addr;
+
+  asm volatile ("trap #0x2\n\t"
+		"mv %0,r0\n"
+		: "=r"(newbrk) 
+		: "r" (r7), "r" (r0)
+		);
+
+  __curbrk = newbrk;
+
+  if (newbrk < addr)
+    {
+      __set_errno (ENOMEM);
+      return -1;
+    }
+
+  return 0;
+}
+weak_alias (__brk, brk)
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/chown.c sysdeps/unix/sysv/linux/m32r/chown.c
--- sysdeps.org/unix/sysv/linux/m32r/chown.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/chown.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/m68k/chown.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/clone.S sysdeps/unix/sysv/linux/m32r/clone.S
--- sysdeps.org/unix/sysv/linux/m32r/clone.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/clone.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,70 @@
+/* Copyright (C) 2003, 2004 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.  */
+	beqz	r0, 1f
+	bnez	r1, 2f
+
+	.fillinsn
+1:
+	ldi	r0, #-EINVAL
+	SYSCALL_ERROR_HANDLER
+	.fillinsn
+2:
+	/* insert the args onto the new stack */
+	st	r3, @-r1
+	/* save the function pointer as the 0th element */
+	st	r0, @-r1
+
+	/* do the system call */
+	mv	r0, r2
+	ldi	r7, #SYS_ify(clone)
+	SYSCALL_INST
+	not	r1, r0
+	srai	r1, #12			// r1=0 means r0 = -1 to -4095
+	bnez	r1, 3f			// i.e. error in linux
+
+	SYSCALL_ERROR_HANDLER
+	.fillinsn
+3:
+	beqz	r0, 4f
+	ret
+	.fillinsn
+4:
+	/* thread starts */
+	ld	r1, @r15
+	ld	r0, @(4,r15)
+	jl	r1
+
+	/* we are done, passing the return value through r0  */
+	SYSCALL_ERROR_HANDLER
+
+PSEUDO_END (__clone)
+
+weak_alias (__clone, clone)
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/fchown.c sysdeps/unix/sysv/linux/m32r/fchown.c
--- sysdeps.org/unix/sysv/linux/m32r/fchown.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/fchown.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/fcntl.c sysdeps/unix/sysv/linux/m32r/fcntl.c
--- sysdeps.org/unix/sysv/linux/m32r/fcntl.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/fcntl.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/flushcache.S sysdeps/unix/sysv/linux/m32r/flushcache.S
--- sysdeps.org/unix/sysv/linux/m32r/flushcache.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/flushcache.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,29 @@
+/* Copyright (C) 2003, 2004 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free 
+   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
+   02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* int _flush_cache(char *addr, int nbytes, int cache); */
+
+        .text
+ENTRY(__flush_cache)
+	trap	#12
+	ret
+PSEUDO_END (__flush_cache)
+
+weak_alias (__flush_cache, _flush_cache)
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/fxstat.c sysdeps/unix/sysv/linux/m32r/fxstat.c
--- sysdeps.org/unix/sysv/linux/m32r/fxstat.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/fxstat.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/getegid.c sysdeps/unix/sysv/linux/m32r/getegid.c
--- sysdeps.org/unix/sysv/linux/m32r/getegid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/getegid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/geteuid.c sysdeps/unix/sysv/linux/m32r/geteuid.c
--- sysdeps.org/unix/sysv/linux/m32r/geteuid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/geteuid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/getgroups.c sysdeps/unix/sysv/linux/m32r/getgroups.c
--- sysdeps.org/unix/sysv/linux/m32r/getgroups.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/getgroups.c	2004-10-01 18:48:27.000000000 +0900
@@ -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 --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/getresgid.c sysdeps/unix/sysv/linux/m32r/getresgid.c
--- sysdeps.org/unix/sysv/linux/m32r/getresgid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/getresgid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/getresuid.c sysdeps/unix/sysv/linux/m32r/getresuid.c
--- sysdeps.org/unix/sysv/linux/m32r/getresuid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/getresuid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/getrlimit.c sysdeps/unix/sysv/linux/m32r/getrlimit.c
--- sysdeps.org/unix/sysv/linux/m32r/getrlimit.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/getrlimit.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/getrlimit64.c sysdeps/unix/sysv/linux/m32r/getrlimit64.c
--- sysdeps.org/unix/sysv/linux/m32r/getrlimit64.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/getrlimit64.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/getuid.c sysdeps/unix/sysv/linux/m32r/getuid.c
--- sysdeps.org/unix/sysv/linux/m32r/getuid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/getuid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/lchown.c sysdeps/unix/sysv/linux/m32r/lchown.c
--- sysdeps.org/unix/sysv/linux/m32r/lchown.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/lchown.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/lockf64.c sysdeps/unix/sysv/linux/m32r/lockf64.c
--- sysdeps.org/unix/sysv/linux/m32r/lockf64.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/lockf64.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/lxstat.c sysdeps/unix/sysv/linux/m32r/lxstat.c
--- sysdeps.org/unix/sysv/linux/m32r/lxstat.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/lxstat.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,2 @@
+#include <sysdeps/unix/sysv/linux/i386/lxstat.c>
+
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/m32r-stub.c sysdeps/unix/sysv/linux/m32r/m32r-stub.c
--- sysdeps.org/unix/sysv/linux/m32r/m32r-stub.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/m32r-stub.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,11 @@
+#include <elf/link.h>
+
+struct link_map _dl_rtld_map;
+
+#ifndef __PIC__
+void __pthread_initialize_minimal(void)
+{
+}
+#endif
+
+
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/mmap.S sysdeps/unix/sysv/linux/m32r/mmap.S
--- sysdeps.org/unix/sysv/linux/m32r/mmap.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/mmap.S	2004-10-08 16:38:31.000000000 +0900
@@ -0,0 +1,53 @@
+/* Copyright (C) 2003, 2004 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>
+
+/* 
+__ptr_t
+__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset);
+*/
+
+ENTRY (__mmap)
+	/* Push args and pass the address of 1st arg.
+	 * The 5th and 6th args are already passed in the stack.
+	 */
+	ld	r4, @sp			// fd
+	ld	r5, @(4,sp)		// offset
+	and3	r6, r5, #0x00000fff
+	bnez	r6, 0f
+	srli	r5, #12
+
+	ldi	r7, #__NR_mmap2
+	SYSCALL_INST
+	
+	.fillinsn
+0:
+	not	r1, r0
+	srai	r1, #12			// r1=0 means r0 = -1 to -4095
+	bnez	r1, 1f			// i.e. error in linux
+
+	SYSCALL_ERROR_HANDLER
+
+	.fillinsn
+1:
+	ret
+
+PSEUDO_END (__mmap)
+
+weak_alias (__mmap, mmap)
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/msgctl.c sysdeps/unix/sysv/linux/m32r/msgctl.c
--- sysdeps.org/unix/sysv/linux/m32r/msgctl.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/msgctl.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/pipe.S sysdeps/unix/sysv/linux/m32r/pipe.S
--- sysdeps.org/unix/sysv/linux/m32r/pipe.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/pipe.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,37 @@
+/* Copyright (C) 2003, 2004 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)
+	ldi	r7, #__NR_pipe
+	SYSCALL_INST
+	not	r1, r0
+	srai	r1, #12			// r1=0 means r0 = -1 to -4095
+	bnez	r1, 1f			// i.e. error in linux
+
+	SYSCALL_ERROR_HANDLER
+	.fillinsn
+1:
+	ldi	r0, #0
+	ret
+PSEUDO_END (__libc_pipe)
+
+weak_alias (__libc_pipe, __pipe)
+libc_hidden_def (__pipe)
+weak_alias (__libc_pipe, pipe)
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/profil-counter.h sysdeps/unix/sysv/linux/m32r/profil-counter.h
--- sysdeps.org/unix/sysv/linux/m32r/profil-counter.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/profil-counter.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,29 @@
+/* Low-level statistical profiling support function.  Linux/M32R version.
+   Copyright (C) 2003, 2004 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>
+#include <sigcontextinfo.h>
+
+static void
+profil_counter (int signo, SIGCONTEXT sc)
+{
+  void *pc;
+  pc = GET_PC(sc);
+  profil_count (pc);
+}
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/semctl.c sysdeps/unix/sysv/linux/m32r/semctl.c
--- sysdeps.org/unix/sysv/linux/m32r/semctl.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/semctl.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/semctl.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setegid.c sysdeps/unix/sysv/linux/m32r/setegid.c
--- sysdeps.org/unix/sysv/linux/m32r/setegid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setegid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/seteuid.c sysdeps/unix/sysv/linux/m32r/seteuid.c
--- sysdeps.org/unix/sysv/linux/m32r/seteuid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/seteuid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setfsgid.c sysdeps/unix/sysv/linux/m32r/setfsgid.c
--- sysdeps.org/unix/sysv/linux/m32r/setfsgid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setfsgid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setfsuid.c sysdeps/unix/sysv/linux/m32r/setfsuid.c
--- sysdeps.org/unix/sysv/linux/m32r/setfsuid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setfsuid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setgid.c sysdeps/unix/sysv/linux/m32r/setgid.c
--- sysdeps.org/unix/sysv/linux/m32r/setgid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setgid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setgroups.c sysdeps/unix/sysv/linux/m32r/setgroups.c
--- sysdeps.org/unix/sysv/linux/m32r/setgroups.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setgroups.c	2004-10-01 18:48:27.000000000 +0900
@@ -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 --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setregid.c sysdeps/unix/sysv/linux/m32r/setregid.c
--- sysdeps.org/unix/sysv/linux/m32r/setregid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setregid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setregid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setresgid.c sysdeps/unix/sysv/linux/m32r/setresgid.c
--- sysdeps.org/unix/sysv/linux/m32r/setresgid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setresgid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setresuid.c sysdeps/unix/sysv/linux/m32r/setresuid.c
--- sysdeps.org/unix/sysv/linux/m32r/setresuid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setresuid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setreuid.c sysdeps/unix/sysv/linux/m32r/setreuid.c
--- sysdeps.org/unix/sysv/linux/m32r/setreuid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setreuid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setreuid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setrlimit.c sysdeps/unix/sysv/linux/m32r/setrlimit.c
--- sysdeps.org/unix/sysv/linux/m32r/setrlimit.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setrlimit.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/setuid.c sysdeps/unix/sysv/linux/m32r/setuid.c
--- sysdeps.org/unix/sysv/linux/m32r/setuid.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/setuid.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setuid.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/shmctl.c sysdeps/unix/sysv/linux/m32r/shmctl.c
--- sysdeps.org/unix/sysv/linux/m32r/shmctl.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/shmctl.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/sigcontextinfo.h sysdeps/unix/sysv/linux/m32r/sigcontextinfo.h
--- sysdeps.org/unix/sysv/linux/m32r/sigcontextinfo.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/sigcontextinfo.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,26 @@
+/* Copyright (C) 2003, 2004 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 struct sigcontext * 
+#define SIGCONTEXT_EXTRA_ARGS
+#define GET_PC(ctx)	((void *)((ctx)->sc_bpc))
+#define GET_FRAME(ctx)	((void *)((ctx)->sc_fp))
+#define GET_STACK(ctx)	((void *)((ctx)->sc_spi))
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/socket.S sysdeps/unix/sysv/linux/m32r/socket.S
--- sysdeps.org/unix/sysv/linux/m32r/socket.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/socket.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,114 @@
+/* Copyright (C) 2003, 2004 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
+#ifndef NO_WEAK_ALIAS
+#define __socket P(__,socket)
+#else
+#define __socket socket
+#endif
+#endif
+
+#define PUSHARGS(x)	PUSHARGS x
+	.macro PUSHARGS nargs
+	push r0
+ 	.aif \nargs ge 2
+ 	  push r1
+ 	  .aif \nargs ge 3
+ 	    push r2
+ 	    .aif \nargs ge 4
+ 	      push r3
+ 	      /* If nargs is 5, caller has already pushed arg 5.  */
+ 	      /* If nargs is 6, caller has already pushed arg 5, 6.  */
+ 	    .aendi
+ 	  .aendi
+ 	.aendi
+	.endm
+
+#define PUSHARGS(x)	PUSHARGS x
+
+#define POPARGS_1	addi r15,#4
+#define POPARGS_2	addi r15,#8
+#define POPARGS_3	addi r15,#12
+#define POPARGS_4	addi r15,#16
+#define POPARGS_5	addi r15,#16
+#define POPARGS_6	addi r15,#16
+
+#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.  */
+	/* PUSHARGS(NARGS) */
+#if (NARGS >= 4)
+	push	r3
+ 	/* If nargs is 6, caller has already pushed arg 5, 6.  */
+ 	/* If nargs is 5, caller has already pushed arg 5.  */
+#endif
+#if (NARGS >= 3)
+	push	r2
+#endif
+#if (NARGS >= 2)
+	push	r1
+#endif
+	push	r0
+
+        /* Do the system call trap.  */
+	ldi	r0, #P(SOCKOP_,socket)
+	mv	r1, r15
+	ldi	r7, #SYS_ify(socketcall)
+	SYSCALL_INST
+
+	/* Pop args off the stack */
+	P(POPARGS_,NARGS)
+
+	not	r1, r0
+	srai	r1, #12			// r1=0 means r0 = -1 to -4095
+	bnez	r1, 1f			// i.e. error in linux
+
+	SYSCALL_ERROR_HANDLER
+	.fillinsn
+1:
+	/* Successful; return the syscall's value.  */
+	ret
+
+PSEUDO_END (__socket)
+
+weak_alias (__socket, socket)
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/sys/cachectl.h sysdeps/unix/sysv/linux/m32r/sys/cachectl.h
--- sysdeps.org/unix/sysv/linux/m32r/sys/cachectl.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/sys/cachectl.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,38 @@
+/* Copyright (C) 2003, 2004 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_CACHECTL_H
+#define _SYS_CACHECTL_H 1
+
+#include <features.h>
+
+/*
+ * Get the kernel definition for the op bits.
+ */
+#include <asm/cachectl.h>
+
+__BEGIN_DECLS
+
+#ifdef __USE_MISC
+extern int cacheflush (void *addr, __const int nbytes, __const int op) __THROW;
+#endif
+extern int _flush_cache (char *addr, __const int nbytes, __const int op) __THROW;
+
+__END_DECLS
+
+#endif /* sys/cachectl.h */
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/sys/io.h sysdeps/unix/sysv/linux/m32r/sys/io.h
--- sysdeps.org/unix/sysv/linux/m32r/sys/io.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/sys/io.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,48 @@
+/* Copyright (C) 2003, 2004 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 --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/sys/tas.h sysdeps/unix/sysv/linux/m32r/sys/tas.h
--- sysdeps.org/unix/sysv/linux/m32r/sys/tas.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/sys/tas.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,13 @@
+#ifndef	_SYS_TAS_H
+
+#define	_SYS_TAS_H	1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+extern int tas(int *) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_TAS_H */
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/sys/ucontext.h sysdeps/unix/sysv/linux/m32r/sys/ucontext.h
--- sysdeps.org/unix/sysv/linux/m32r/sys/ucontext.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/sys/ucontext.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,111 @@
+/* Copyright (C) 2003, 2004 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 NFPREG	16
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NFPREG];
+
+#if 0
+#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
+#endif /* 0 */
+
+typedef int freg_t;
+
+/* Number of FPU registers.  */
+#define NFPREG	16
+
+/* Structure to describe FPU registers.  */
+typedef freg_t fpregset_t[NFPREG];
+
+/* 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 --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/sys/user.h sysdeps/unix/sysv/linux/m32r/sys/user.h
--- sysdeps.org/unix/sysv/linux/m32r/sys/user.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/sys/user.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,26 @@
+/* Copyright (C) 2003, 2004 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>
+
+#include <asm/user.h>
+
+#endif  /* sys/user.h */
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/syscall.S sysdeps/unix/sysv/linux/m32r/syscall.S
--- sysdeps.org/unix/sysv/linux/m32r/syscall.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/syscall.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,41 @@
+/* Copyright (C) 2003, 2004 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 (__syscall)
+	mv	r7, r0			// syscall number
+	mv	r0, r1			// p1
+	mv	r1, r2			// p2
+	mv	r2, r3			// p3
+	ld	r3, @(sp)		// p4
+	ld	r4, @(4,sp)		// p5
+	ld	r5, @(8,sp)		// p6
+	ld	r6, @(12,sp)		// p7
+	SYSCALL_INST
+	not	r1, r0
+	srai	r1, #12			// r1=0 means r0 = -1 to -4095
+	bnez	r1, 1f			// i.e. error in linux
+
+	SYSCALL_ERROR_HANDLER
+	.fillinsn
+1:
+	ret
+PSEUDO_END (__syscall)
+
+weak_alias (__syscall, syscall)
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/syscalls.list sysdeps/unix/sysv/linux/m32r/syscalls.list
--- sysdeps.org/unix/sysv/linux/m32r/syscalls.list	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/syscalls.list	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,4 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+tas		-	tas		i:p	__tas		tas
+cachectl	-	cachectl	i:pii	__cachectl	cachectl
+cacheflush	-	cacheflush	i:pii	__cacheflush	cacheflush
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/sysdep.S sysdeps/unix/sysv/linux/m32r/sysdep.S
--- sysdeps.org/unix/sysv/linux/m32r/sysdep.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/sysdep.S	2004-10-19 13:57:36.000000000 +0900
@@ -0,0 +1,32 @@
+/* Copyright (C) 2003, 2004 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>
+
+/* 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 r0, r0
+
+#define __syscall_error __syscall_error_1
+#include <sysdeps/unix/m32r/sysdep.S>
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/sysdep.h sysdeps/unix/sysv/linux/m32r/sysdep.h
--- sysdeps.org/unix/sysv/linux/m32r/sysdep.h	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/sysdep.h	2004-10-19 13:57:59.000000000 +0900
@@ -0,0 +1,294 @@
+/* Copyright (C) 2003, 2004 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 _LINUX_M32R_SYSDEP_H
+#define _LINUX_M32R_SYSDEP_H 1
+
+/* There is some commonality.  */
+#include <sysdeps/unix/m32r/sysdep.h>
+
+/* Defines RTLD_PRIVATE_ERRNO.  */
+#include <dl-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 SYSCALL_INST    trap #2
+#define SYSCALL_INST_0	trap #2
+#define SYSCALL_INST_1	trap #2
+#define SYSCALL_INST_2	trap #2
+#define SYSCALL_INST_3	trap #2
+#define SYSCALL_INST_4	trap #2
+#define SYSCALL_INST_5	\
+  ld r4,@sp                    ! \
+  trap #2
+#define SYSCALL_INST_STR_6 \
+  ld r4,@sp                    ! \
+  ld r5,@(4,sp)                ! \
+  trap #2
+#define SYSCALL_INST_STR_7 \
+  ld r4,@sp                    ! \
+  ld r5,@(4,sp)                ! \
+  ld r6,@(8,sp)                ! \
+  trap #2
+
+#define DO_CALL( syscall_name, args )	\
+  ldi r7,SYS_ify(syscall_name)       ! \
+  SYSCALL_INST_##args
+
+#undef PSEUDO
+#define	PSEUDO(name, syscall_name, args) \
+  .text                                 !\
+ENTRY (name)                            !\
+  DO_CALL (syscall_name, args)          !\
+  not r1,r0                             !\
+  srai r1,#12                           !\
+  bnez r1,.Lpseudo_end                  !\
+  SYSCALL_ERROR_HANDLER                 !\
+  .fillinsn                             !\
+ .Lpseudo_end:
+
+#undef	PSEUDO_END
+#define	PSEUDO_END(name) \
+  END (name)
+
+#undef  PSEUDO_NOERRNO
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .text !\
+ ENTRY (name) !\
+ DO_CALL (syscall_name, args)
+                                                                                
+#undef  PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(name) \
+  END (name)
+
+#define ret_NOERRNO ret
+
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .text !\
+ ENTRY (name) !\
+ DO_CALL (syscall_name, args)
+                                                                                
+#undef  PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(name) \
+  END (name)
+                                                                                
+#define ret_ERRVAL ret
+
+#ifndef __PIC__
+#   define SYSCALL_ERROR_HANDLER \
+  LDIMM (r1, C_SYMBOL_NAME(__syscall_error)) !\
+  jmp r1                                !\
+
+#else
+# if RTLD_PRIVATE_ERRNO
+#  define SYSCALL_ERROR_HANDLER \
+  neg r1,r0                             !\
+  mv r3,lr                              !\
+  bl.s .+4                              !\
+  ld24 r2,#_GLOBAL_OFFSET_TABLE_        !\
+  add r2,lr                             !\
+  mv lr,r3                              !\
+  ld24 r0,#GOT(C_SYMBOL_NAME(rtld_errno))      !\
+  add r2,r0                             !\
+  ld r2,@r2                             !\
+  st r1,@r2                             !\
+  ldi r0,#-1                            !\
+  ret
+
+# elif defined _LIBC_REENTRANT
+
+#  if USE___THREAD
+#   ifndef NOT_IN_libc
+#    define SYSCALL_ERROR_ERRNO __libc_errno
+#   else
+#    define SYSCALL_ERROR_ERRNO errno
+#   endif
+#   define SYSCALL_ERROR_HANDLER \
+  neg r1,r0                             !\
+  mv r3,lr                              !\
+  bl.s .+4                              !\
+  ld24 r2,#_GLOBAL_OFFSET_TABLE_        !\
+  add r2,lr                             !\
+  mv lr,r3                              !\
+  ld24 r0,#GOT(C_SYMBOL_NAME(SYSCALL_ERROR_ERRNO))      !\
+  add r2,r0                             !\
+  ld r2,@r2                             !\
+  st r1,@r2                             !\
+  ldi r0,#-1                            !\
+  ret
+
+#  else
+#   define SYSCALL_ERROR_HANDLER \
+  neg r1,r0                             !\
+  push r12                              !\
+  push lr                               !\
+  push r1                               !\
+  bl.s .+4                              !\
+  ld24 r12,#_GLOBAL_OFFSET_TABLE_       !\
+  add r12,lr                            !\
+  ld24 r1,#GOT(C_SYMBOL_NAME(__errno_location)) !\
+  add r1,r12                            !\
+  ld r1,@r1                             !\
+  jl r1                                 !\
+  pop r1                                !\
+  st r1,@r0                             !\
+  pop lr                                !\
+  pop r12                               !\
+  ldi r0,#-1                            !\
+  ret                                   !\
+
+#  endif
+
+# else
+/* Store (-r0) into errno through the GOT.  */
+#   define SYSCALL_ERROR_HANDLER \
+  neg r1,r0                             !\
+  mv r3,lr                              !\
+  bl.s .+4                              !\
+  ld24 r2,#_GLOBAL_OFFSET_TABLE_        !\
+  add r2,lr                             !\
+  mv lr,r3                              !\
+  ld24 r0,#GOT(C_SYMBOL_NAME(errno))    !\
+  add r2,r0                             !\
+  ld r2,@r2                             !\
+  st r1,@r2                             !\
+  ldi r0,#-1                            !\
+  ret
+
+# endif /* _LIBC_REENTRANT */
+#endif /* __PIC__ */
+
+#define ret_ERRVAL ret
+
+#else /* not __ASSEMBLER__ */
+
+#undef	DO_CALL
+
+#define SYSCALL_INST_STR   "trap #2\n\t"
+
+#define ASMFMT_0 \
+	, "0" (r0)
+#define ASMFMT_1 \
+	, "0" (r0)
+#define ASMFMT_2 \
+	, "0" (r0), "r" (r1)
+#define ASMFMT_3 \
+	, "0" (r0), "r" (r1), "r" (r2)
+#define ASMFMT_4 \
+	, "0" (r0), "r" (r1), "r" (r2), "r" (r3)
+#define ASMFMT_5 \
+	, "0" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4)
+#define ASMFMT_6 \
+	, "0" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4), "r" (r5)
+#define ASMFMT_7 \
+	, "0" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4), "r" (r5), "r" (r6)
+
+#define SUBSTITUTE_ARGS_0() \
+	register long r0 asm ("r0") = 0
+#define SUBSTITUTE_ARGS_1(arg1)					\
+	register long r0 asm ("r0") = (long)(arg1)
+#define SUBSTITUTE_ARGS_2(arg1, arg2)				\
+	register long r0 asm ("r0") = (long)(arg1);		\
+	register long r1 asm ("r1") = (long)(arg2)
+#define SUBSTITUTE_ARGS_3(arg1, arg2, arg3)			\
+	register long r0 asm ("r0") = (long)(arg1);		\
+	register long r1 asm ("r1") = (long)(arg2);		\
+	register long r2 asm ("r2") = (long)(arg3)
+#define SUBSTITUTE_ARGS_4(arg1, arg2, arg3, arg4)		\
+	register long r0 asm ("r0") = (long)(arg1);		\
+	register long r1 asm ("r1") = (long)(arg2);		\
+	register long r2 asm ("r2") = (long)(arg3);		\
+	register long r3 asm ("r3") = (long)(arg4)
+#define SUBSTITUTE_ARGS_5(arg1, arg2, arg3, arg4, arg5) 	\
+	register long r0 asm ("r0") = (long)(arg1);		\
+	register long r1 asm ("r1") = (long)(arg2);		\
+	register long r2 asm ("r2") = (long)(arg3);		\
+	register long r3 asm ("r3") = (long)(arg4);		\
+	register long r4 asm ("r4") = (long)(arg5)
+#define SUBSTITUTE_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6)	\
+	register long r0 asm ("r0") = (long)(arg1);		\
+	register long r1 asm ("r1") = (long)(arg2);		\
+	register long r2 asm ("r2") = (long)(arg3);		\
+	register long r3 asm ("r3") = (long)(arg4);		\
+	register long r4 asm ("r4") = (long)(arg5);		\
+	register long r5 asm ("r5") = (long)(arg6)
+#define SUBSTITUTE_ARGS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
+	register long r0 asm ("r0") = (long)(arg1);		\
+	register long r1 asm ("r1") = (long)(arg2);		\
+	register long r2 asm ("r2") = (long)(arg3);		\
+	register long r3 asm ("r3") = (long)(arg4);		\
+	register long r4 asm ("r4") = (long)(arg5);		\
+	register long r5 asm ("r5") = (long)(arg6);		\
+	register long r6 asm ("r6") = (long)(arg7)
+
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+  ({                                                                          \
+    unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args);             \
+    if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))         \
+      {                                                                       \
+        __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));                   \
+        resultvar = 0xffffffff;                                               \
+      }                                                                       \
+    (int) resultvar; })
+                                                                                
+#undef INTERNAL_SYSCALL
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+  ({                                                            \
+    register long r7 asm ("r7") = SYS_ify (name);               \
+    SUBSTITUTE_ARGS_##nr(args);                                 \
+                                                                \
+    asm volatile (SYSCALL_INST_STR     "\n\t"                   \
+                  : "=r" (r0)                                   \
+                  : "r" (r7) ASMFMT_##nr                        \
+                  : "memory");                                  \
+                                                                \
+    (int) r0; })
+
+#undef INTERNAL_SYSCALL_DECL
+#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
+
+#undef INTERNAL_SYSCALL_ERROR_P
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+  ((unsigned int) (val) >= 0xfffff001u)
+                                                                                
+#undef INTERNAL_SYSCALL_ERRNO
+#define INTERNAL_SYSCALL_ERRNO(val, err)        (-(val))
+
+#endif	/* __ASSEMBLER__ */
+
+#endif /* linux/m32r/sysdep.h */
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/vfork.S sysdeps/unix/sysv/linux/m32r/vfork.S
--- sysdeps.org/unix/sysv/linux/m32r/vfork.S	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/vfork.S	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,65 @@
+/* Copyright (C) 2003, 2004 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
+	ldi	r7, #__NR_vfork
+	SYSCALL_INST
+	not	r1, r0
+	srai	r1, #12			// r1=0 means r0 = -1 to -4095
+	bnez	r1, 1f			// i.e. error in linux
+
+	/* Check if vfork syscall is known at all.  */
+	ldi	r1, #-ENOSYS
+	beq	r0, r1, 2f
+	bra	vfork_error
+	.fillinsn
+1:
+	ret
+	.fillinsn
+2:
+#endif
+
+	/* If we don't have vfork, fork is close enough.  */
+	ldi	r7, #__NR_fork
+	SYSCALL_INST
+	not	r1, r0
+	srai	r1, #12			// r1=0 means r0 = -1 to -4095
+	bnez	r1, 4f			// i.e. error in linux
+vfork_error:
+
+	SYSCALL_ERROR_HANDLER
+
+	.fillinsn
+4:
+	ret
+	
+PSEUDO_END (__vfork)
+libc_hidden_def(__vfork) 
+
+weak_alias (__vfork, vfork)
diff --exclude CVS -uNr sysdeps.org/unix/sysv/linux/m32r/xstat.c sysdeps/unix/sysv/linux/m32r/xstat.c
--- sysdeps.org/unix/sysv/linux/m32r/xstat.c	1970-01-01 09:00:00.000000000 +0900
+++ sysdeps/unix/sysv/linux/m32r/xstat.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/xstat.c>
diff --exclude CVS -uNr linuxthreads.org/sysdeps/m32r/pspinlock.c linuxthreads/sysdeps/m32r/pspinlock.c
--- linuxthreads.org/sysdeps/m32r/pspinlock.c	1970-01-01 09:00:00.000000000 +0900
+++ linuxthreads/sysdeps/m32r/pspinlock.c	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,70 @@
+/* POSIX spinlock implementation.  M32R version.
+   Copyright (C) 2003, 2004 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 <pthread.h>
+#include "internals.h"
+
+int
+__pthread_spin_lock (pthread_spinlock_t *lock)
+{
+  while (INLINE_SYSCALL (tas, 1, lock));
+  return 0;
+}
+weak_alias (__pthread_spin_lock, pthread_spin_lock)
+
+
+int
+__pthread_spin_trylock (pthread_spinlock_t *lock)
+{
+  unsigned int val;
+
+  if ((val = *lock) == 0)
+    val = INLINE_SYSCALL (tas, 1, lock);
+  return (val > 0 ? EBUSY : 0);
+}
+weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
+
+
+int
+__pthread_spin_unlock (pthread_spinlock_t *lock)
+{
+  return *lock = 0;
+}
+weak_alias (__pthread_spin_unlock, pthread_spin_unlock)
+
+
+int
+__pthread_spin_init (pthread_spinlock_t *lock, int pshared)
+{
+  /* We can ignore the `pshared' parameter.  Since we are busy-waiting
+     all processes which can access the memory location `lock' points
+     to can use the spinlock.  */
+  return *lock = 0;
+}
+weak_alias (__pthread_spin_init, pthread_spin_init)
+
+
+int
+__pthread_spin_destroy (pthread_spinlock_t *lock)
+{
+  /* Nothing to do.  */
+  return 0;
+}
+weak_alias (__pthread_spin_destroy, pthread_spin_destroy)
diff --exclude CVS -uNr linuxthreads.org/sysdeps/m32r/pt-machine.h linuxthreads/sysdeps/m32r/pt-machine.h
--- linuxthreads.org/sysdeps/m32r/pt-machine.h	1970-01-01 09:00:00.000000000 +0900
+++ linuxthreads/sysdeps/m32r/pt-machine.h	2004-10-01 18:48:27.000000000 +0900
@@ -0,0 +1,55 @@
+/* Machine-dependent pthreads configuration and inline functions.
+   M32R version.
+   Copyright (C) 2003, 2004 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 _PT_MACHINE_H
+#define _PT_MACHINE_H   1
+                                                                                
+#include <errno.h>
+#include <sysdep.h>
+
+#ifndef __ASSEMBLER__
+#ifndef PT_EI
+# define PT_EI extern inline
+#endif
+
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+
+/* Spinlock implementation; required.  */
+PT_EI long int
+testandset (int *spinlock)
+{
+  int ret;
+
+  ret = INLINE_SYSCALL (tas, 1, spinlock);
+  return ret;
+}
+
+#define lock_held(p) *(p)
+
+/* Get some notion of the current stack.  Need not be exactly the top
+   of the stack, just something somewhere in the current frame.  */
+#define CURRENT_STACK_FRAME  stack_pointer
+register char * stack_pointer __asm__ ("r15");
+
+#endif /* __ASSEMBLER__ */
+                                                                                
+#endif /* pt-machine.h */
+

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]