This is the mail archive of the newlib@sourceware.cygnus.com mailing list for the newlib project.


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

RTEMS patch for newlib 1.8.1




Hi,

I have been behind in cleaning up my patch queue.  Attached is the patch
that is distributed with RTEMS for newlib 1.8.1.  I think it has a
ChangeLog entry for each of the changes.

If there are any problems or questions with this patch, feel free to ask.

Thanks.

--joel
Joel Sherrill                    Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/ChangeLog newlib-1.8.1/newlib/ChangeLog
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/ChangeLog	Mon Jun  1 10:51:07 1998
--- newlib-1.8.1/newlib/ChangeLog	Mon Jan 25 15:19:46 1999
***************
*** 1,3 ****
--- 1,53 ----
+ Tue Jan 19 10:18:34 CST 1999   Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+ 
+         * libc/machine/sh/*.S: Most were broken either for SH1 (invalid
+            instructions) or for later tool versions that supported the SH4. 
+  
+ Wed Jan 13 16:43:02 CST 1999   Joel Sherrill <joel@OARcorp.com>
+ 
+         * configure.in: Corrected feature defines.
+         * libc/include/stdio.h: Defined NULL as simple 0.
+         * libc/include/stdlib.h: Defined NULL as simple 0.
+         * libc/include/string.h: Defined NULL as simple 0.
+         * libc/include/sys/stat.h: Added protototype for RTEMS mknod.
+         * libc/include/sys/stat.h: mkfifo() should take const path arg.
+         * libc/include/sys/unistd.h: pathconf() should take const path arg.
+         * libc/include/unistd.h: Enabled usleep(), ftruncate(), and truncate()
+              prototypes for RTEMS.
+         * libc/include/unistd.h: Added defines for _POSIX_JOB_CONTROL,
+              _POSIX_SAVED_IDS, and _POSIX_VERSION for RTEMS.
+         * libc/include/unistd.h: Added defines for _PC_ASYNC_IO,
+              _PC_PRIO_IO, and _PC_SYNC_IO.
+         * libc/include/time.h: Defined NULL as simple 0.
+         * libc/machine/i386/setjmp.h: New file.
+         * libc/machine/i960/Makefile.in: Now builds setjmp.S.
+         * libc/machine/i960/setjmp.S: Commented out .link_pix directive.
+         * libc/posix/rewinddir.c: Fixed to use much simpler implementation.
+         * libc/stdio/tmpnam.c: Always make the returned name usable.
+         * libc/sys/rtems/crt0.c: New version that passes all autoconf tests.
+         * libc/sys/rtems/sys/dirent.h: New file.
+         * libc/sys/rtems/sys/types.h: Added dev_t.
+ 
+ 1998-12-15  Nick Clifton  <nickc@cygnus.com>
+ 
+         * libc/string/memchr.c: Treat 'c' argument as an unsigned byte not
+           a signed int.
+ 
+ Thu Mar 26 08:13:52 CST 1998  Eric Norum <eric@skatter.usask.ca>
+ 
+         * libc/machine/m68k/Makefile.in: Added references to strcpy and strlen.
+         * libc/machine/m68k/strcpy.c: New file.
+         * libc/machine/m68k/strlen.c: New file.
+ 
+ Thu May 21 12:31:38 CDT 1998  Eric Norum <eric@skatter.usask.ca>
+ 
+         * libc/string/strerror.c: Added socket error messages.
+ 
+ 
+ Tue Mar 31 09:55:39 CST 1998  Joel Sherrill <joel@OARcorp.com
+ 
+         * configure.in: Added posix_dir to RTEMS target.
+ 
  Fri May 29 03:04:29 1998  Geoffrey Noer  <noer@cygnus.com>
  
  	* libc/include/sys/fcntl.h: add _close proto for Cygwin32
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/configure.in newlib-1.8.1/newlib/configure.in
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/configure.in	Mon Jun  1 10:51:08 1998
--- newlib-1.8.1/newlib/configure.in	Mon Feb  8 11:21:04 1999
***************
*** 191,196 ****
--- 191,197 ----
  	;;
    *-*-rtems*)			# generic RTEMS support
  	sys_dir=rtems
+ 	posix_dir=posix
  	;;
    a29k-*-*)
  	sys_dir=a29khif
***************
*** 286,292 ****
  #
  #  NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that.
    *-*-rtems*)
! 	target_cflags="${target_cflags} -DHAVE_GETTIMEOFDAY -DMALLOC_PROVIDED -DEXIT_PROVIDED -DMISSING_SYSCALL_NAMES -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED"
  	;;
  # VxWorks supplies its own version of malloc, and the newlib one
  # doesn't work because VxWorks does not have sbrk.
--- 287,293 ----
  #
  #  NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that.
    *-*-rtems*)
! 	target_cflags="${target_cflags} -DHAVE_GETTIMEOFDAY -DMALLOC_PROVIDED -DEXIT_PROVIDED -DMISSING_SYSCALL_NAMES -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_OPENDIR"
  	;;
  # VxWorks supplies its own version of malloc, and the newlib one
  # doesn't work because VxWorks does not have sbrk.
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/stdio.h newlib-1.8.1/newlib/libc/include/stdio.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/stdio.h	Fri May 29 17:02:43 1998
--- newlib-1.8.1/newlib/libc/include/stdio.h	Mon Jan 25 15:19:46 1999
***************
*** 81,87 ****
  #define	_IONBF	2		/* setvbuf should set unbuffered */
  
  #ifndef NULL
! #define	NULL	0L
  #endif
  
  #define	BUFSIZ	1024
--- 81,87 ----
  #define	_IONBF	2		/* setvbuf should set unbuffered */
  
  #ifndef NULL
! #define	NULL	0
  #endif
  
  #define	BUFSIZ	1024
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/stdlib.h newlib-1.8.1/newlib/libc/include/stdlib.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/stdlib.h	Fri May 29 17:02:43 1998
--- newlib-1.8.1/newlib/libc/include/stdlib.h	Mon Jan 25 15:19:46 1999
***************
*** 31,37 ****
  } ldiv_t;
  
  #ifndef NULL
! #define NULL 0L
  #endif
  
  #define EXIT_FAILURE 1
--- 31,37 ----
  } ldiv_t;
  
  #ifndef NULL
! #define NULL 0
  #endif
  
  #define EXIT_FAILURE 1
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/string.h newlib-1.8.1/newlib/libc/include/string.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/string.h	Fri May 29 17:02:43 1998
--- newlib-1.8.1/newlib/libc/include/string.h	Mon Jan 25 15:19:46 1999
***************
*** 17,23 ****
  #include <stddef.h>
  
  #ifndef NULL
! #define NULL 0L
  #endif
  
  _PTR 	 _EXFUN(memchr,(const _PTR, int, size_t));
--- 17,23 ----
  #include <stddef.h>
  
  #ifndef NULL
! #define NULL 0
  #endif
  
  _PTR 	 _EXFUN(memchr,(const _PTR, int, size_t));
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/sys/stat.h newlib-1.8.1/newlib/libc/include/sys/stat.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/sys/stat.h	Fri May 29 17:02:45 1998
--- newlib-1.8.1/newlib/libc/include/sys/stat.h	Mon Jan 25 15:19:46 1999
***************
*** 120,128 ****
  int     _EXFUN(fchmod,(int _fd, mode_t _mode));
  int	_EXFUN(fstat,( int _fd, struct stat *_sbuf ));
  int	_EXFUN(mkdir,( const char *_path, mode_t _mode ));
! int	_EXFUN(mkfifo,( char *_path, mode_t _mode ));
  int	_EXFUN(stat,( const char *_path, struct stat *_sbuf ));
  mode_t	_EXFUN(umask,( mode_t _mask ));
  
  /* Provide prototypes for most of the _<systemcall> names that are
     provided in newlib for some compilers.  */
--- 120,132 ----
  int     _EXFUN(fchmod,(int _fd, mode_t _mode));
  int	_EXFUN(fstat,( int _fd, struct stat *_sbuf ));
  int	_EXFUN(mkdir,( const char *_path, mode_t _mode ));
! int	_EXFUN(mkfifo,( const char *_path, mode_t _mode ));
  int	_EXFUN(stat,( const char *_path, struct stat *_sbuf ));
  mode_t	_EXFUN(umask,( mode_t _mask ));
+ 
+ #if defined(__rtems__)
+ int     _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev ));
+ #endif
  
  /* Provide prototypes for most of the _<systemcall> names that are
     provided in newlib for some compilers.  */
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/sys/unistd.h newlib-1.8.1/newlib/libc/include/sys/unistd.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/sys/unistd.h	Fri May 29 17:02:46 1998
--- newlib-1.8.1/newlib/libc/include/sys/unistd.h	Mon Jan 25 15:19:46 1999
***************
*** 52,58 ****
  int     _EXFUN(isatty, (int _fildes ));
  int     _EXFUN(link, (const char *_path1, const char *_path2 ));
  off_t   _EXFUN(lseek, (int _fildes, off_t _offset, int _whence ));
! long    _EXFUN(pathconf, (char *_path, int _name ));
  int     _EXFUN(pause, (void ));
  int     _EXFUN(pipe, (int _fildes[2] ));
  int     _EXFUN(read, (int _fildes, void *_buf, size_t _nbyte ));
--- 52,58 ----
  int     _EXFUN(isatty, (int _fildes ));
  int     _EXFUN(link, (const char *_path1, const char *_path2 ));
  off_t   _EXFUN(lseek, (int _fildes, off_t _offset, int _whence ));
! long    _EXFUN(pathconf, (const char *_path, int _name ));
  int     _EXFUN(pause, (void ));
  int     _EXFUN(pipe, (int _fildes[2] ));
  int     _EXFUN(read, (int _fildes, void *_buf, size_t _nbyte ));
***************
*** 83,89 ****
  int     _EXFUN(_unlink, (const char *_path ));
  int     _EXFUN(_write, (int _fildes, const void *_buf, size_t _nbyte ));
  
! #ifdef __CYGWIN32__
  unsigned _EXFUN(usleep, (unsigned int _useconds ));
  int     _EXFUN(ftruncate, (int fd, off_t length));
  int     _EXFUN(truncate, (const char *, off_t length));
--- 83,89 ----
  int     _EXFUN(_unlink, (const char *_path ));
  int     _EXFUN(_write, (int _fildes, const void *_buf, size_t _nbyte ));
  
! #if defined(__CYGWIN32__) || defined(__rtems__)
  unsigned _EXFUN(usleep, (unsigned int _useconds ));
  int     _EXFUN(ftruncate, (int fd, off_t length));
  int     _EXFUN(truncate, (const char *, off_t length));
***************
*** 101,111 ****
--- 101,127 ----
  # define	SEEK_CUR	1
  # define	SEEK_END	2
  
+ /*
+  *  RTEMS adheres to a later version of POSIX -- 1003.1b.
+  *
+  *  XXX this version string should change.
+  */
+ 
+ #ifdef __rtems__
+ #ifndef _POSIX_JOB_CONTROL
+ # define _POSIX_JOB_CONTROL	1
+ #endif
+ #ifndef _POSIX_SAVED_IDS
+ # define _POSIX_SAVED_IDS	1
+ #endif
+ # define _POSIX_VERSION	199009L
+ #else
  #ifdef __svr4__
  # define _POSIX_JOB_CONTROL	1
  # define _POSIX_SAVED_IDS	1
  # define _POSIX_VERSION	199009L
  #endif
+ #endif
  
  #ifdef __CYGWIN32__
  # define _POSIX_JOB_CONTROL	1
***************
*** 139,144 ****
--- 155,163 ----
  # define	_PC_CHOWN_RESTRICTED	6
  # define	_PC_NO_TRUNC	7
  # define	_PC_VDISABLE	8
+ # define      _PC_ASYNC_IO    9
+ # define      _PC_PRIO_IO     10
+ # define      _PC_SYNC_IO     11
  
  # ifndef	_POSIX_SOURCE
  #  define	MAXNAMLEN	1024
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/time.h newlib-1.8.1/newlib/libc/include/time.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/include/time.h	Fri May 29 17:02:43 1998
--- newlib-1.8.1/newlib/libc/include/time.h	Mon Jan 25 15:19:46 1999
***************
*** 13,19 ****
  #include "_ansi.h"
  
  #ifndef NULL
! #define	NULL	0L
  #endif
  
  #define CLOCKS_PER_SEC 1000		/* Machine dependent */
--- 13,19 ----
  #include "_ansi.h"
  
  #ifndef NULL
! #define	NULL	0
  #endif
  
  #define CLOCKS_PER_SEC 1000		/* Machine dependent */
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/i386/setjmp.h newlib-1.8.1/newlib/libc/machine/i386/setjmp.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/i386/setjmp.h	Wed Dec 31 18:00:00 1969
--- newlib-1.8.1/newlib/libc/machine/i386/setjmp.h	Mon Jan 25 15:19:46 1999
***************
*** 0 ****
--- 1,41 ----
+ /*
+ ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
+ **
+ ** This file is distributed under the terms listed in the document
+ ** "copying.dj", available from DJ Delorie at the address above.
+ ** A copy of "copying.dj" should accompany this file; if not, a copy
+ ** should be available from where this file was obtained.  This file
+ ** may not be distributed without a verbatim copy of "copying.dj".
+ **
+ ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
+ ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+ 
+ #ifndef _SETJMP_H_
+ #define _SETJMP_H_
+ 
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
+ typedef struct {
+   unsigned long eax;
+   unsigned long ebx;
+   unsigned long ecx;
+   unsigned long edx;
+   unsigned long esi;
+   unsigned long edi;
+   unsigned long ebp;
+   unsigned long esp;
+   unsigned long eip;
+ } jmp_buf[1];
+ 
+ extern int setjmp(jmp_buf);
+ extern void longjmp(jmp_buf, int);
+ 
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+ #endif
+ 
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/i960/Makefile.in newlib-1.8.1/newlib/libc/machine/i960/Makefile.in
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/i960/Makefile.in	Fri May 29 17:02:55 1998
--- newlib-1.8.1/newlib/libc/machine/i960/Makefile.in	Mon Jan 25 15:19:46 1999
***************
*** 25,31 ****
  #### Host, target, and site specific Makefile fragments come in here.
  ###
  
! OFILES=\
  
  
  all: lib.a
--- 25,36 ----
  #### Host, target, and site specific Makefile fragments come in here.
  ###
  
! # Eventually these all should be made to work
! #OFILES = memccpy.o memchr.o memcmp.o memcpy.o memset.o setjmp.o strchr.o \
! #strcmp.o strcpy.o strcspn.o strdup.o strlen.o strncat.o strncmp.o \
! #strncpy.o strpbrk.o strrchr.o
! 
! OFILES=setjmp.o
  
  
  all: lib.a
***************
*** 43,45 ****
--- 48,52 ----
  
  Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag)
  	$(SHELL) config.status
+ 
+ 
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/i960/setjmp.S newlib-1.8.1/newlib/libc/machine/i960/setjmp.S
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/i960/setjmp.S	Fri May 29 17:02:56 1998
--- newlib-1.8.1/newlib/libc/machine/i960/setjmp.S	Mon Jan 25 15:19:46 1999
***************
*** 35,41 ****
  /******************************************************************************/
  	.file "setjmp.as"
  	.text
! 	.link_pix
  
  	.align	4
  	.globl	_setjmp
--- 35,41 ----
  /******************************************************************************/
  	.file "setjmp.as"
  	.text
! 	/* .link_pix */
  
  	.align	4
  	.globl	_setjmp
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/m68k/Makefile.in newlib-1.8.1/newlib/libc/machine/m68k/Makefile.in
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/m68k/Makefile.in	Fri May 29 17:03:00 1998
--- newlib-1.8.1/newlib/libc/machine/m68k/Makefile.in	Mon Jan 25 15:19:46 1999
***************
*** 27,35 ****
  
  SFILES= setjmp.S
  
! OFILES= setjmp.o
  
! CFILES=
  
  all: lib.a
  lib.a: $(OFILES)
--- 27,35 ----
  
  SFILES= setjmp.S
  
! CFILES= strcpy.c strlen.c
  
! OFILES= setjmp.o strcpy.o strlen.o
  
  all: lib.a
  lib.a: $(OFILES)
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/m68k/strcpy.c newlib-1.8.1/newlib/libc/machine/m68k/strcpy.c
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/m68k/strcpy.c	Wed Dec 31 18:00:00 1969
--- newlib-1.8.1/newlib/libc/machine/m68k/strcpy.c	Mon Jan 25 15:19:46 1999
***************
*** 0 ****
--- 1,36 ----
+ /*
+  *  C library strcpy routine
+  *
+  *  This routine has been optimized for the CPU32+.
+  *  It should run on all 68k machines.
+  *
+  *  W. Eric Norum
+  *  Saskatchewan Accelerator Laboratory
+  *  University of Saskatchewan
+  *  Saskatoon, Saskatchewan, CANADA
+  *  eric@skatter.usask.ca
+  */
+ 
+ #include <string.h>
+ 
+ /*
+  * Copy bytes using CPU32+ loop mode if possible
+  */
+ 
+ char *
+ strcpy (char *to, const char *from)
+ {
+ 	char *pto = to;
+ 	unsigned int n = 0xFFFF;
+ 
+ 	asm volatile ("1:\n"
+ 	     "\tmove.b (%0)+,(%1)+\n"
+ #if defined(__mcpu32__)
+ 	     "\tdbeq %2,1b\n"
+ #endif
+ 	     "\tbne.b 1b\n" :
+ 		"=a" (from), "=a" (pto), "=d" (n) :
+ 		 "0" (from),  "1" (pto), "2" (n) :
+ 		 "cc", "memory");
+ 	return to;
+ }
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/m68k/strlen.c newlib-1.8.1/newlib/libc/machine/m68k/strlen.c
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/m68k/strlen.c	Wed Dec 31 18:00:00 1969
--- newlib-1.8.1/newlib/libc/machine/m68k/strlen.c	Mon Jan 25 15:19:46 1999
***************
*** 0 ****
--- 1,35 ----
+ /*
+  *  C library strlen routine
+  *
+  *  This routine has been optimized for the CPU32+.
+  *  It should run on all 68k machines.
+  *
+  *  W. Eric Norum
+  *  Saskatchewan Accelerator Laboratory
+  *  University of Saskatchewan
+  *  Saskatoon, Saskatchewan, CANADA
+  *  eric@skatter.usask.ca
+  */
+ 
+ #include <string.h>
+ 
+ /*
+  * Test bytes using CPU32+ loop mode if possible.
+  */
+ size_t
+ strlen (const char *str)
+ {
+ 	unsigned int n = ~0;
+ 	const char *cp = str;
+ 
+ 	asm volatile ("1:\n"
+ 	     "\ttst.b (%0)+\n"
+ #if defined(__mcpu32__)
+ 	     "\tdbeq %1,1b\n"
+ #endif
+ 	     "\tbne.b 1b\n" :
+ 		"=a" (cp), "=d" (n) :
+ 		 "0" (cp),  "1" (n) :
+ 		 "cc");
+ 	return (cp - str) - 1;
+ }
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/sh/memcpy.S newlib-1.8.1/newlib/libc/machine/sh/memcpy.S
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/sh/memcpy.S	Fri May 29 17:03:05 1998
--- newlib-1.8.1/newlib/libc/machine/sh/memcpy.S	Mon Jan 25 15:19:46 1999
***************
*** 33,39 ****
  
  #include "asm.h"
  #if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \
!      || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__)
  #define DELAYED_BRANCHES
  #define SL(branch, dest, in_slot, in_slot_arg2) \
  	branch##.s dest; in_slot, in_slot_arg2
--- 33,40 ----
  
  #include "asm.h"
  #if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \
!      || defined (__SH4__)) || defined(__SH4_SINGLE__) \
!      || defined(__SH4_SINGLE_ONLY__)
  #define DELAYED_BRANCHES
  #define SL(branch, dest, in_slot, in_slot_arg2) \
  	branch##.s dest; in_slot, in_slot_arg2
***************
*** 141,148 ****
  	sub r4,r5
  	mov #11,r1
  	cmp/hs r1,r6
! 	SL(bf, L_small,
! 	add #-1,r5)
  	mov r5,r3
  	add r0,r3
  	shlr r3
--- 142,148 ----
  	sub r4,r5
  	mov #11,r1
  	cmp/hs r1,r6
! 	SL(bf, L_small,	add #-1,r5)
  	mov r5,r3
  	add r0,r3
  	shlr r3
***************
*** 154,161 ****
  L_even:
  	tst #1,r0
  	add #-1,r5
! 	SL(bf, L_odddst,
! 	add #8,r7)
  	tst #2,r0
  	bt L_al4dst
  	add #-1,r3
--- 154,160 ----
  L_even:
  	tst #1,r0
  	add #-1,r5
! 	SL(bf, L_odddst, add #8,r7)
  	tst #2,r0
  	bt L_al4dst
  	add #-1,r3
***************
*** 188,195 ****
  L_al4both_loop:
  	mov.l @(r0,r5),r1
  	cmp/hs r7,r0
! 	SL(bt, L_al4both_loop,
! 	mov.l r1,@-r0)
  	bra L_cleanup
  	add #3,r5
  
--- 187,193 ----
  L_al4both_loop:
  	mov.l @(r0,r5),r1
  	cmp/hs r7,r0
! 	SL(bt, L_al4both_loop, mov.l r1,@-r0)
  	bra L_cleanup
  	add #3,r5
  
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/sh/memset.S newlib-1.8.1/newlib/libc/machine/sh/memset.S
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/machine/sh/memset.S	Fri May 29 17:03:05 1998
--- newlib-1.8.1/newlib/libc/machine/sh/memset.S	Mon Jan 25 15:19:46 1999
***************
*** 12,17 ****
--- 12,29 ----
  
  #include "asm.h"
  
+ #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) \
+      || defined(__SH4__) || defined(__SH4_SINGLE_) \
+      || defined(__SH4_SINGLE_ONLY__)
+ #define DT(reg)	\
+ 	dt	reg
+ #else
+ #define MINUSONE	#-1
+ #define DT(reg)	\
+ 	add MINUSONE,reg ; \
+ 	tst reg,reg ;
+ #endif
+ 
  ENTRY(memset)
  	mov	r4,r3	! Save return value
  	
***************
*** 33,39 ****
  	mov.b	r5,@r4
  	add	#-1,r6
  	add	#1,r4
! 	dt	r0
  	bf	L_align_loop
  
  L_dup_bytes:	
--- 45,51 ----
  	mov.b	r5,@r4
  	add	#-1,r6
  	add	#1,r4
! 	DT(r0)
  	bf	L_align_loop
  
  L_dup_bytes:	
***************
*** 50,56 ****
  	.balignw 4,0x0009
  L_store_long_loop:
  	mov.l	r5,@r4	! Store double longs to memory
! 	dt	r2
  	mov.l	r5,@(4,r4)
  	add	#8,r4
  	bf	L_store_long_loop
--- 62,68 ----
  	.balignw 4,0x0009
  L_store_long_loop:
  	mov.l	r5,@r4	! Store double longs to memory
! 	DT(r2)
  	mov.l	r5,@(4,r4)
  	add	#8,r4
  	bf	L_store_long_loop
***************
*** 63,69 ****
  L_store_byte_loop:
  	mov.b	r5,@r4	! Store bytes to memory
  	add	#1,r4
! 	dt	r6
  	bf	L_store_byte_loop
  
  L_exit:
--- 75,81 ----
  L_store_byte_loop:
  	mov.b	r5,@r4	! Store bytes to memory
  	add	#1,r4
! 	DT(r6)
  	bf	L_store_byte_loop
  
  L_exit:
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/posix/rewinddir.c newlib-1.8.1/newlib/libc/posix/rewinddir.c
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/posix/rewinddir.c	Fri May 29 17:03:12 1998
--- newlib-1.8.1/newlib/libc/posix/rewinddir.c	Mon Jan 25 15:19:46 1999
***************
*** 44,53 ****
--- 44,60 ----
  rewinddir(dirp)
  	DIR *dirp;
  {
+ 	/*
+ 	 *  This "if 0" version does not seem necessary and is too
+ 	 *  complicated.  --joel
+ 	 */
+ #if 0
  	extern long _rewinddir;
  
  	_seekdir((dirp), _rewinddir);
  	_rewinddir = telldir(dirp);
+ #endif
+ 	_seekdir((dirp), (off_t)0);
  }
  
  #endif /* ! HAVE_OPENDIR */
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/stdio/tmpnam.c newlib-1.8.1/newlib/libc/stdio/tmpnam.c
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/stdio/tmpnam.c	Fri May 29 17:03:21 1998
--- newlib-1.8.1/newlib/libc/stdio/tmpnam.c	Tue Feb  9 11:44:01 1999
***************
*** 125,131 ****
  	{
  	  if (ptr->_errno == ENOSYS)
  	    {
! 	      result[0] = '0';
  	      return 0;
  	    }
  	  break;
--- 125,131 ----
  	{
  	  if (ptr->_errno == ENOSYS)
  	    {
! 	      result[0] = '\0';
  	      return 0;
  	    }
  	  break;
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/stdlib/mallocr.c newlib-1.8.1/newlib/libc/stdlib/mallocr.c
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/stdlib/mallocr.c	Fri May 29 17:03:30 1998
--- newlib-1.8.1/newlib/libc/stdlib/mallocr.c	Tue Feb 23 13:50:02 1999
***************
*** 1,3 ****
--- 1,8 ----
+ #ifdef MALLOC_PROVIDED
+ 
+ int _dummy_malloc = 1;
+ 
+ #else
  /* ---------- To make a malloc.h, start cutting here ------------ */
  
  /* 
***************
*** 3579,3581 ****
--- 3584,3587 ----
           structure of old version,  but most details differ.)
  
  */
+ #endif
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/string/memchr.c newlib-1.8.1/newlib/libc/string/memchr.c
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/string/memchr.c	Fri May 29 17:03:35 1998
--- newlib-1.8.1/newlib/libc/string/memchr.c	Mon Jan 25 15:19:46 1999
***************
*** 74,79 ****
--- 74,81 ----
  #ifdef PREFER_SIZE_OVER_SPEED
    _CONST unsigned char *src = (_CONST unsigned char *) src_void;
  
+   c &= 0xff;
+ 
    while (length--)
      {
        if (*src == c)
***************
*** 87,92 ****
--- 89,96 ----
    unsigned long  buffer;
    unsigned long  mask;
    int i, j;
+ 
+   c &= 0xff;
  
    /* If the size is small, or src is unaligned, then 
       use the bytewise loop.  We can hope this is rare.  */
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/string/strerror.c newlib-1.8.1/newlib/libc/string/strerror.c
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/string/strerror.c	Fri May 29 17:03:36 1998
--- newlib-1.8.1/newlib/libc/string/strerror.c	Mon Jan 25 15:19:46 1999
***************
*** 605,610 ****
--- 605,645 ----
        error = "Software caused connection abort";
        break;
  #endif
+ #if (defined(EWOULDBLOCK) && (!defined (EAGAIN) || (EWOULDBLOCK != EAGAIN)))
+     case EWOULDBLOCK:
+ 	error = "Operation would block";
+         break;
+ #endif
+ #ifdef ENOTCONN
+     case ENOTCONN:
+ 	error = "Socket is not connected";
+         break;
+ #endif
+ #ifdef ESOCKTNOSUPPORT
+     case ESOCKTNOSUPPORT:
+ 	error = "Socket type not supported";
+         break;
+ #endif
+ #ifdef EISCONN
+     case EISCONN:
+ 	error = "Socket is already connected";
+         break;
+ #endif
+ #ifdef EOPNOTSUPP
+     case EOPNOTSUPP:
+ 	error = "Operation not supported on socket";
+         break;
+ #endif
+ #ifdef EMSGSIZE
+     case EMSGSIZE:
+ 	error = "Message too long";
+         break;
+ #endif
+ #ifdef ETIMEDOUT
+     case ETIMEDOUT:
+ 	error = "Connection timed out";
+         break;
+ #endif
      default:
        if ((error = _user_strerror (errnum)) == 0)
  	error = "";
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/sys/rtems/crt0.c newlib-1.8.1/newlib/libc/sys/rtems/crt0.c
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/sys/rtems/crt0.c	Fri May 29 17:04:17 1998
--- newlib-1.8.1/newlib/libc/sys/rtems/crt0.c	Mon Jan 25 15:19:46 1999
***************
*** 1 ****
--- 1,44 ----
  void rtems_provides_crt0( void ) {}
+ /*
+  *  RTEMS Fake crt0
+  *
+  *  Each RTEMS BSP provides its own crt0 and linker script.  Unfortunately
+  *  this means that crt0 and the linker script are not available as
+  *  each tool is configured.  Without a crt0 and linker script, some
+  *  targets do not successfully link "conftest.c" during the configuration 
+  *  process.  So this fake crt0.c provides all the symbols required to
+  *  successfully link a program.  The resulting program will not run
+  *  but this is enough to satisfy the autoconf macro AC_PROG_CC.
+  */
+ 
+ /* RTEMS provides some of its own routines including a Malloc family */
+ 
+ void *malloc() { return 0; }
+ void *realloc() { return 0; }
+ void free() { ; }
+  
+ /* The PowerPC expects certain symbols to be defined in the linker script. */
+ 
+ #if defined(__PPC__)
+   int __SDATA_START__;  int __SDATA2_START__;
+   int __GOT_START__;    int __GOT_END__;
+   int __GOT2_START__;   int __GOT2_END__;
+   int __SBSS_END__;     int __SBSS2_END__;
+   int __FIXUP_START__;  int __FIXUP_END__;
+   int __EXCEPT_START__; int __EXCEPT_END__;
+   int __init;           int __fini;
+ #endif
+ 
+ /*  The hppa expects this to be defined in the real crt0.s. 
+  *  Also for some reason, the hppa1.1 does not find atexit()
+  *  during the AC_PROG_CC tests.
+  */
+ 
+ #if defined(__hppa__)
+   asm ( ".subspa \$GLOBAL\$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40");
+   asm ( ".export \$global\$" );
+   asm ( "\$global\$:");
+ 
+   int atexit(void (*function)(void)) { return 0; }
+ #endif
+ 
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/sys/rtems/include/limits.h newlib-1.8.1/newlib/libc/sys/rtems/include/limits.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/sys/rtems/include/limits.h	Fri May 29 17:04:17 1998
--- newlib-1.8.1/newlib/libc/sys/rtems/include/limits.h	Wed Feb 24 15:00:32 1999
***************
*** 35,41 ****
  #define _POSIX_MAX_INPUT        255
  #define _POSIX_MQ_OPEN_MAX      8
  #define _POSIX_MQ_PRIO_MAX      32
! #define _POSIX_NAME_MAX         14
  #define _POSIX_NGROUPS_MAX      0
  #define _POSIX_OPEN_MAX         16
  #define _POSIX_PATH_MAX         255
--- 35,41 ----
  #define _POSIX_MAX_INPUT        255
  #define _POSIX_MQ_OPEN_MAX      8
  #define _POSIX_MQ_PRIO_MAX      32
! #define _POSIX_NAME_MAX         255
  #define _POSIX_NGROUPS_MAX      0
  #define _POSIX_OPEN_MAX         16
  #define _POSIX_PATH_MAX         255
***************
*** 79,85 ****
  #define LINK_MAX                8
  #define MAX_CANON               255
  #define MAX_INPUT               255
! #define NAME_MAX                14
  #define PATH_MAX                255
  #define PIPE_BUF                512
  
--- 79,85 ----
  #define LINK_MAX                8
  #define MAX_CANON               255
  #define MAX_INPUT               255
! #define NAME_MAX                255
  #define PATH_MAX                255
  #define PIPE_BUF                512
  
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/sys/rtems/sys/dirent.h newlib-1.8.1/newlib/libc/sys/rtems/sys/dirent.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/sys/rtems/sys/dirent.h	Wed Dec 31 18:00:00 1969
--- newlib-1.8.1/newlib/libc/sys/rtems/sys/dirent.h	Mon Jan 25 15:19:46 1999
***************
*** 0 ****
--- 1,45 ----
+ #ifndef _SYS_DIRENT_H
+ # define _SYS_DIRENT_H
+ 
+ /*
+  * This file was written to be compatible with the BSD directory
+  * routines, so it looks like it.  But it was written from scratch.
+  * Sean Eric Fagan, sef@Kithrup.COM
+  *
+  *  Copied to RTEMS configuration without modification.
+  */
+ 
+ typedef struct _dirdesc {
+ 	int	dd_fd;
+ 	long	dd_loc;
+ 	long	dd_size;
+ 	char	*dd_buf;
+ 	int	dd_len;
+ 	long	dd_seek;
+ } DIR;
+ 
+ # define __dirfd(dp)	((dp)->dd_fd)
+ 
+ DIR *opendir(const char *);
+ struct dirent *readdir(DIR *);
+ void rewinddir(DIR *);
+ int closedir(DIR *);
+ void seekdir(DIR *dir, long loc);
+ long telldir(DIR *dir);
+ 
+ #include <sys/types.h>
+ 
+ #include <limits.h>
+ 
+ struct dirent {
+ 	long	d_ino;
+ 	off_t	d_off;
+ 	unsigned short	d_reclen;
+ 	/* we need better syntax for variable-sized arrays */
+ 	unsigned short	d_namlen;
+ 	char		d_name[NAME_MAX + 1];
+ };
+ 
+ 
+ 
+ #endif
diff -N -P -r -c /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/sys/rtems/sys/types.h newlib-1.8.1/newlib/libc/sys/rtems/sys/types.h
*** /usr1/rtems/work/original/newlib-1.8.1/newlib/libc/sys/rtems/sys/types.h	Fri May 29 17:04:18 1998
--- newlib-1.8.1/newlib/libc/sys/rtems/sys/types.h	Mon Jan 25 15:19:46 1999
***************
*** 52,58 ****
  #endif
  #endif
  
! typedef short dev_t;             /* device numbers */
  typedef long  off_t;             /* file sizes */
   
  typedef unsigned short uid_t;    /* user IDs */
--- 52,58 ----
  #endif
  #endif
  
! typedef unsigned long long dev_t;/* device numbers 32-bit major and minor */
  typedef long  off_t;             /* file sizes */
   
  typedef unsigned short uid_t;    /* user IDs */