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] |
The RTEMS newlib 1.8.0 patch includes a fix for this. I have attached the entire patch. I have not yet generated a patch for 1.8.1. I hope it helps. --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 (205) 722-9985 On Sun, 5 Jul 1998, Jens Decker wrote: > Hello! > > I've compiled newlib-1.8.1 for use with a SH-7032 board (SH-1 cpu kernel): > > ./configure -v --target=sh-coff --prefix=/usr/local/sh-coff > --host=i586-unknown-linux --norecursion > > Debugging some initial test programs (I'm not very experienced with gcc > used for embedded systems) I got illegal opcode messages and found that > memset.S from newlib/libc/machine/sh indeed uses dt <reg> commands which > are only available for SH-2 and better cpu kernels. > > My workaround was a substitution of the dt opcodes: > > ! > ! Fast SH memset > ! > ! by Toshiyasu Morita (tm@netcom.com) > ! > ! Entry: r4: destination pointer > ! r5: fill value > ! r6: byte count > ! > ! Exit: r0-r3: trashed > ! > > #include "asm.h" > > ENTRY(memset) > mov r4,r3 ! Save return value > > mov r6,r0 ! Check explicitly for zero > cmp/eq #0,r0 > bt L_exit > > mov #12,r0 ! Check for small number of bytes > cmp/gt r6,r0 > bt L_store_byte_loop > > neg r4,r0 ! Align destination > add #4,r0 > and #3,r0 > tst r0,r0 > bt L_dup_bytes > .balignw 4,0x0009 > L_align_loop: > mov.b r5,@r4 > add #-1,r6 > add #1,r4 > add #-1,r0 ! Substitute for dt r0 > cmp/eq #0,r0 ! Substitute for dt r0 > bf L_align_loop > > L_dup_bytes: > extu.b r5,r5 ! Duplicate bytes across longword > swap.b r5,r0 > or r0,r5 > swap.w r5,r0 > or r0,r5 > > mov r6,r2 ! Calculate number of double longwords > shlr2 r2 > shlr r2 > > .balignw 4,0x0009 > L_store_long_loop: > mov.l r5,@r4 ! Store double longs to memory > add #-1,r2 ! Substitute for dt r2 > tst r2,r2 ! Substitute for dt r2 > mov.l r5,@(4,r4) > add #8,r4 > bf L_store_long_loop > > mov #7,r0 > and r0,r6 > tst r6,r6 > bt L_exit > .balignw 4,0x0009 > L_store_byte_loop: > mov.b r5,@r4 ! Store bytes to memory > add #1,r4 > add #-1,r6 ! Substitute for dt r6 > tst r6,r6 ! Substitute for dt r6 > bf L_store_byte_loop > > L_exit: > rts > mov r3,r0 > > Thank you very much for this really good development system! > > Yours, > > Jens Decker > > > -- > > ___________________________________________________________ > > * Jens Decker * > * Universitaet Regensburg * > * Institut fuer Physikalische und Theoretische Chemie * > * Lehrst. Prof. Dick * > * Universitaetstr. 31 * > * 93059 Regensburg * > * * > * Tel: +49-941/943-4473, -4458 Fax: -4488 Room: 22.2.14 * > * Email: Jens.Decker@chemie.uni-regensburg.de * > * WWW (coming up): http:// * > * rchsg41.chemie.uni-regensburg.de/group/Jens.Decker.html * > ___________________________________________________________ >
diff -N -P -r -c newlib-1.8.0.orig/Makefile.in newlib-1.8.0/Makefile.in *** newlib-1.8.0.orig/Makefile.in Mon Jul 14 16:43:37 1997 --- newlib-1.8.0/Makefile.in Tue Mar 10 12:04:01 1998 *************** *** 209,216 **** fi` AS_FOR_TARGET = ` \ ! if [ -f $$r/gas/as.new ] ; then \ ! echo $$r/gas/as.new ; \ else \ if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ echo $(AS); \ --- 209,216 ---- fi` AS_FOR_TARGET = ` \ ! if [ -f $$r/gas/as-new ] ; then \ ! echo $$r/gas/as-new ; \ else \ if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ echo $(AS); \ *************** *** 220,227 **** fi` LD_FOR_TARGET = ` \ ! if [ -f $$r/ld/ld.new ] ; then \ ! echo $$r/ld/ld.new ; \ else \ if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ echo $(LD); \ --- 220,227 ---- fi` LD_FOR_TARGET = ` \ ! if [ -f $$r/ld/ld-new ] ; then \ ! echo $$r/ld/ld-new ; \ else \ if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ echo $(LD); \ *************** *** 264,271 **** fi` NM_FOR_TARGET = ` \ ! if [ -f $$r/binutils/nm.new ] ; then \ ! echo $$r/binutils/nm.new ; \ else \ if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ echo $(NM); \ --- 264,271 ---- fi` NM_FOR_TARGET = ` \ ! if [ -f $$r/binutils/nm-new ] ; then \ ! echo $$r/binutils/nm-new ; \ else \ if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ echo $(NM); \ diff -N -P -r -c newlib-1.8.0.orig/configure.in newlib-1.8.0/configure.in *** newlib-1.8.0.orig/configure.in Mon Jul 14 16:44:27 1997 --- newlib-1.8.0/configure.in Tue Mar 10 12:04:01 1998 *************** *** 397,402 **** --- 397,406 ---- *-*-netware) noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-librx target-newlib target-libiberty target-libgloss" ;; + # This hides the hppa*-*-rtems* below but that one is still informative. + *-*-rtems*) + noconfigdirs="$noconfigdirs target-libgloss" + ;; *-*-vxworks*) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; diff -N -P -r -c newlib-1.8.0.orig/libgloss/configure newlib-1.8.0/libgloss/configure *** newlib-1.8.0.orig/libgloss/configure Thu Jul 10 18:18:51 1997 --- newlib-1.8.0/libgloss/configure Tue Mar 10 12:04:01 1998 *************** *** 753,759 **** # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:762: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 753,759 ---- # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:769: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 782,788 **** # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:791: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 782,788 ---- # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:798: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 830,836 **** fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 ! echo "configure:839: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 830,836 ---- fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 ! echo "configure:846: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 839,845 **** yes; #endif EOF ! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no --- 839,845 ---- yes; #endif EOF ! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no *************** *** 854,860 **** ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 ! echo "configure:863: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 854,860 ---- ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 ! echo "configure:870: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 886,892 **** # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:895: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 886,892 ---- # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:902: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 919,925 **** # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:928: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 919,925 ---- # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:935: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff -N -P -r -c newlib-1.8.0.orig/newlib/ChangeLog newlib-1.8.0/newlib/ChangeLog *** newlib-1.8.0.orig/newlib/ChangeLog Thu Jul 10 18:23:53 1997 --- newlib-1.8.0/newlib/ChangeLog Thu May 21 12:32:26 1998 *************** *** 1,3 **** --- 1,46 ---- + 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. + + Thu Mar 26 08:13:52 CST 1998 Eric Norum <eric@skatter.usask.ca> + + * libc/machine/m68k/Makefile.in: Added references to memcpy, strcpy, + and strlen. + * libc/machine/m68k/memcpy.c: New file. + * libc/machine/m68k/strcpy.c: New file. + * libc/machine/m68k/strlen.c: New file. + + Thu Mar 26 08:15:44 CST 1998 Ralf Corsepius <corsepiu@faw.uni-ulm.de> + + * libc/machine/sh/memcpy.S: Fixed to work on SH1. + * libc/machine/sh/memset.S: Fixed to work on SH1. + + Thu Mar 26 07:56:26 CST 1998 Joel Sherrill <joel@OARcorp.com> + + * configure.in: Don't use libgloss with RTEMS. + * configure: Don't use libgloss with RTEMS. + + Thu Mar 26 07:56:26 CST 1998 Joel Sherrill <joel@OARcorp.com> + + * configure.in: Corrected feature defines. Removed extraneous + powerpc*-*-rtems* reference. + * libc/include/sys/errno.h: Added ENOTSUP. + * libc/machine/i386/Makefile.in: Added setjmp.S. + * libc/machine/i386/setjmp.S: New file. + * libc/machine/i386/setjmp.h: New file. + * libc/machine/i960/Makefile.in: Added rules for i960 specific + memory and string routines although they are not actually built. + * libc/machine/i960/setjmp.S: New file. + * libc/reent/reent.c: Added _wrapup_reent. + * libc/stdio/tmpnam.c: Fixed warning. + * libc/sys/rtems/crt0.c: Added symbols needed to satisfy link attempt + by AC_PROG_CC autoconf macro. + * libc/sys/rtems/sys/types.h: Added ifdef for go32. + Thu Jul 10 15:11:52 1997 Doug Evans <dje@canuck.cygnus.com> * libm/math/k_standard.c (__kernel_standard): Call fflush(stdout) diff -N -P -r -c newlib-1.8.0.orig/newlib/configure.in newlib-1.8.0/newlib/configure.in *** newlib-1.8.0.orig/newlib/configure.in Thu Jul 10 18:23:54 1997 --- newlib-1.8.0/newlib/configure.in Tue Mar 31 09:57:25 1998 *************** *** 159,164 **** --- 159,166 ---- ;; *-*-rtems*) # generic RTEMS support sys_dir=rtems + posix_dir=posix + unix_dir= ;; a29k-*-*) sys_dir=a29khif *************** *** 240,250 **** # RTEMS supplies its own versions of some routines: # malloc() (reentrant version) # exit() RTEMS has a "global" reent to flush ! # _gettimeofday_r() # ! # NOTE: When newlib malloc uses a semaphore, we should switch to that. *-*-rtems*) ! target_cflags="${target_cflags} -DHAVE_GETTIMEOFDAY -DMALLOC_PROVIDED -DEXIT_PROVIDED -DMISSING_SYSCALL_NAMES" ;; # VxWorks supplies its own version of malloc, and the newlib one # doesn't work because VxWorks does not have sbrk. --- 242,253 ---- # RTEMS supplies its own versions of some routines: # malloc() (reentrant version) # exit() RTEMS has a "global" reent to flush ! # signal()/raise() RTEMS has its own including pthread signals ! # _XYZ_r() RTEMS has its own reentrant routines # ! # 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 -DHAVE_RENAME" ;; # VxWorks supplies its own version of malloc, and the newlib one # doesn't work because VxWorks does not have sbrk. *************** *** 296,302 **** powerpc*-*-eabi* | \ powerpc*-*-elf* | \ powerpc*-*-linux* | \ - powerpc*-*-rtem* | \ powerpc*-*-sysv* | \ powerpc*-*-solaris*) target_cflags="${target_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES" --- 299,304 ---- diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/include/stdio.h newlib-1.8.0/newlib/libc/include/stdio.h *** newlib-1.8.0.orig/newlib/libc/include/stdio.h Wed Jun 22 09:27:11 1994 --- newlib-1.8.0/newlib/libc/include/stdio.h Mon Apr 27 12:04:49 1998 *************** *** 82,88 **** #define _IONBF 2 /* setvbuf should set unbuffered */ #ifndef NULL ! #define NULL 0L #endif #define BUFSIZ 1024 --- 82,88 ---- #define _IONBF 2 /* setvbuf should set unbuffered */ #ifndef NULL ! #define NULL 0 #endif #define BUFSIZ 1024 diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/include/stdlib.h newlib-1.8.0/newlib/libc/include/stdlib.h *** newlib-1.8.0.orig/newlib/libc/include/stdlib.h Tue Jun 24 16:42:41 1997 --- newlib-1.8.0/newlib/libc/include/stdlib.h Mon Apr 27 12:04:51 1998 *************** *** 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 newlib-1.8.0.orig/newlib/libc/include/string.h newlib-1.8.0/newlib/libc/include/string.h *** newlib-1.8.0.orig/newlib/libc/include/string.h Tue Jun 24 16:42:41 1997 --- newlib-1.8.0/newlib/libc/include/string.h Mon Apr 27 12:04:53 1998 *************** *** 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 newlib-1.8.0.orig/newlib/libc/include/sys/errno.h newlib-1.8.0/newlib/libc/include/sys/errno.h *** newlib-1.8.0.orig/newlib/libc/include/sys/errno.h Fri Dec 13 13:06:10 1996 --- newlib-1.8.0/newlib/libc/include/sys/errno.h Tue Mar 10 12:04:02 1998 *************** *** 132,137 **** --- 132,138 ---- #define EUSERS 131 #define EDQUOT 132 #define ESTALE 133 + #define ENOTSUP 134 /* From cygwin32. */ #define EWOULDBLOCK EAGAIN /* Operation would block */ diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/include/sys/stat.h newlib-1.8.0/newlib/libc/include/sys/stat.h *** newlib-1.8.0.orig/newlib/libc/include/sys/stat.h Tue Jun 24 16:42:43 1997 --- newlib-1.8.0/newlib/libc/include/sys/stat.h Tue Jun 16 16:36:36 1998 *************** *** 124,129 **** --- 124,131 ---- int _EXFUN(stat,( const char *_path, struct stat *_sbuf )); mode_t _EXFUN(umask,( mode_t _mask )); + int _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev )); + #endif /* !_STAT_H_ */ #ifdef __cplusplus } diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/include/time.h newlib-1.8.0/newlib/libc/include/time.h *** newlib-1.8.0.orig/newlib/libc/include/time.h Tue Jun 24 16:42:42 1997 --- newlib-1.8.0/newlib/libc/include/time.h Mon Apr 27 12:04:55 1998 *************** *** 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 newlib-1.8.0.orig/newlib/libc/machine/i386/Makefile.in newlib-1.8.0/newlib/libc/machine/i386/Makefile.in *** newlib-1.8.0.orig/newlib/libc/machine/i386/Makefile.in Wed Sep 20 14:03:17 1995 --- newlib-1.8.0/newlib/libc/machine/i386/Makefile.in Tue Mar 10 12:04:02 1998 *************** *** 25,41 **** #### Host, target, and site specific Makefile fragments come in here. ### ! OFILES= all: lib.a ! lib.a: $(OFILES) $(COPYOFILES) rm -f $@ $(AR) $(AR_FLAGS) $@ $(OFILES) $(COPYOFILES) doc: clean mostlyclean: ! -$(RM) $(OFILES) $(COPYOFILES) lib.a distclean maintainer-clean realclean: clean rm -f Makefile config.status --- 25,45 ---- #### Host, target, and site specific Makefile fragments come in here. ### ! OFILES=setjmp.o ! ! ! # to support SunOS VPATH ! setjmp.o: setjmp.S all: lib.a ! lib.a: $(OFILES) rm -f $@ $(AR) $(AR_FLAGS) $@ $(OFILES) $(COPYOFILES) doc: clean mostlyclean: ! $(RM) $(OFILES) *~ lib.a distclean maintainer-clean realclean: clean rm -f Makefile config.status diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/machine/i386/setjmp.S newlib-1.8.0/newlib/libc/machine/i386/setjmp.S *** newlib-1.8.0.orig/newlib/libc/machine/i386/setjmp.S Wed Dec 31 18:00:00 1969 --- newlib-1.8.0/newlib/libc/machine/i386/setjmp.S Tue Mar 10 12:04:02 1998 *************** *** 0 **** --- 1,137 ---- + /* This is file is a merger of SETJMP.S and LONGJMP.S */ + /* + * This file was modified to use the __USER_LABEL_PREFIX__ and + * __REGISTER_PREFIX__ macros defined by later versions of GNU cpp by + * Joel Sherrill (joel@OARcorp.com) + * + ** 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. + */ + + /* + ** jmp_buf: + ** eax ebx ecx edx esi edi ebp esp eip + ** 0 4 8 12 16 20 24 28 32 + */ + + /* These are predefined by new versions of GNU cpp. */ + + #ifndef __USER_LABEL_PREFIX__ + #define __USER_LABEL_PREFIX__ _ + #endif + + /***************************** TEMPORARY ****************************** + * + * It appears that the i386-coff configuration of gcc 2.6.2 does not + * do the __REGISTER_PREFIX__ correctly. Fix this when it does. + **********************************************************************/ + #define __REGISTER_PREFIX__ % + #ifndef __REGISTER_PREFIX__ + #define __REGISTER_PREFIX__ + #endif + + /* ANSI concatenation macros. */ + + #define CONCAT1(a, b) CONCAT2(a, b) + #define CONCAT2(a, b) a ## b + + /* Use the right prefix for global labels. */ + + #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) + + /* Use the right prefix for registers. */ + + #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) + + #define eax REG (eax) + #define ebx REG (ebx) + #define ecx REG (ecx) + #define edx REG (edx) + #define esi REG (esi) + #define edi REG (edi) + #define ebp REG (ebp) + #define esp REG (esp) + + #define ax REG (ax) + #define bx REG (bx) + #define cx REG (cx) + #define dx REG (dx) + + #define ah REG (ah) + #define bh REG (bh) + #define ch REG (ch) + #define dh REG (dh) + + #define al REG (al) + #define bl REG (bl) + #define cl REG (cl) + #define dl REG (dl) + + .global SYM (setjmp) + .global SYM (longjmp) + + SYM (setjmp): + + pushl ebp + movl esp,ebp + + pushl edi + movl 8 (ebp),edi + + movl eax,0 (edi) + movl ebx,4 (edi) + movl ecx,8 (edi) + movl edx,12 (edi) + movl esi,16 (edi) + + movl -4 (ebp),eax + movl eax,20 (edi) + + movl 0 (ebp),eax + movl eax,24 (edi) + + movl esp,eax + addl $12,eax + movl eax,28 (edi) + + movl 4 (ebp),eax + movl eax,32 (edi) + + popl edi + movl $0,eax + leave + ret + + SYM (longjmp): + pushl ebp + movl esp,ebp + + movl 8(ebp),edi /* get jmp_buf */ + movl 12(ebp),eax /* store retval in j->eax */ + movl eax,0(edi) + + movl 24(edi),ebp + + cli + movl 28(edi),esp + + pushl 32(edi) + + movl 0(edi),eax + movl 4(edi),ebx + movl 8(edi),ecx + movl 12(edi),edx + movl 16(edi),esi + movl 20(edi),edi + sti + + ret + diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/machine/i386/setjmp.h newlib-1.8.0/newlib/libc/machine/i386/setjmp.h *** newlib-1.8.0.orig/newlib/libc/machine/i386/setjmp.h Wed Dec 31 18:00:00 1969 --- newlib-1.8.0/newlib/libc/machine/i386/setjmp.h Tue Mar 10 12:04:02 1998 *************** *** 0 **** --- 1,40 ---- + /* + ** 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 newlib-1.8.0.orig/newlib/libc/machine/i960/Makefile.in newlib-1.8.0/newlib/libc/machine/i960/Makefile.in *** newlib-1.8.0.orig/newlib/libc/machine/i960/Makefile.in Wed Jun 25 14:11:51 1997 --- newlib-1.8.0/newlib/libc/machine/i960/Makefile.in Thu Mar 26 08:09:41 1998 *************** *** 25,37 **** #### Host, target, and site specific Makefile fragments come in here. ### ! OFILES=\ all: lib.a lib.a: $(OFILES) rm -f $@ $(AR) $(AR_FLAGS) $@ $(OFILES) $(COPYOFILES) doc: --- 25,59 ---- #### Host, target, and site specific Makefile fragments come in here. ### ! #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 lib.a: $(OFILES) rm -f $@ $(AR) $(AR_FLAGS) $@ $(OFILES) $(COPYOFILES) + + # to support SunOS VPATH + memccpy.o: memccpy.S + memchr.o: memchr.S + memcmp.o: memcmp.S + memcpy.o: memcpy.S + memset.o: memset.S + setjmp.o: setjmp.S + strchr.o: strchr.S + strcmp.o: strcmp.S + strcpy.o: strcpy.S + strcspn.o: strcspn.S + strdup.o: strdup.S + strlen.o: strlen.S + strncat.o: strncat.S + strncmp.o: strncmp.S + strncpy.o: strncpy.S + strpbrk.o: strpbrk.S + strrchr.o: strrchr.S doc: diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/machine/i960/setjmp.S newlib-1.8.0/newlib/libc/machine/i960/setjmp.S *** newlib-1.8.0.orig/newlib/libc/machine/i960/setjmp.S Wed Feb 7 15:22:18 1996 --- newlib-1.8.0/newlib/libc/machine/i960/setjmp.S Tue Mar 10 12:04:02 1998 *************** *** 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 newlib-1.8.0.orig/newlib/libc/machine/m68k/Makefile.in newlib-1.8.0/newlib/libc/machine/m68k/Makefile.in *** newlib-1.8.0.orig/newlib/libc/machine/m68k/Makefile.in Wed Sep 20 14:03:25 1995 --- newlib-1.8.0/newlib/libc/machine/m68k/Makefile.in Fri Jun 12 16:10:36 1998 *************** *** 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 newlib-1.8.0.orig/newlib/libc/machine/m68k/strcpy.c newlib-1.8.0/newlib/libc/machine/m68k/strcpy.c *** newlib-1.8.0.orig/newlib/libc/machine/m68k/strcpy.c Wed Dec 31 18:00:00 1969 --- newlib-1.8.0/newlib/libc/machine/m68k/strcpy.c Thu Mar 26 07:54:24 1998 *************** *** 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 newlib-1.8.0.orig/newlib/libc/machine/m68k/strlen.c newlib-1.8.0/newlib/libc/machine/m68k/strlen.c *** newlib-1.8.0.orig/newlib/libc/machine/m68k/strlen.c Wed Dec 31 18:00:00 1969 --- newlib-1.8.0/newlib/libc/machine/m68k/strlen.c Thu Mar 26 07:54:50 1998 *************** *** 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 newlib-1.8.0.orig/newlib/libc/machine/sh/memcpy.S newlib-1.8.0/newlib/libc/machine/sh/memcpy.S *** newlib-1.8.0.orig/newlib/libc/machine/sh/memcpy.S Wed Mar 5 13:35:13 1997 --- newlib-1.8.0/newlib/libc/machine/sh/memcpy.S Tue Mar 10 12:04:02 1998 *************** *** 37,43 **** .balignw 4,0x0009 L_loop1: mov.b @r5+,r0 ! Copy bytes to align source ! dt r1 mov.b r0,@r4 add #-1,r6 add #1,r4 --- 37,48 ---- .balignw 4,0x0009 L_loop1: mov.b @r5+,r0 ! Copy bytes to align source ! #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) ! dt r1 ! #else ! add #-1,r1 ! tst r1,r1 ! #endif mov.b r0,@r4 add #-1,r6 add #1,r4 *************** *** 70,76 **** .balignw 4,0x0009 L_dest00: mov.l @r5+,r0 ! Read longword, write longword per iteration ! dt r2 mov.l r0,@r4 add #4,r4 bf L_dest00 --- 75,86 ---- .balignw 4,0x0009 L_dest00: mov.l @r5+,r0 ! Read longword, write longword per iteration ! #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) ! dt r2 ! #else ! add #-1,r2 ! tst r2,r2 ! #endif mov.l r0,@r4 add #4,r4 bf L_dest00 *************** *** 83,89 **** .balignw 4,0x0009 L_dest10: mov.l @r5+,r0 ! Read longword, write two words per iteration ! dt r2 #ifdef __LITTLE_ENDIAN__ mov.w r0,@r4 shlr16 r0 --- 93,104 ---- .balignw 4,0x0009 L_dest10: mov.l @r5+,r0 ! Read longword, write two words per iteration ! #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) ! dt r2 ! #else ! add #-1,r2 ! tst r2,r2 ! #endif #ifdef __LITTLE_ENDIAN__ mov.w r0,@r4 shlr16 r0 *************** *** 105,111 **** L_dest01: L_dest11: mov.l @r5+,r0 ! Read longword, write byte, word, byte per iteration ! dt r2 #if __LITTLE_ENDIAN__ mov.b r0,@r4 shlr8 r0 --- 120,131 ---- L_dest01: L_dest11: mov.l @r5+,r0 ! Read longword, write byte, word, byte per iteration ! #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) ! dt r2 ! #else ! add #-1,r2 ! tst r2,r2 ! #endif #if __LITTLE_ENDIAN__ mov.b r0,@r4 shlr8 r0 *************** *** 139,145 **** .balignw 4,0x0009 L_cleanup_loop: mov.b @r5+,r0 ! dt r6 mov.b r0,@r4 add #1,r4 bf L_cleanup_loop --- 159,170 ---- .balignw 4,0x0009 L_cleanup_loop: mov.b @r5+,r0 ! #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) ! dt r6 ! #else ! add #-1,r6 ! tst r6,r6 ! #endif mov.b r0,@r4 add #1,r4 bf L_cleanup_loop diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/machine/sh/memset.S newlib-1.8.0/newlib/libc/machine/sh/memset.S *** newlib-1.8.0.orig/newlib/libc/machine/sh/memset.S Wed Mar 5 13:35:14 1997 --- newlib-1.8.0/newlib/libc/machine/sh/memset.S Tue Mar 10 12:04:02 1998 *************** *** 33,39 **** mov.b r5,@r4 add #-1,r6 add #1,r4 ! dt r0 bf L_align_loop L_dup_bytes: --- 33,44 ---- mov.b r5,@r4 add #-1,r6 add #1,r4 ! #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) ! dt r0 ! #else ! add #-1,r0 ! tst r0,r0 ! #endif 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 --- 55,66 ---- .balignw 4,0x0009 L_store_long_loop: mov.l r5,@r4 ! Store double longs to memory ! #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) ! dt r2 ! #else ! add #-1,r2 ! tst r2,r2 ! #endif 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: --- 73,84 ---- L_store_byte_loop: mov.b r5,@r4 ! Store bytes to memory add #1,r4 ! #if defined(__sh2__) || defined(__sh3__) || defined(__SH3E__) ! dt r6 ! #else ! add #-1,r6 ! tst r6,r6 ! #endif bf L_store_byte_loop L_exit: diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/reent/reent.c newlib-1.8.0/newlib/libc/reent/reent.c *** newlib-1.8.0.orig/newlib/libc/reent/reent.c Mon Feb 5 17:37:21 1996 --- newlib-1.8.0/newlib/libc/reent/reent.c Tue Mar 10 12:04:02 1998 *************** *** 82,84 **** --- 82,107 ---- } } + /* + * Do atexit() processing and cleanup + * + * NOTE: This is to be executed at task exit. It does not tear anything + * down which is used on a global basis. + */ + + void + _wrapup_reent(struct _reent *ptr) + { + register struct _atexit *p; + register int n; + + if (ptr == 0) + ptr = _REENT; + + for (p = ptr->_atexit; p; p = p->_next) + for (n = p->_ind; --n >= 0;) + (*p->_fns[n]) (); + if (ptr->__cleanup) + (*ptr->__cleanup) (ptr); + } + diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/stdio/tmpnam.c newlib-1.8.0/newlib/libc/stdio/tmpnam.c *** newlib-1.8.0.orig/newlib/libc/stdio/tmpnam.c Wed Jun 25 12:25:22 1997 --- newlib-1.8.0/newlib/libc/stdio/tmpnam.c Fri May 8 09:22:24 1998 *************** *** 122,132 **** t = _open_r (ptr, result, O_RDONLY, 0); if (t == -1) { ! if (ptr->_errno == ENOSYS) ! { ! result[0] = '0'; ! return 0; ! } break; } (*part4)++; --- 122,129 ---- t = _open_r (ptr, result, O_RDONLY, 0); if (t == -1) { ! result[0] = '\0'; ! return 0; break; } (*part4)++; diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/string/strerror.c newlib-1.8.0/newlib/libc/string/strerror.c *** newlib-1.8.0.orig/newlib/libc/string/strerror.c Mon Aug 26 15:44:12 1996 --- newlib-1.8.0/newlib/libc/string/strerror.c Thu May 21 12:30:09 1998 *************** *** 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 newlib-1.8.0.orig/newlib/libc/sys/rtems/crt0.c newlib-1.8.0/newlib/libc/sys/rtems/crt0.c *** newlib-1.8.0.orig/newlib/libc/sys/rtems/crt0.c Tue Jun 24 16:49:55 1997 --- newlib-1.8.0/newlib/libc/sys/rtems/crt0.c Wed Mar 25 08:13:07 1998 *************** *** 1 **** --- 1,44 ---- + /* + * 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 + void rtems_provides_crt0( void ) {} diff -N -P -r -c newlib-1.8.0.orig/newlib/libc/sys/rtems/sys/types.h newlib-1.8.0/newlib/libc/sys/rtems/sys/types.h *** newlib-1.8.0.orig/newlib/libc/sys/rtems/sys/types.h Tue Jun 24 16:53:04 1997 --- newlib-1.8.0/newlib/libc/sys/rtems/sys/types.h Tue Jun 16 16:07:18 1998 *************** *** 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 */ *************** *** 133,142 **** --- 133,144 ---- * P1003.1b-1993, p. 84 */ + #ifndef __go32_types__ uid_t _EXFUN(getuid, (void)); uid_t _EXFUN(geteuid, (void)); gid_t _EXFUN(getgid, (void)); gid_t _EXFUN(getegid, (void)); + #endif /* * 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84