diff -uNr --exclude=CVS --exclude=config uClibc.org/Rules.mak uClibc/Rules.mak
--- uClibc.org/Rules.mak	2005-01-20 08:39:48.000000000 +0900
+++ uClibc/Rules.mak	2005-11-23 14:14:47.000000000 +0900
@@ -210,6 +210,10 @@
 	UCLIBC_LDSO=ld.so.1
 endif
 
+ifeq ($(strip $(TARGET_M32R)),m32r)
+	OPTIMIZATION+=-fstrict-aliasing
+endif
+
 # Use '-Os' optimization if available, else use -O2, allow Config to override
 OPTIMIZATION+=$(call check_gcc,-Os,-O2)
 # Use the gcc 3.4 -funit-at-a-time optimization when available
diff -uNr --exclude=CVS --exclude=config uClibc.org/extra/Configs/Config.in uClibc/extra/Configs/Config.in
--- uClibc.org/extra/Configs/Config.in	2005-02-09 02:44:46.000000000 +0900
+++ uClibc/extra/Configs/Config.in	2005-02-10 16:19:44.000000000 +0900
@@ -65,6 +65,9 @@
 config TARGET_v850
 	bool "v850"
 
+config TARGET_m32r
+	bool "m32r"
+
 endchoice
 
 
@@ -142,6 +145,10 @@
 source "extra/Configs/Config.v850"
 endif
 
+if TARGET_m32r
+source "extra/Configs/Config.m32r"
+endif
+
 
 
 source "extra/Configs/Config.in.arch"
diff -uNr --exclude=CVS --exclude=config uClibc.org/extra/Configs/Config.m32r uClibc/extra/Configs/Config.m32r
--- uClibc.org/extra/Configs/Config.m32r	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/extra/Configs/Config.m32r	2005-02-10 16:18:00.000000000 +0900
@@ -0,0 +1,73 @@
+#
+# For a description of the syntax of this configuration file,
+# see extra/config/Kconfig-language.txt
+#
+
+config TARGET_ARCH
+	default "m32r"
+
+config HAVE_ELF
+	bool
+	select ARCH_BIG_ENDIAN
+	select HAVE_NO_SHARED
+	select ARCH_HAS_NO_LDSO
+	default y
+
+config CROSS
+	string
+	default "m32r-elf-"
+
+choice
+	prompt "Target Architecture Type"
+	default CONFIG_M32R
+	help
+		This is the architecture type of your CPU. 
+		This information is used for optimizing purposes.
+
+		These are the possible settings:
+		- M32R        Generic support for Renesas' M32R architecture.
+
+config CONFIG_M32R
+	bool "M32R"
+
+endchoice
+
+choice
+	prompt "MMU Support"
+	default ARCH_HAS_NO_MMU
+
+config ARCH_HAS_NO_MMU
+	bool "Without MMU support"
+	default y
+
+config ARCH_HAS_MMU
+	bool "With MMU support"
+	default y
+
+endchoice
+
+choice
+	prompt "Memory Model"
+	default M32R_MEDIUM_MODEL
+
+config M32R_SMALL_MODEL
+	bool "Small memory model (<= 16MB)"
+	default y
+
+config M32R_MEDIUM_MODEL
+	bool "Medium memory model (> 16MB)"
+	default y
+
+endchoice
+
+config ARCH_CFLAGS
+	string
+	default "-mmodel=medium" if M32R_MEDIUM_MODEL
+
+config ARCH_LDFLAGS
+	string
+	default "-mmodel=medium" if M32R_MEDIUM_MODEL
+
+config LIBGCC_CFLAGS
+	string
+
diff -uNr --exclude=CVS --exclude=config uClibc.org/include/elf.h uClibc/include/elf.h
--- uClibc.org/include/elf.h	2004-12-11 21:23:28.000000000 +0900
+++ uClibc/include/elf.h	2005-02-10 18:30:48.000000000 +0900
@@ -2640,6 +2640,60 @@
 /* Keep this the last entry.  */
 #define R_NIOS2_NUM				22
 
+/* M32R relocs.  */
+#define R_M32R_NONE		0	/* No reloc. */
+#define R_M32R_16		1	/* Direct 16 bit. */
+#define R_M32R_32		2	/* Direct 32 bit. */
+#define R_M32R_24		3	/* Direct 24 bit. */
+#define R_M32R_10_PCREL		4	/* PC relative 10 bit shifted. */
+#define R_M32R_18_PCREL		5	/* PC relative 18 bit shifted. */
+#define R_M32R_26_PCREL		6	/* PC relative 26 bit shifted. */
+#define R_M32R_HI16_ULO		7	/* High 16 bit with unsigned low. */
+#define R_M32R_HI16_SLO		8	/* High 16 bit with signed low. */
+#define R_M32R_LO16		9	/* Low 16 bit. */
+#define R_M32R_SDA16		10	/* 16 bit offset in SDA. */
+#define R_M32R_GNU_VTINHERIT	11
+#define R_M32R_GNU_VTENTRY	12
+/* M32R relocs use SHT_RELA.  */
+#define R_M32R_16_RELA		33	/* Direct 16 bit. */
+#define R_M32R_32_RELA		34	/* Direct 32 bit. */
+#define R_M32R_24_RELA		35	/* Direct 24 bit. */
+#define R_M32R_10_PCREL_RELA	36	/* PC relative 10 bit shifted. */
+#define R_M32R_18_PCREL_RELA	37	/* PC relative 18 bit shifted. */
+#define R_M32R_26_PCREL_RELA	38	/* PC relative 26 bit shifted. */
+#define R_M32R_HI16_ULO_RELA	39	/* High 16 bit with unsigned low */
+#define R_M32R_HI16_SLO_RELA	40	/* High 16 bit with signed low */
+#define R_M32R_LO16_RELA	41	/* Low 16 bit */
+#define R_M32R_SDA16_RELA	42	/* 16 bit offset in SDA */
+#define R_M32R_RELA_GNU_VTINHERIT	43
+#define R_M32R_RELA_GNU_VTENTRY	44
+
+#define R_M32R_GOT24		48	/* 24 bit GOT entry */
+#define R_M32R_26_PLTREL	49	/* 26 bit PC relative to PLT shifted */
+#define R_M32R_COPY		50	/* Copy symbol at runtime */
+#define R_M32R_GLOB_DAT		51	/* Create GOT entry */
+#define R_M32R_JMP_SLOT		52	/* Create PLT entry */
+#define R_M32R_RELATIVE		53	/* Adjust by program base */
+#define R_M32R_GOTOFF		54	/* 24 bit offset to GOT */
+#define R_M32R_GOTPC24		55	/* 24 bit PC relative offset to GOT */
+#define R_M32R_GOT16_HI_ULO	56	/* High 16 bit GOT entry with unsigned
+					   low */
+#define R_M32R_GOT16_HI_SLO	57	/* High 16 bit GOT entry with signed
+					   low */
+#define R_M32R_GOT16_LO		58	/* Low 16 bit GOT entry */
+#define R_M32R_GOTPC_HI_ULO	59	/* High 16 bit PC relative offset to
+					   GOT with unsigned low */
+#define R_M32R_GOTPC_HI_SLO	60	/* High 16 bit PC relative offset to
+					   GOT with signed low */
+#define R_M32R_GOTPC_LO		61	/* Low 16 bit PC relative offset to
+					   GOT */
+#define R_M32R_GOTOFF_HI_ULO	62	/* High 16 bit offset to GOT
+					   with unsigned low */
+#define R_M32R_GOTOFF_HI_SLO	63	/* High 16 bit offset to GOT
+					   with signed low */
+#define R_M32R_GOTOFF_LO	64	/* Low 16 bit offset to GOT */
+#define R_M32R_NUM		256	/* Keep this the last entry. */
+
 __END_DECLS
 
 #endif	/* elf.h */
diff -uNr --exclude=CVS --exclude=config uClibc.org/include/sys/procfs.h uClibc/include/sys/procfs.h
--- uClibc.org/include/sys/procfs.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/include/sys/procfs.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,117 @@
+/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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_PROCFS_H
+#define _SYS_PROCFS_H	1
+
+/* This is somehow modelled after the file of the same name on SysVr4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  */
+
+#include <features.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <sys/user.h>
+#include <asm/elf.h>
+
+__BEGIN_DECLS
+
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   gdb doesn't really use excluded.  Fields present but not used are
+   marked with "XXX".  */
+struct elf_prstatus
+  {
+#if 0
+    long int pr_flags;			/* XXX Process flags.  */
+    short int pr_why;			/* XXX Reason for process halt.  */
+    short int pr_what;			/* XXX More detailed reason.  */
+#endif
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+#if 0
+    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    struct sigaction pr_action;		/* Signal action for current sig.  */
+#endif
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+#if 0
+    long int pr_instr;			/* Current instruction.  */
+#endif
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    long pr_uid;
+    long pr_gid;
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+
+/* Addresses.  */
+typedef void *psaddr_t;
+
+/* Register sets.  Linux has different names.  */
+typedef gregset_t prgregset_t;
+typedef fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+   therefore habe only ine PID type.  */
+typedef __pid_t lwpid_t;
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff -uNr --exclude=CVS --exclude=config uClibc.org/include/sys/ucontext.h uClibc/include/sys/ucontext.h
--- uClibc.org/include/sys/ucontext.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/include/sys/ucontext.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,111 @@
+/* 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.  */
+
+/* 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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/Makefile uClibc/libc/Makefile
--- uClibc.org/libc/Makefile	2005-01-25 12:08:28.000000000 +0900
+++ uClibc/libc/Makefile	2005-02-22 16:52:44.000000000 +0900
@@ -56,7 +56,7 @@
 	objs=`cat obj.*` ; $(AR) $(ARFLAGS) $(LIBNAME) $$objs
 	objs=`cat obj.*` ; $(AR) dN 2 $(LIBNAME) $$objs
 	@for objfile in obj.signal obj.string.generic obj.string \
-	               obj.sysdeps.$(TARGET_ARCH) obj.sysdeps.common ; do \
+	               obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \
 		echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \
 		objs=`cat $$objfile` ; \
 		$(AR) $(ARFLAGS) $(LIBNAME) $$objs || exit 1 ; \
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/stk8YvPd uClibc/libc/stk8YvPd
--- uClibc.org/libc/stk8YvPd	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/stk8YvPd	2005-03-09 19:47:24.000000000 +0900
@@ -0,0 +1 @@
+!<arch>
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/Makefile uClibc/libc/sysdeps/linux/Makefile
--- uClibc.org/libc/sysdeps/linux/Makefile	2005-01-25 12:10:01.000000000 +0900
+++ uClibc/libc/sysdeps/linux/Makefile	2005-02-16 14:59:07.000000000 +0900
@@ -19,7 +19,7 @@
 TOPDIR=../../../
 include $(TOPDIR)Rules.mak
 
-ALL_SUBDIRS = arm common cris h8300 i386 m68k mips nios nios2 powerpc sh sh64 sparc v850
+ALL_SUBDIRS = m32r arm common cris h8300 i386 m68k mips nios nios2 powerpc sh sh64 sparc v850
 
 all: common $(TARGET_ARCH)
 
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/__syscall_fcntl.c uClibc/libc/sysdeps/linux/common/__syscall_fcntl.c
--- uClibc.org/libc/sysdeps/linux/common/__syscall_fcntl.c	2005-01-06 08:11:03.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/__syscall_fcntl.c	2005-02-10 17:55:21.000000000 +0900
@@ -11,6 +11,7 @@
 #include <stdarg.h>
 #include <fcntl.h>
 
+#ifdef __NR_fcntl
 #define __NR___syscall_fcntl __NR_fcntl
 #ifdef __UCLIBC_HAS_LFS__
 static inline
@@ -36,3 +37,4 @@
 #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
 weak_alias(__libc_fcntl, fcntl64);
 #endif
+#endif
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/__syscall_fcntl64.c uClibc/libc/sysdeps/linux/common/__syscall_fcntl64.c
--- uClibc.org/libc/sysdeps/linux/common/__syscall_fcntl64.c	2005-01-06 08:11:03.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/__syscall_fcntl64.c	2005-03-10 11:02:22.000000000 +0900
@@ -28,3 +28,7 @@
 
 weak_alias(__libc_fcntl64, fcntl64);
 #endif
+#ifndef __NR_fcntl
+weak_alias(__libc_fcntl64, fcntl);
+weak_alias(__libc_fcntl64, __libc_fcntl);
+#endif
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/chown.c uClibc/libc/sysdeps/linux/common/chown.c
--- uClibc.org/libc/sysdeps/linux/common/chown.c	2005-01-06 08:11:03.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/chown.c	2005-02-16 14:02:17.000000000 +0900
@@ -10,16 +10,27 @@
 #include "syscalls.h"
 #include <unistd.h>
 
+#ifdef __NR_chown
 #define __NR___syscall_chown __NR_chown
 static inline _syscall3(int, __syscall_chown, const char *, path,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
+#endif
+#ifdef __NR_chown32
+#define __NR___syscall_chown32 __NR_chown32
+static inline _syscall3(int, __syscall_chown32, const char *, path,
+		__kernel_uid32_t, owner, __kernel_gid32_t, group);
+#endif
 
 int chown(const char *path, uid_t owner, gid_t group)
 {
+#if !defined(__NR_chown) && defined(__NR_chown32)
+	return (__syscall_chown32(path, owner, group));
+#else
 	if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
 		|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return (__syscall_chown(path, owner, group));
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/fchown.c uClibc/libc/sysdeps/linux/common/fchown.c
--- uClibc.org/libc/sysdeps/linux/common/fchown.c	2005-01-06 08:11:03.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/fchown.c	2005-02-16 13:03:18.000000000 +0900
@@ -10,16 +10,27 @@
 #include "syscalls.h"
 #include <unistd.h>
 
+#ifdef __NR_fchown
 #define __NR___syscall_fchown __NR_fchown
 static inline _syscall3(int, __syscall_fchown, int, fd,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
+#endif
+#ifdef __NR_fchown32
+#define __NR___syscall_fchown32 __NR_fchown32
+static inline _syscall3(int, __syscall_fchown32, int, fd,
+		__kernel_uid32_t, owner, __kernel_gid32_t, group);
+#endif
 
 int fchown(int fd, uid_t owner, gid_t group)
 {
+#if !defined(__NR_fchown) && defined(__NR_fchown32)
+	return (__syscall_fchown32(fd, owner, group));
+#else
 	if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
 		|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return (__syscall_fchown(fd, owner, group));
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/getgid.c uClibc/libc/sysdeps/linux/common/getgid.c
--- uClibc.org/libc/sysdeps/linux/common/getgid.c	2005-01-06 08:11:04.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/getgid.c	2005-02-16 14:02:02.000000000 +0900
@@ -10,13 +10,26 @@
 #include "syscalls.h"
 #include <unistd.h>
 
+#ifdef __NR_getgid
 #define __NR___syscall_getgid __NR_getgid
 #if defined (__alpha__)
 #define __NR_getgid     __NR_getxgid
 #endif
 
 static inline _syscall0(int, __syscall_getgid);
+#endif
+
+#ifdef __NR_getgid32
+#define __NR___syscall_getgid32 __NR_getgid32
+
+static inline _syscall0(int, __syscall_getgid32);
+#endif
+
 gid_t getgid(void)
 {
+#if !defined(__NR_getgid) && defined(__NR_getgid32)
+	return (__syscall_getgid32());
+#else
 	return (__syscall_getgid());
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/getgroups.c uClibc/libc/sysdeps/linux/common/getgroups.c
--- uClibc.org/libc/sysdeps/linux/common/getgroups.c	2005-01-06 08:11:04.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/getgroups.c	2005-02-14 14:45:01.000000000 +0900
@@ -12,6 +12,9 @@
 
 #define MIN(a,b) (((a)<(b))?(a):(b))
 
+#ifndef __NR_getgroups
+#define __NR_getgroups __NR_getgroups32
+#endif
 #define __NR___syscall_getgroups __NR_getgroups
 static inline _syscall2(int, __syscall_getgroups,
 		int, size, __kernel_gid_t *, list);
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/getresgid.c uClibc/libc/sysdeps/linux/common/getresgid.c
--- uClibc.org/libc/sysdeps/linux/common/getresgid.c	2005-01-06 08:11:05.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/getresgid.c	2005-02-16 13:09:07.000000000 +0900
@@ -13,9 +13,18 @@
 #define __NR___syscall_getresgid __NR_getresgid
 static inline _syscall3(int, __syscall_getresgid, __kernel_gid_t *, egid,
 		  __kernel_gid_t *, rgid, __kernel_gid_t *, sgid);
+#endif
+#ifdef __NR_getresgid32
+#define __NR___syscall_getresgid32 __NR_getresgid32
+static inline _syscall3(int, __syscall_getresgid32, __kernel_gid32_t *, egid,
+		  __kernel_gid32_t *, rgid, __kernel_gid32_t *, sgid);
+#endif
 
 int getresgid(gid_t * rgid, gid_t * egid, gid_t * sgid)
 {
+#if !defined(__NR_getresgid) && defined(__NR_getresgid32)
+	return __syscall_getresgid32(rgid, egid, sgid);
+#else
 	int result;
 	__kernel_gid_t k_rgid, k_egid, k_sgid;
 
@@ -26,5 +35,5 @@
 		*sgid = (gid_t) k_sgid;
 	}
 	return result;
-}
 #endif
+}
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/getresuid.c uClibc/libc/sysdeps/linux/common/getresuid.c
--- uClibc.org/libc/sysdeps/linux/common/getresuid.c	2005-01-06 08:11:05.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/getresuid.c	2005-02-16 13:04:23.000000000 +0900
@@ -13,9 +13,18 @@
 #define __NR___syscall_getresuid __NR_getresuid
 static inline _syscall3(int, __syscall_getresuid, __kernel_uid_t *, ruid,
 		  __kernel_uid_t *, euid, __kernel_uid_t *, suid);
+#endif
+#ifdef __NR_getresuid32
+#define __NR___syscall_getresuid32 __NR_getresuid32
+static inline _syscall3(int, __syscall_getresuid32, __kernel_uid32_t *, ruid,
+		  __kernel_uid32_t *, euid, __kernel_uid32_t *, suid);
+#endif
 
 int getresuid(uid_t * ruid, uid_t * euid, uid_t * suid)
 {
+#if !defined(__NR_getresuid) && defined(__NR_getresuid32)
+	return __syscall_getresuid32(ruid, euid, suid);
+#else
 	int result;
 	__kernel_uid_t k_ruid, k_euid, k_suid;
 
@@ -26,5 +35,5 @@
 		*suid = (uid_t) k_suid;
 	}
 	return result;
-}
 #endif
+}
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/getuid.c uClibc/libc/sysdeps/linux/common/getuid.c
--- uClibc.org/libc/sysdeps/linux/common/getuid.c	2005-01-06 08:11:05.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/getuid.c	2005-02-14 14:38:03.000000000 +0900
@@ -13,6 +13,9 @@
 #if defined (__alpha__)
 #define __NR_getuid     __NR_getxuid
 #endif
+#ifndef __NR_getuid
+#define __NR_getuid __NR_getuid32
+#endif
 #define __NR___syscall_getuid __NR_getuid
 
 static inline _syscall0(int, __syscall_getuid);
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/lchown.c uClibc/libc/sysdeps/linux/common/lchown.c
--- uClibc.org/libc/sysdeps/linux/common/lchown.c	2005-01-06 08:11:05.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/lchown.c	2005-02-16 13:14:11.000000000 +0900
@@ -10,16 +10,27 @@
 #include "syscalls.h"
 #include <unistd.h>
 
+#ifdef __NR_lchown
 #define __NR___syscall_lchown __NR_lchown
 static inline _syscall3(int, __syscall_lchown, const char *, path,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
+#endif
+#ifdef __NR_lchown32
+#define __NR___syscall_lchown32 __NR_lchown32
+static inline _syscall3(int, __syscall_lchown32, const char *, path,
+		__kernel_uid32_t, owner, __kernel_gid32_t, group);
+#endif
 
 int lchown(const char *path, uid_t owner, gid_t group)
 {
+#if !defined(__NR_lchown) && defined(__NR_lchown32)
+	return __syscall_lchown32(path, owner, group);
+#else
 	if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
 		|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return __syscall_lchown(path, owner, group);
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setfsgid.c uClibc/libc/sysdeps/linux/common/setfsgid.c
--- uClibc.org/libc/sysdeps/linux/common/setfsgid.c	2005-01-06 08:11:08.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setfsgid.c	2005-02-16 13:10:17.000000000 +0900
@@ -10,14 +10,24 @@
 #include "syscalls.h"
 #include <sys/fsuid.h>
 
+#ifdef __NR_setfsgid
 #define __NR___syscall_setfsgid __NR_setfsgid
 static inline _syscall1(int, __syscall_setfsgid, __kernel_gid_t, gid);
+#endif
+#ifdef __NR_setfsgid32
+#define __NR___syscall_setfsgid32 __NR_setfsgid32
+static inline _syscall1(int, __syscall_setfsgid32, __kernel_gid32_t, gid);
+#endif
 
 int setfsgid(gid_t gid)
 {
+#if !defined(__NR_setfsgid) && defined(__NR_setfsgid32)
+	return (__syscall_setfsgid32(gid));
+#else
 	if (gid != (gid_t) ((__kernel_gid_t) gid)) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return (__syscall_setfsgid(gid));
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setfsuid.c uClibc/libc/sysdeps/linux/common/setfsuid.c
--- uClibc.org/libc/sysdeps/linux/common/setfsuid.c	2005-01-06 08:11:08.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setfsuid.c	2005-02-16 12:59:00.000000000 +0900
@@ -10,14 +10,24 @@
 #include "syscalls.h"
 #include <sys/fsuid.h>
 
+#ifdef __NR_setfsuid
 #define __NR___syscall_setfsuid __NR_setfsuid
 static inline _syscall1(int, __syscall_setfsuid, __kernel_uid_t, uid);
+#endif
+#ifdef __NR_setfsuid32
+#define __NR___syscall_setfsuid32 __NR_setfsuid32
+static inline _syscall1(int, __syscall_setfsuid32, __kernel_uid32_t, uid);
+#endif
 
 int setfsuid(uid_t uid)
 {
+#if !defined(__NR_setfsuid) && defined(__NR_setfsuid32)
+	return (__syscall_setfsuid32(uid));
+#else
 	if (uid != (uid_t) ((__kernel_uid_t) uid)) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return (__syscall_setfsuid(uid));
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setgid.c uClibc/libc/sysdeps/linux/common/setgid.c
--- uClibc.org/libc/sysdeps/linux/common/setgid.c	2005-01-06 08:11:08.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setgid.c	2005-02-16 13:10:53.000000000 +0900
@@ -10,14 +10,24 @@
 #include "syscalls.h"
 #include <unistd.h>
 
+#ifdef __NR_setgid
 #define __NR___syscall_setgid __NR_setgid
 static inline _syscall1(int, __syscall_setgid, __kernel_gid_t, gid);
+#endif
+#ifdef __NR_setgid32
+#define __NR___syscall_setgid32 __NR_setgid32
+static inline _syscall1(int, __syscall_setgid32, __kernel_gid32_t, gid);
+#endif
 
 int setgid(gid_t gid)
 {
+#if !defined(__NR_setgid) && defined(__NR_setgid32)
+	return (__syscall_setgid32(gid));
+#else
 	if (gid == (gid_t) ~ 0 || gid != (gid_t) ((__kernel_gid_t) gid)) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return (__syscall_setgid(gid));
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setgroups.c uClibc/libc/sysdeps/linux/common/setgroups.c
--- uClibc.org/libc/sysdeps/linux/common/setgroups.c	2005-01-06 08:11:08.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setgroups.c	2005-02-14 14:44:33.000000000 +0900
@@ -11,6 +11,9 @@
 #include <unistd.h>
 #include <grp.h>
 
+#ifndef __NR_setgroups
+#define __NR_setgroups __NR_setgroups32
+#endif
 #define __NR___syscall_setgroups __NR_setgroups
 static inline _syscall2(int, __syscall_setgroups,
 		size_t, size, const __kernel_gid_t *, list);
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setregid.c uClibc/libc/sysdeps/linux/common/setregid.c
--- uClibc.org/libc/sysdeps/linux/common/setregid.c	2005-01-06 08:11:08.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setregid.c	2005-02-16 13:11:43.000000000 +0900
@@ -10,16 +10,27 @@
 #include "syscalls.h"
 #include <unistd.h>
 
+#ifdef __NR_setregid
 #define __NR___syscall_setregid __NR_setregid
 static inline _syscall2(int, __syscall_setregid,
 		__kernel_gid_t, rgid, __kernel_gid_t, egid);
+#endif
+#ifdef __NR_setregid32
+#define __NR___syscall_setregid32 __NR_setregid32
+static inline _syscall2(int, __syscall_setregid32,
+		__kernel_gid32_t, rgid, __kernel_gid32_t, egid);
+#endif
 
 int setregid(gid_t rgid, gid_t egid)
 {
+#if !defined(__NR_setregid) && defined(__NR_setregid32)
+	return (__syscall_setregid32(rgid, egid));
+#else
 	if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
 		|| ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return (__syscall_setregid(rgid, egid));
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setresgid.c uClibc/libc/sysdeps/linux/common/setresgid.c
--- uClibc.org/libc/sysdeps/linux/common/setresgid.c	2005-01-06 08:11:08.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setresgid.c	2005-02-16 13:15:19.000000000 +0900
@@ -13,9 +13,18 @@
 #define __NR___syscall_setresgid __NR_setresgid
 static inline _syscall3(int, __syscall_setresgid,
 		__kernel_gid_t, rgid, __kernel_gid_t, egid, __kernel_gid_t, sgid);
+#endif
+#ifdef __NR_setresgid32
+#define __NR___syscall_setresgid32 __NR_setresgid32
+static inline _syscall3(int, __syscall_setresgid32,
+		__kernel_gid32_t, rgid, __kernel_gid32_t, egid, __kernel_gid32_t, sgid);
+#endif
 
 int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
 {
+#if !defined(__NR_setresgid) && defined(__NR_setresgid32)
+	return (__syscall_setresgid32(rgid, egid, sgid));
+#else
 	if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
 		|| ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
 		|| ((sgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
@@ -23,5 +32,5 @@
 		return -1;
 	}
 	return (__syscall_setresgid(rgid, egid, sgid));
-}
 #endif
+}
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setresuid.c uClibc/libc/sysdeps/linux/common/setresuid.c
--- uClibc.org/libc/sysdeps/linux/common/setresuid.c	2005-01-06 08:11:08.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setresuid.c	2005-02-16 13:15:46.000000000 +0900
@@ -13,9 +13,18 @@
 #define __NR___syscall_setresuid __NR_setresuid
 static inline _syscall3(int, __syscall_setresuid,
 		__kernel_uid_t, rgid, __kernel_uid_t, egid, __kernel_uid_t, sgid);
+#endif
+#ifdef __NR_setresuid32
+#define __NR___syscall_setresuid32 __NR_setresuid32
+static inline _syscall3(int, __syscall_setresuid32,
+		__kernel_uid32_t, rgid, __kernel_uid32_t, egid, __kernel_uid32_t, sgid);
+#endif
 
 int setresuid(uid_t ruid, uid_t euid, uid_t suid)
 {
+#if !defined(__NR_setresuid) && defined(__NR_setresuid32)
+	return (__syscall_setresuid32(ruid, euid, suid));
+#else
 	if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
 		|| ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
 		|| ((suid + 1) > (uid_t) ((__kernel_uid_t) - 1U))) {
@@ -23,5 +32,5 @@
 		return -1;
 	}
 	return (__syscall_setresuid(ruid, euid, suid));
-}
 #endif
+}
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setreuid.c uClibc/libc/sysdeps/linux/common/setreuid.c
--- uClibc.org/libc/sysdeps/linux/common/setreuid.c	2005-01-06 08:11:08.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setreuid.c	2005-02-23 14:48:42.000000000 +0900
@@ -10,16 +10,27 @@
 #include "syscalls.h"
 #include <unistd.h>
 
+#ifdef __NR_setreuid
 #define __NR___syscall_setreuid __NR_setreuid
 static inline _syscall2(int, __syscall_setreuid,
 		__kernel_uid_t, ruid, __kernel_uid_t, euid);
+#endif
+#ifndef __NR_setreuid
+#define __NR___syscall_setreuid32 __NR_setreuid32
+static inline _syscall2(int, __syscall_setreuid32,
+		__kernel_uid32_t, ruid, __kernel_uid32_t, euid);
+#endif
 
 int setreuid(uid_t ruid, uid_t euid)
 {
+#if !defined(__NR_setreuid) && defined(__NR_setreuid32)
+	return (__syscall_setreuid32(ruid, euid));
+#else
 	if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
 		|| ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U))) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return (__syscall_setreuid(ruid, euid));
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/common/setuid.c uClibc/libc/sysdeps/linux/common/setuid.c
--- uClibc.org/libc/sysdeps/linux/common/setuid.c	2005-02-14 14:18:15.000000000 +0900
+++ uClibc/libc/sysdeps/linux/common/setuid.c	2005-02-16 12:59:45.000000000 +0900
@@ -10,14 +10,24 @@
 #include "syscalls.h"
 #include <unistd.h>
 
+#ifdef __NR_setuid
 #define __NR___syscall_setuid __NR_setuid
 static inline _syscall1(int, __syscall_setuid, __kernel_uid_t, uid);
+#endif
+#ifdef __NR_setuid32
+#define __NR___syscall_setuid32 __NR_setuid32
+static inline _syscall1(int, __syscall_setuid32, __kernel_uid32_t, uid);
+#endif
 
 int setuid(uid_t uid)
 {
+#if !defined(__NR_setuid) && defined(__NR_setuid32)
+	return (__syscall_setuid32(uid));
+#else
 	if (uid == (uid_t) ~ 0 || uid != (uid_t) ((__kernel_uid_t) uid)) {
 		__set_errno(EINVAL);
 		return -1;
 	}
 	return (__syscall_setuid(uid));
+#endif
 }
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/Makefile uClibc/libc/sysdeps/linux/m32r/Makefile
--- uClibc.org/libc/sysdeps/linux/m32r/Makefile	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/Makefile	2005-02-23 19:24:59.000000000 +0900
@@ -0,0 +1,92 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
+#
+# This program 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.
+#
+# This program 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 this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+TOPDIR=../../../../
+include $(TOPDIR)Rules.mak
+ASFLAGS=$(CFLAGS) -D__ASSEMBLER__
+
+#CRTCFLAGS=-Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -O0 -g3 -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)include -I. -I/usr/local/m32r-linux-3.2/lib/gcc-lib/m32r-linux/3.2.3/include -DNDEBUG -D__ASSEMBLER__
+
+CRT0_SRC = crt0.S
+#CRT0_SRC = crt0.c
+CRT0_OBJ = crt0.o
+#CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
+CRT0_DEPS=gmon-start.S
+
+SSRC= __longjmp.S setjmp.S clone.S sysdep.S vfork.S mmap.S
+SOBJS=$(patsubst %S,%o, $(SSRC))
+
+CSRC=brk.c syscall.c sigaction.c fork.c
+COBJS=$(patsubst %.c,%.o, $(CSRC))
+
+OBJS=$(SOBJS) $(COBJS)
+
+OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
+
+all: $(OBJ_LIST)
+
+$(OBJ_LIST): $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
+	echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
+	$(INSTALL) -d $(TOPDIR)lib/
+	cp $(CRT0_OBJ) $(TOPDIR)lib/
+
+#$(LIBC): ar-target
+
+#ar-target: $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
+#	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
+#	mkdir -p $(TOPDIR)lib
+#	cp $(CRT0_OBJ) $(TOPDIR)lib/
+
+$(CRT0_OBJ): $(CRT0_SRC)
+	$(CC) $(CFLAGS) -D__ASSEMBLER__ -DL_$* $< -c -o $*.o
+	$(STRIPTOOL) -x -R .note -R .comment $*.o
+
+$(SOBJS): %.o : %.S
+	$(CC) $(CFLAGS) -D__ASSEMBLER__ -c $< -o $@
+	$(STRIPTOOL) -x -R .note -R .comment $*.o
+
+$(COBJS): %.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+	$(STRIPTOOL) -x -R .note -R .comment $*.o
+
+ifeq ($(strip $(UCLIBC_PROFILING)),y)
+gmon-start.S: ../common/gmon-start.c
+	$(CC) $(CFLAGS) -c $< -S -o $*.S
+gcrt1.o: $(CRT0_DEPS)
+endif
+
+#crti.o: crti.S
+#	$(CC) $(CFLAGS) -c crti.S -o crti.o
+
+#$(TOPDIR)lib/crti.o: crti.o
+#	$(INSTALL) -d $(TOPDIR)lib/
+#	cp crti.o $(TOPDIR)lib/
+
+#crtn.o: crtn.S
+#	$(CC) $(CFLAGS) -c crtn.S -o crtn.o
+
+#$(TOPDIR)lib/crtn.o: crtn.o
+#	$(INSTALL) -d $(TOPDIR)lib/
+#	cp crtn.o $(TOPDIR)lib/
+
+headers:
+
+clean:
+	$(RM) *.[oa] *~ core
+	$(RM) gmon-start.S
+
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/__longjmp.S uClibc/libc/sysdeps/linux/m32r/__longjmp.S
--- uClibc.org/libc/sysdeps/linux/m32r/__longjmp.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/__longjmp.S	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,44 @@
+/* longjmp for M32R.
+   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>
+#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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/endian.h uClibc/libc/sysdeps/linux/m32r/bits/endian.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/endian.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/endian.h	2005-02-15 17:27:05.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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/fcntl.h uClibc/libc/sysdeps/linux/m32r/bits/fcntl.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/fcntl.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/fcntl.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,155 @@
+/* O_*, F_*, FD_* bit values for Linux.
+   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.  */
+
+#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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/kernel_types.h uClibc/libc/sysdeps/linux/m32r/bits/kernel_types.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/kernel_types.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/kernel_types.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,55 @@
+#ifndef _ASM_M32R_POSIX_TYPES_H
+#define _ASM_M32R_POSIX_TYPES_H
+
+/* $Id: kernel_types.h,v 1.1 2004/04/09 06:39:11 inaoka Exp $ */
+
+/* orig : i386, sh 2.4.18 */
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc.  Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned long	__kernel_ino_t;
+typedef unsigned short	__kernel_mode_t;
+typedef unsigned short	__kernel_nlink_t;
+typedef long		__kernel_off_t;
+typedef int		__kernel_pid_t;
+typedef unsigned short	__kernel_ipc_pid_t;
+typedef unsigned short	__kernel_uid_t;
+typedef unsigned short	__kernel_gid_t;
+typedef unsigned int	__kernel_size_t;
+typedef int		__kernel_ssize_t;
+typedef int		__kernel_ptrdiff_t;
+typedef long		__kernel_time_t;
+typedef long		__kernel_suseconds_t;
+typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
+typedef int		__kernel_daddr_t;
+typedef char *		__kernel_caddr_t;
+typedef unsigned short	__kernel_uid16_t;
+typedef unsigned short	__kernel_gid16_t;
+typedef unsigned int	__kernel_uid32_t;
+typedef unsigned int	__kernel_gid32_t;
+
+typedef unsigned short	__kernel_old_uid_t;
+typedef unsigned short	__kernel_old_gid_t;
+typedef unsigned short	__kernel_old_dev_t;
+
+typedef unsigned short	__kernel_dev_t;
+
+#ifdef __GNUC__
+typedef long long	__kernel_loff_t;
+#endif
+
+typedef struct {
+#if defined(__KERNEL__) || defined(__USE_ALL)
+	int	val[2];
+#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+	int	__val[2];
+#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+} __kernel_fsid_t;
+
+#endif  /* _ASM_M32R_POSIX_TYPES_H */
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/machine-gmon.h uClibc/libc/sysdeps/linux/m32r/bits/machine-gmon.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/machine-gmon.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/machine-gmon.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,34 @@
+/* Machine-dependent definitions for profiling support.  M32R version.
+   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.  */
+
+/* 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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/mman.h uClibc/libc/sysdeps/linux/m32r/bits/mman.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/mman.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/mman.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,93 @@
+/* Definitions for POSIX memory map interface.  Linux/M32R version.
+   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.  */
+
+#ifndef _SYS_MMAN_H
+# error "Never include this file directly.  Use <sys/mman.h> instead"
+#endif
+
+/* The following definitions basically come from the kernel headers.
+   But the kernel header is not namespace clean.  */
+
+
+/* Protections are chosen from these bits, OR'd together.  The
+   implementation does not necessarily support PROT_EXEC or PROT_WRITE
+   without PROT_READ.  The only guarantees are that no writing will be
+   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
+
+#define PROT_READ	0x1		/* Page can be read.  */
+#define PROT_WRITE	0x2		/* Page can be written.  */
+#define PROT_EXEC	0x4		/* Page can be executed.  */
+#define PROT_NONE	0x0		/* Page can not be accessed.  */
+
+/* Sharing types (must choose one and only one of these).  */
+#define MAP_SHARED	0x01		/* Share changes.  */
+#define MAP_PRIVATE	0x02		/* Changes are private.  */
+#ifdef __USE_MISC
+# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
+#endif
+
+/* Other flags.  */
+#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
+#ifdef __USE_MISC
+# define MAP_FILE	0
+# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
+# define MAP_ANON	MAP_ANONYMOUS
+#endif
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x0800		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x2000		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x4000		/* Don't check for reservations.  */
+#endif
+
+/* Flags to `msync'.  */
+#define MS_ASYNC	1		/* Sync memory asynchronously.  */
+#define MS_SYNC		4		/* Synchronous memory sync.  */
+#define MS_INVALIDATE	2		/* Invalidate the caches.  */
+
+/* Flags for `mlockall'.  */
+#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
+#define MCL_FUTURE	2		/* Lock all additions to address
+					   space.  */
+
+/* Flags for `mremap'.  */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE	1
+#endif
+
+/* Advice to `madvise'.  */
+#ifdef __USE_BSD
+# define MADV_NORMAL	 0	/* No further special treatment.  */
+# define MADV_RANDOM	 1	/* Expect random page references.  */
+# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
+# define MADV_WILLNEED	 3	/* Will need these pages.  */
+# define MADV_DONTNEED	 4	/* Don't need these pages.  */
+#endif
+
+/* The POSIX people had to invent similar names for the same things.  */
+#ifdef __USE_XOPEN2K
+# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
+# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
+# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
+# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
+# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
+#endif
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/profil-counter.h uClibc/libc/sysdeps/linux/m32r/bits/profil-counter.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/profil-counter.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/profil-counter.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,29 @@
+/* Low-level statistical profiling support function.  Linux/M32R version.
+   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 <signal.h>
+#include <bits/sigcontextinfo.h>
+
+static void
+profil_counter (int signo, SIGCONTEXT sc)
+{
+  void *pc;
+  pc = GET_PC(sc);
+  profil_count (pc);
+}
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/resource.h uClibc/libc/sysdeps/linux/m32r/bits/resource.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/resource.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/resource.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,209 @@
+/* Bit values & structures for resource limits.  Linux/M32R version.
+   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.  */
+
+#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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/setjmp.h uClibc/libc/sysdeps/linux/m32r/bits/setjmp.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/setjmp.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/setjmp.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,51 @@
+/* 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.  */
+
+/* Define the machine-dependent type `jmp_buf'.  M32R version. */
+
+#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])
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/sigcontextinfo.h uClibc/libc/sysdeps/linux/m32r/bits/sigcontextinfo.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/sigcontextinfo.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/sigcontextinfo.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,26 @@
+/* Copyright (C) 2003 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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/syscalls.h uClibc/libc/sysdeps/linux/m32r/bits/syscalls.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/syscalls.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/syscalls.h	2005-02-16 13:33:34.000000000 +0900
@@ -0,0 +1,17 @@
+#ifndef _BITS_SYSCALLS_H
+#define _BITS_SYSCALLS_H
+#ifndef _SYSCALL_H
+# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
+#endif
+
+/* Do something very evil for now.  Until we create our own syscall
+ * macros, short circuit bits/sysnum.h  and use asm/unistd.h instead */
+#include <asm/unistd.h>
+
+/* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel
+ * header files.  It also defines the traditional `SYS_<name>' macros for older
+ * programs.  */
+#include <bits/sysnum.h>
+
+#endif /* _BITS_SYSCALLS_H */
+
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bits/wordsize.h uClibc/libc/sysdeps/linux/m32r/bits/wordsize.h
--- uClibc.org/libc/sysdeps/linux/m32r/bits/wordsize.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bits/wordsize.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,19 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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.  */
+
+#define __WORDSIZE	32
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/bp-sym.h uClibc/libc/sysdeps/linux/m32r/bp-sym.h
--- uClibc.org/libc/sysdeps/linux/m32r/bp-sym.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/bp-sym.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,26 @@
+/* Bounded-pointer symbol modifier.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Greg McGary <greg@mcgary.org>
+
+   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.  */
+
+#define BP_SYM(name) _BP_SYM (name)
+#if __BOUNDED_POINTERS__
+# define _BP_SYM(name) __BP_##name
+#else
+# define _BP_SYM(name) name
+#endif
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/brk.c uClibc/libc/sysdeps/linux/m32r/brk.c
--- uClibc.org/libc/sysdeps/linux/m32r/brk.c	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/brk.c	2005-11-23 11:22:47.000000000 +0900
@@ -0,0 +1,49 @@
+/* brk system call for Linux/M32R.
+   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 <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+/* This must be initialized data because commons can't have aliases.  */
+void *___brk_addr = 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 || nop\n\t"
+		"mv %0,r0\n"
+		: "=r"(newbrk) 
+		: "r" (r7), "r" (r0)
+		);
+
+  ___brk_addr = newbrk;
+
+  if (newbrk < addr)
+    {
+      __set_errno (ENOMEM);
+      return -1;
+    }
+
+  return 0;
+}
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/clone.S uClibc/libc/sysdeps/linux/m32r/clone.S
--- uClibc.org/libc/sysdeps/linux/m32r/clone.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/clone.S	2005-03-22 14:33:17.000000000 +0900
@@ -0,0 +1,109 @@
+/* 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.  */
+
+/* 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
+#ifdef __PIC__
+	push	r12
+	push	lr
+	bl.s	.+4
+	ld24	r12, #_GLOBAL_OFFSET_TABLE_
+	add	r12, lr
+	bl	PLTJMP(C_SYMBOL_NAME(syscall_error))
+	pop	lr
+	pop	r12
+	ret
+#else
+	LDIMM	(r1, C_SYMBOL_NAME(syscall_error))
+	jmp	r1
+#endif
+	.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
+
+#ifdef __PIC__
+	push	r12
+	push	lr
+	bl.s	.+4
+	ld24	r12, #_GLOBAL_OFFSET_TABLE_
+	add	r12, lr
+	bl	PLTJMP(C_SYMBOL_NAME(__syscall_error))
+	pop	lr
+	pop	r12
+	ret
+#else
+	LDIMM	(r1, C_SYMBOL_NAME(__syscall_error))
+	jmp	r1
+#endif
+	.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  */
+#ifdef __PIC__
+	push	r12
+	push	lr
+	bl.s	.+4
+	ld24	r12, #_GLOBAL_OFFSET_TABLE_
+	add	r12, lr
+	bl	PLTJMP(C_SYMBOL_NAME(_exit))
+	pop	lr
+	pop	r12
+	ret
+#else
+	LDIMM	(r1, C_SYMBOL_NAME(_exit))
+	jmp	r1
+#endif
+PSEUDO_END (__clone)
+
+	.global clone
+	clone = __clone
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/crt0.S uClibc/libc/sysdeps/linux/m32r/crt0.S
--- uClibc.org/libc/sysdeps/linux/m32r/crt0.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/crt0.S	2005-03-02 13:19:50.000000000 +0900
@@ -0,0 +1,83 @@
+/* Startup code for M32R & ELF.
+   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.  */
+
+/* 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	r0		; argc
+	mv	r1, sp		; argv
+	add3	r2, r0, #1	; argc+1
+	slli	r2, #2		; *4
+	add	r2, r1		; envp
+
+	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
+
+	/* Let the libc call main and exit with its return code.  */
+#if !defined(__PIC__)
+	LDIMM	(r4, BP_SYM (__uClibc_main))
+	jl	r4
+#else
+	bl BP_SYM (__uClibc_main)
+#endif
+	/* should never get here....*/
+#if !defined(__PIC__)
+	LDIMM	(r4, abort)
+	jl	r4
+#else
+	bl abort
+#endif
+
+/* 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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/crt0.c uClibc/libc/sysdeps/linux/m32r/crt0.c
--- uClibc.org/libc/sysdeps/linux/m32r/crt0.c	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/crt0.c	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,43 @@
+/* vi: set sw=4 ts=4: */
+/* uClibc/sysdeps/linux/m32r/crt0.S
+ * Pull stuff off the stack and get uClibc moving.
+ *
+ * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Stick in a dummy reference to main(), so that if an application
+ * is linking when the main() function is in a static library (.a)
+ * we can be sure that main() actually gets linked in */
+extern void main(int argc,void *argv,void *envp);
+void (*mainp)(int argc,void *argv,void *envp) = main;
+
+extern void __uClibc_main(int argc,void *argv,void *envp);
+
+void _start(unsigned int first_arg)
+{
+	unsigned int argc;
+	char **argv, **envp;
+	unsigned long *stack;
+
+	stack = (unsigned long*) &first_arg;
+	argc = *(stack - 1);
+	argv = (char **) stack;
+	envp = (char **)stack + argc + 1;
+
+	__uClibc_main(argc, argv, envp);
+}
+
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/crti.S uClibc/libc/sysdeps/linux/m32r/crti.S
--- uClibc.org/libc/sysdeps/linux/m32r/crti.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/crti.S	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,60 @@
+	
+#include "defs.h"
+	
+/*@HEADER_ENDS*/
+/*@_init_PROLOG_BEGINS*/
+	.balign 4
+	.type	call_gmon_start,@function
+call_gmon_start:
+	; PROLOGUE, vars= 0, regs= 2, args= 0, extra= 0
+	ld24 r4,#__gmon_start__
+	push r12
+	push lr
+	bl.s .+4
+	ld24 r12,#_GLOBAL_OFFSET_TABLE_
+	add r12,lr
+	add r4,r12
+	ld r4,@(r4)
+	beqz r4,.L3
+	jl r4
+	.balign 4
+.L3:
+	; EPILOGUE
+	pop lr
+	pop r12
+	jmp lr
+	.section .init
+	.balign 4
+	.global	_init
+	.type	_init,@function
+_init:
+	; PROLOGUE, vars= 0, regs= 2, args= 0, extra= 0
+	push r12
+	push lr
+	bl.s .+4
+	ld24 r12,#_GLOBAL_OFFSET_TABLE_
+	add r12,lr
+	bl call_gmon_start
+	ALIGN
+	END_INIT
+	
+/*@_init_PROLOG_ENDS*/
+/*@_fini_PROLOG_BEGINS*/
+	.section .fini
+	.balign 4
+	.global	_fini
+	.type	_fini,@function
+_fini:
+	; PROLOGUE, vars= 0, regs= 2, args= 0, extra= 0
+	push r12
+	push lr
+	bl.s .+4
+	ld24 r12,#_GLOBAL_OFFSET_TABLE_
+	add r12,lr
+	ALIGN
+	END_FINI
+	
+/*@_fini_PROLOG_ENDS*/
+/*@TRAILER_BEGINS*/
+	.weak	__gmon_start__
+	.ident	"GCC: (GNU) 3.2.3 m32r-20031120"
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/crtn.S uClibc/libc/sysdeps/linux/m32r/crtn.S
--- uClibc.org/libc/sysdeps/linux/m32r/crtn.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/crtn.S	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,25 @@
+	
+#include "defs.h"
+	
+/*@HEADER_ENDS*/
+/*@_init_EPILOG_BEGINS*/
+	.section .init
+	; EPILOGUE
+	pop lr
+	pop r12
+	jmp lr
+	END_INIT
+	
+/*@_init_EPILOG_ENDS*/
+/*@_fini_EPILOG_BEGINS*/
+	.section .fini
+	; EPILOGUE
+	pop lr
+	pop r12
+	jmp lr
+	END_FINI
+	
+/*@_fini_EPILOG_ENDS*/
+/*@TRAILER_BEGINS*/
+	.weak	__gmon_start__
+	.ident	"GCC: (GNU) 3.2.3 m32r-20031120"
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/defs.h uClibc/libc/sysdeps/linux/m32r/defs.h
--- uClibc.org/libc/sysdeps/linux/m32r/defs.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/defs.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,4 @@
+#define END_INIT
+#define END_FINI
+#define ALIGN
+weak_extern (__gmon_start__)
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/fork.c uClibc/libc/sysdeps/linux/m32r/fork.c
--- uClibc.org/libc/sysdeps/linux/m32r/fork.c	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/fork.c	2005-02-23 19:34:31.000000000 +0900
@@ -0,0 +1,3 @@
+#ifdef __ARCH_HAS_MMU__
+#include "../common/fork.c"
+#endif
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/mmap.S uClibc/libc/sysdeps/linux/m32r/mmap.S
--- uClibc.org/libc/sysdeps/linux/m32r/mmap.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/mmap.S	2005-02-16 15:13:20.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.  */
+
+#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	mmap
+	mmap = __mmap
+
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/pt-machine.h uClibc/libc/sysdeps/linux/m32r/pt-machine.h
--- uClibc.org/libc/sysdeps/linux/m32r/pt-machine.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/pt-machine.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,51 @@
+/* Machine-dependent pthreads configuration and inline functions.
+   M32R version.
+   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 <errno.h>
+#include <sysdep.h>
+
+typedef int __atomic_lock_t;
+extern int try_lock(__atomic_lock_t *spinlock);
+#define testandset(p) try_lock(p)
+
+#ifndef PT_EI
+# define PT_EI extern inline
+#endif
+
+/* Spnlock implementation; required.  */
+PT_EI int
+try_lock (__atomic_lock_t *spinlock)
+{
+#if 1
+  int ret;
+
+  ret = INLINE_SYSCALL (tas, 1, spinlock);
+  return ret;
+#else
+return 0;
+#endif
+}
+
+#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");
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/setjmp.S uClibc/libc/sysdeps/linux/m32r/setjmp.S
--- uClibc.org/libc/sysdeps/linux/m32r/setjmp.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/setjmp.S	2005-03-10 10:02:10.000000000 +0900
@@ -0,0 +1,62 @@
+/* setjmp for M32R.
+   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>
+#define _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+
+ENTRY (_setjmp)
+	ldi	r1, #0
+	bra	__sigsetjmp
+
+ENTRY (setjmp)
+	ldi	r1, #1
+
+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 __PIC__
+	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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/sigaction.c uClibc/libc/sysdeps/linux/m32r/sigaction.c
--- uClibc.org/libc/sysdeps/linux/m32r/sigaction.c	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/sigaction.c	2005-11-23 11:29:27.000000000 +0900
@@ -0,0 +1,89 @@
+/* POSIX.1 `sigaction' call for Linux/M32R.
+   Copyright (C) 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 <errno.h>
+#include <signal.h>
+#include <string.h>
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* The difference here is that the sigaction structure used in the
+   kernel is not the same as we use in the libc.  Therefore we must
+   translate it here.  */
+#include <bits/kernel_sigaction.h>
+
+/* We do not globally define the SA_RESTORER flag so do it here.  */
+#define SA_RESTORER 0x04000000
+
+/* Using the hidden attribute here does not change the code but it
+   helps to avoid warnings.  */
+static void restore_rt (void) asm ("__restore_rt");
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+   If OACT is not NULL, put the old action for SIG in *OACT.  */
+int
+__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
+{
+  int result;
+  struct kernel_sigaction kact, koact;
+
+  if (act)
+    {
+      kact.k_sa_handler = act->sa_handler;
+      memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
+      kact.sa_flags = act->sa_flags | SA_RESTORER;
+
+      kact.sa_restorer = &restore_rt;
+
+    }
+
+  /* XXX The size argument hopefully will have to be changed to the
+     real size of the user-level sigset_t.  */
+  result = INLINE_SYSCALL (rt_sigaction, 4, sig,
+		  	   act ? __ptrvalue (&kact) : NULL,
+			   oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
+  if (oact && result >= 0)
+    {
+      oact->sa_handler = koact.k_sa_handler;
+      memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
+      oact->sa_flags = koact.sa_flags;
+      oact->sa_restorer = koact.sa_restorer;
+    }
+  return result;
+}
+weak_alias (__libc_sigaction, sigaction)
+
+/* NOTE: Please think twice before making any changes to the bits of
+   code below.  GDB needs some intimate knowledge about it to
+   recognize them as signal trampolines, and make backtraces through
+   signal handlers work right.  Important are both the names
+   (__restore_rt) and the exact instruction sequence.
+   If you ever feel the need to make any changes, please notify the
+   appropriate GDB maintainer.  */
+
+#define RESTORE(name, syscall) RESTORE2 (name, syscall)
+# define RESTORE2(name, syscall) \
+asm						\
+  (						\
+   "__" #name ":\n"				\
+   "	ldi r7,#" #syscall "\n"		\
+   "	trap #2 || nop\n"				\
+   );
+/* The return code for realtime-signals.  */
+RESTORE (restore_rt, __NR_rt_sigreturn)
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/sys/procfs.h uClibc/libc/sysdeps/linux/m32r/sys/procfs.h
--- uClibc.org/libc/sysdeps/linux/m32r/sys/procfs.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/sys/procfs.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,117 @@
+/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU 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_PROCFS_H
+#define _SYS_PROCFS_H	1
+
+/* This is somehow modelled after the file of the same name on SysVr4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  */
+
+#include <features.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <sys/user.h>
+#include <asm/elf.h>
+
+__BEGIN_DECLS
+
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   gdb doesn't really use excluded.  Fields present but not used are
+   marked with "XXX".  */
+struct elf_prstatus
+  {
+#if 0
+    long int pr_flags;			/* XXX Process flags.  */
+    short int pr_why;			/* XXX Reason for process halt.  */
+    short int pr_what;			/* XXX More detailed reason.  */
+#endif
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+#if 0
+    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    struct sigaction pr_action;		/* Signal action for current sig.  */
+#endif
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+#if 0
+    long int pr_instr;			/* Current instruction.  */
+#endif
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    long pr_uid;
+    long pr_gid;
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+
+/* Addresses.  */
+typedef void *psaddr_t;
+
+/* Register sets.  Linux has different names.  */
+typedef gregset_t prgregset_t;
+typedef fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+   therefore habe only ine PID type.  */
+typedef __pid_t lwpid_t;
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/sys/ucontext.h uClibc/libc/sysdeps/linux/m32r/sys/ucontext.h
--- uClibc.org/libc/sysdeps/linux/m32r/sys/ucontext.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/sys/ucontext.h	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,111 @@
+/* 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.  */
+
+/* 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 -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/syscall.c uClibc/libc/sysdeps/linux/m32r/syscall.c
--- uClibc.org/libc/sysdeps/linux/m32r/syscall.c	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/syscall.c	2005-02-15 17:27:05.000000000 +0900
@@ -0,0 +1,25 @@
+
+
+#include <features.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+long syscall(long sysnum,
+			 long arg1, long arg2, long arg3,
+			 long arg4, long arg5, long arg6)
+{
+register long __sc3 __asm__ ("r7") = sysnum;
+register long __sc4 __asm__ ("r0") = (long) arg1;
+register long __sc5 __asm__ ("r1") = (long) arg2;
+register long __sc6 __asm__ ("r2") = (long) arg3;
+register long __sc7 __asm__ ("r3") = (long) arg4;
+register long __sc0 __asm__ ("r4") = (long) arg5;
+register long __sc1 __asm__ ("r5") = (long) arg6;
+__asm__ __volatile__ ("trap	#0x2" \
+	: "=r" (__sc0) \
+	: "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
+	  "r" (__sc3), "r" (__sc1) \
+	: "memory" );
+__syscall_return(long,__sc0);
+}
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/sysdep.S uClibc/libc/sysdeps/linux/m32r/sysdep.S
--- uClibc.org/libc/sysdeps/linux/m32r/sysdep.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/sysdep.S	2005-03-10 10:03:07.000000000 +0900
@@ -0,0 +1,77 @@
+/* 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>
+#define _ERRNO_H
+#include <bits/errno.h>
+
+ENTRY(__syscall_error)
+	neg	r0,r0
+
+#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 __PIC__
+#ifndef __UCLIBC_HAS_THREADS__
+	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 __UCLIBC_HAS_THREADS__
+	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)
+
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/sysdep.h uClibc/libc/sysdeps/linux/m32r/sysdep.h
--- uClibc.org/libc/sysdeps/linux/m32r/sysdep.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/sysdep.h	2005-11-23 11:27:38.000000000 +0900
@@ -0,0 +1,319 @@
+/* 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.  */
+
+#ifndef _SYSDEP_H_
+#define _SYSDEP_H_
+
+#include <sys/syscall.h>
+#include <features.h>
+
+#define	HAVE_SYSCALLS
+
+
+
+/* Note that using a `PASTE' macro loses.  */
+#ifdef	__STDC__
+#define	SYSCALL__(name, args)	PSEUDO (__##name, name, args)
+#else
+#define	SYSCALL__(name, args)	PSEUDO (__/**/name, name, args)
+#endif
+#define	SYSCALL(name, args)	PSEUDO (name, name, args)
+
+/* Terminate a system call named SYM.  This is used on some platforms
+   to generate correct debugging information.  */
+#ifndef PSEUDO_END
+#define PSEUDO_END(sym)
+#endif
+
+/* Wrappers around system calls should normally inline the system call code.
+   But sometimes it is not possible or implemented and we use this code.  */
+#define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args)
+
+
+#ifndef C_LABEL
+
+/* Define a macro we can use to construct the asm name for a C symbol.  */
+#ifdef	__STDC__
+#define C_LABEL(name)		name##:
+#else
+#define C_LABEL(name)		name/**/:
+#endif
+
+#endif
+
+/* Mark the end of function named SYM.  This is used on some platforms
+   to generate correct debugging information.  */
+#ifndef END
+#define END(sym)
+#endif
+
+
+/* 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
+
+/* 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
+
+#define C_SYMBOL_NAME(name) name
+
+#ifdef	__ASSEMBLER__
+
+#define ret	jmp r14
+
+/* The m32r move insn is d, s.  */
+#define MOVE(x,y)	mv y,x
+
+#ifdef __M32R_MEDIUM_MODEL__
+#define LDIMM(reg,x) LDIMM reg x
+	.macro LDIMM reg x
+	seth	\reg, #high(\x)
+	or3	\reg, \reg, #low(\x)
+	.endm
+#else
+#define LDIMM(reg,x) LDIMM reg x
+	.macro LDIMM reg x
+	ld24	\reg, #(\x)
+	.endm
+#endif
+
+/* 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
+
+#else
+
+#define ALIGNARG(log2) log2
+#define ASM_GLOBAL_DIRECTIVE	.globl
+#define ASM_TYPE_DIRECTIVE(name,type)	/* Nothing is specified.  */
+#define ASM_SIZE_DIRECTIVE(name)	/* Nothing is specified.  */
+
+#define PLTJMP(_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))
+
+/* 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 || nop
+#define SYSCALL_INST_0	trap #2 || nop
+#define SYSCALL_INST_1	trap #2 || nop
+#define SYSCALL_INST_2	trap #2 || nop
+#define SYSCALL_INST_3	trap #2 || nop
+#define SYSCALL_INST_4	trap #2 || nop
+#define SYSCALL_INST_4	trap #2 || nop
+#define SYSCALL_INST_5		\
+  ld r4,@sp			! \
+  trap #2 || nop
+#define SYSCALL_INST_6		\
+  ld r4,@sp			! \
+  ld r5,@(4,sp)			! \
+  trap #2 || nop
+#define SYSCALL_INST_7		\
+  ld r4,@sp			! \
+  ld r5,@(4,sp)			! \
+  ld r6,@(8,sp)			! \
+  trap #2 || nop
+
+#undef	DO_CALL
+#define DO_CALL( args, syscall_name )	\
+  ldi r7,SYS_ify(syscall_name)		! \
+  SYSCALL_INST_##args
+
+#undef PSEUDO
+#define	PSEUDO(name, syscall_name, args) \
+  .text								! \
+ENTRY (name)							! \
+  DO_CALL (args, syscall_name)					! \
+  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:
+
+#undef	PSEUDO_END
+#define	PSEUDO_END(name) \
+  END (name)
+
+#ifndef __PIC__
+#define SYSCALL_ERROR_HANDLER \
+   LDIMM (r1, C_SYMBOL_NAME(__syscall_error)) !\
+  jmp r1
+
+#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,#(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 /* not __ASSEMBLER__ */
+
+#define SYSCALL_INST_STR	"trap #2 || nop\n\t"
+
+#define ASMFMT_0
+#define ASMFMT_1 \
+	, "r" (r0)
+#define ASMFMT_2 \
+	, "r" (r0), "r" (r1)
+#define ASMFMT_3 \
+	, "r" (r0), "r" (r1), "r" (r2)
+#define ASMFMT_4 \
+	, "r" (r0), "r" (r1), "r" (r2), "r" (r3)
+#define ASMFMT_5 \
+	, "r" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4)
+#define ASMFMT_6 \
+	, "r" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4), "r" (r5)
+#define ASMFMT_7 \
+	, "r" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4), "r" (r5), "r" (r6)
+
+#define SUBSTITUTE_ARGS_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...) 			\
+  ({								\
+    register unsigned long resultvar;				\
+    register long r7 asm ("r7") = SYS_ify (name);		\
+    SUBSTITUTE_ARGS_##nr(args);					\
+								\
+    asm volatile (SYSCALL_INST_STR "\n\t"			\
+		  "mv %0,r0"					\
+		  : "=r" (resultvar)				\
+		  : "r" (r7) ASMFMT_##nr 			\
+		  : "memory");					\
+								\
+    if (resultvar >= 0xfffff001)			        \
+      {							        \
+	__set_errno (-resultvar);				\
+	resultvar = 0xffffffff;					\
+      }								\
+    (int) resultvar; })
+
+#endif	/* __ASSEMBLER__ */
+
+#endif /* _SYSDEP_H_ */
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/sysdeps/linux/m32r/vfork.S uClibc/libc/sysdeps/linux/m32r/vfork.S
--- uClibc.org/libc/sysdeps/linux/m32r/vfork.S	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libc/sysdeps/linux/m32r/vfork.S	2005-03-10 10:01:34.000000000 +0900
@@ -0,0 +1,63 @@
+/* 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>
+#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.  */
+
+#ifndef __NR_vfork
+#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
+#endif
+
+ENTRY(__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
+
+#ifdef __PIC__
+	push	r12
+	push	lr
+	bl.s	.+4
+        ld24	r12, #_GLOBAL_OFFSET_TABLE_
+	add	r12, lr
+	bl	PLTJMP(C_SYMBOL_NAME(__syscall_error))
+	pop	lr
+	pop	r12
+	ret
+#else
+	LDIMM	(r1, C_SYMBOL_NAME(__syscall_error))
+	jmp	r1
+#endif
+	.fillinsn
+1:
+	ret
+
+PSEUDO_END (__vfork)
+
+	.weak	vfork
+	vfork = __vfork
+	.weak	fork
+	fork = __vfork
diff -uNr --exclude=CVS --exclude=config uClibc.org/libc/unistd/Makefile uClibc/libc/unistd/Makefile
--- uClibc.org/libc/unistd/Makefile	2005-01-25 12:13:53.000000000 +0900
+++ uClibc/libc/unistd/Makefile	2005-03-10 18:29:25.000000000 +0900
@@ -27,8 +27,9 @@
 	fpathconf.c confstr.c pathconf.c swab.c usershell.c \
 	getsubopt.c
 
-ifeq ($(strip $(ARCH_HAS_MMU)),y)
 	CSRC += daemon.c
+ifeq ($(strip $(ARCH_HAS_MMU)),y)
+	#CSRC += daemon.c
 else
 	MOBJ1 += __exec_alloc.o
 endif
diff -uNr --exclude=CVS --exclude=config uClibc.org/libpthread/linuxthreads/sysdeps/m32r/pt-machine.h uClibc/libpthread/linuxthreads/sysdeps/m32r/pt-machine.h
--- uClibc.org/libpthread/linuxthreads/sysdeps/m32r/pt-machine.h	1970-01-01 09:00:00.000000000 +0900
+++ uClibc/libpthread/linuxthreads/sysdeps/m32r/pt-machine.h	2005-02-10 16:13:26.000000000 +0900
@@ -0,0 +1,51 @@
+/* Machine-dependent pthreads configuration and inline functions.
+   M32R version.
+   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 <errno.h>
+#include <sysdep.h>
+
+typedef int __atomic_lock_t;
+extern int try_lock(__atomic_lock_t *spinlock);
+#define testandset(p) try_lock(p)
+
+#ifndef PT_EI
+# define PT_EI extern inline
+#endif
+
+/* Spnlock implementation; required.  */
+PT_EI int
+try_lock (__atomic_lock_t *spinlock)
+{
+#if 1
+  int ret;
+
+  ret = INLINE_SYSCALL (tas, 1, spinlock);
+  return ret;
+#else
+return 0;
+#endif
+}
+
+#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");
