toaruos/toolchain/patches/newlib-1.19.0.patch
2013-05-30 00:57:17 -07:00

321 lines
9.4 KiB
Diff

diff -rupN _source/newlib-1.19.0/config.sub newlib-1.19.0/config.sub
--- _source/newlib-1.19.0/config.sub 2010-06-01 12:53:40.000000000 -0500
+++ newlib-1.19.0/config.sub 2011-04-24 20:37:12.000000000 -0500
@@ -1298,6 +1298,7 @@ case $os in
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
+ | -toaru* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
diff -rupN _source/newlib-1.19.0/newlib/configure.host newlib-1.19.0/newlib/configure.host
--- _source/newlib-1.19.0/newlib/configure.host 2010-12-02 13:30:46.000000000 -0600
+++ newlib-1.19.0/newlib/configure.host 2011-04-24 20:38:10.000000000 -0500
@@ -418,6 +418,9 @@ case "${host}" in
h8500-*-elf*)
sys_dir=h8500hms
;;
+ i[34567]86-*-toaru*)
+ sys_dir=toaru
+ ;;
i[34567]86-*-rdos*)
sys_dir=rdos
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
@@ -543,6 +546,9 @@ esac
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
+ *-*-toaru)
+ newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED -DMISSING_SYSCALL_NAMES"
+ ;;
*-*-cygwin*)
test -z "$cygwin_srcdir" && cygwin_srcdir=`cd ${srcdir}/../winsup/cygwin; pwd`
export cygwin_srcdir
diff -rupN _source/newlib-1.19.0/newlib/libc/include/sys/stat.h newlib-1.19.0/newlib/libc/include/sys/stat.h
--- _source/newlib-1.19.0/newlib/libc/include/sys/stat.h 2010-08-06 13:26:21.000000000 -0500
+++ newlib-1.19.0/newlib/libc/include/sys/stat.h 2012-04-23 16:00:11.000000000 -0500
@@ -150,8 +150,8 @@ int _EXFUN(mkfifo,( const char *__path,
int _EXFUN(stat,( const char *__path, struct stat *__sbuf ));
mode_t _EXFUN(umask,( mode_t __mask ));
-#if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
int _EXFUN(lstat,( const char *__path, struct stat *__buf ));
+#if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
#endif
diff -rupN _source/newlib-1.19.0/newlib/libc/include/sys/utime.h newlib-1.19.0/newlib/libc/include/sys/utime.h
--- _source/newlib-1.19.0/newlib/libc/include/sys/utime.h 2000-02-17 13:39:46.000000000 -0600
+++ newlib-1.19.0/newlib/libc/include/sys/utime.h 2012-04-23 16:01:17.000000000 -0500
@@ -15,6 +15,8 @@ struct utimbuf
time_t modtime;
};
+int utime(const char *filename, const struct utimbuf *times);
+
#ifdef __cplusplus
};
#endif
diff -rupN _source/newlib-1.19.0/newlib/libc/stdio/fseek.c newlib-1.19.0/newlib/libc/stdio/fseek.c
--- _source/newlib-1.19.0/newlib/libc/stdio/fseek.c 2009-12-17 13:43:43.000000000 -0600
+++ newlib-1.19.0/newlib/libc/stdio/fseek.c 2011-04-29 19:33:10.000000000 -0500
@@ -160,210 +160,6 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whenc
return EOF;
}
- /*
- * Change any SEEK_CUR to SEEK_SET, and check `whence' argument.
- * After this, whence is either SEEK_SET or SEEK_END.
- */
-
- switch (whence)
- {
- case SEEK_CUR:
- /*
- * In order to seek relative to the current stream offset,
- * we have to first find the current stream offset a la
- * ftell (see ftell for details).
- */
- _fflush_r (ptr, fp); /* may adjust seek offset on append stream */
- if (fp->_flags & __SOFF)
- curoff = fp->_offset;
- else
- {
- curoff = seekfn (ptr, fp->_cookie, (_fpos_t) 0, SEEK_CUR);
- if (curoff == -1L)
- {
- _funlockfile (fp);
- __sfp_lock_release ();
- return EOF;
- }
- }
- if (fp->_flags & __SRD)
- {
- curoff -= fp->_r;
- if (HASUB (fp))
- curoff -= fp->_ur;
- }
- else if (fp->_flags & __SWR && fp->_p != NULL)
- curoff += fp->_p - fp->_bf._base;
-
- offset += curoff;
- whence = SEEK_SET;
- havepos = 1;
- break;
-
- case SEEK_SET:
- case SEEK_END:
- havepos = 0;
- break;
-
- default:
- ptr->_errno = EINVAL;
- _funlockfile (fp);
- __sfp_lock_release ();
- return (EOF);
- }
-
- /*
- * Can only optimise if:
- * reading (and not reading-and-writing);
- * not unbuffered; and
- * this is a `regular' Unix file (and hence seekfn==__sseek).
- * We must check __NBF first, because it is possible to have __NBF
- * and __SOPT both set.
- */
-
- if (fp->_bf._base == NULL)
- __smakebuf_r (ptr, fp);
- if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT))
- goto dumb;
- if ((fp->_flags & __SOPT) == 0)
- {
- if (seekfn != __sseek
- || fp->_file < 0
-#ifdef __USE_INTERNAL_STAT64
- || _fstat64_r (ptr, fp->_file, &st)
-#else
- || _fstat_r (ptr, fp->_file, &st)
-#endif
- || (st.st_mode & S_IFMT) != S_IFREG)
- {
- fp->_flags |= __SNPT;
- goto dumb;
- }
-#ifdef HAVE_BLKSIZE
- fp->_blksize = st.st_blksize;
-#else
- fp->_blksize = 1024;
-#endif
- fp->_flags |= __SOPT;
- }
-
- /*
- * We are reading; we can try to optimise.
- * Figure out where we are going and where we are now.
- */
-
- if (whence == SEEK_SET)
- target = offset;
- else
- {
-#ifdef __USE_INTERNAL_STAT64
- if (_fstat64_r (ptr, fp->_file, &st))
-#else
- if (_fstat_r (ptr, fp->_file, &st))
-#endif
- goto dumb;
- target = st.st_size + offset;
- }
- if ((long)target != target)
- {
- ptr->_errno = EOVERFLOW;
- _funlockfile (fp);
- __sfp_lock_release ();
- return EOF;
- }
-
- if (!havepos)
- {
- if (fp->_flags & __SOFF)
- curoff = fp->_offset;
- else
- {
- curoff = seekfn (ptr, fp->_cookie, 0L, SEEK_CUR);
- if (curoff == POS_ERR)
- goto dumb;
- }
- curoff -= fp->_r;
- if (HASUB (fp))
- curoff -= fp->_ur;
- }
-
- /*
- * Compute the number of bytes in the input buffer (pretending
- * that any ungetc() input has been discarded). Adjust current
- * offset backwards by this count so that it represents the
- * file offset for the first byte in the current input buffer.
- */
-
- if (HASUB (fp))
- {
- curoff += fp->_r; /* kill off ungetc */
- n = fp->_up - fp->_bf._base;
- curoff -= n;
- n += fp->_ur;
- }
- else
- {
- n = fp->_p - fp->_bf._base;
- curoff -= n;
- n += fp->_r;
- }
-
- /*
- * If the target offset is within the current buffer,
- * simply adjust the pointers, clear EOF, undo ungetc(),
- * and return.
- */
-
- if (target >= curoff && target < curoff + n)
- {
- register int o = target - curoff;
-
- fp->_p = fp->_bf._base + o;
- fp->_r = n - o;
- if (HASUB (fp))
- FREEUB (ptr, fp);
- fp->_flags &= ~__SEOF;
- memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
- _funlockfile (fp);
- __sfp_lock_release ();
- return 0;
- }
-
- /*
- * The place we want to get to is not within the current buffer,
- * but we can still be kind to the kernel copyout mechanism.
- * By aligning the file offset to a block boundary, we can let
- * the kernel use the VM hardware to map pages instead of
- * copying bytes laboriously. Using a block boundary also
- * ensures that we only read one block, rather than two.
- */
-
- curoff = target & ~(fp->_blksize - 1);
- if (seekfn (ptr, fp->_cookie, curoff, SEEK_SET) == POS_ERR)
- goto dumb;
- fp->_r = 0;
- fp->_p = fp->_bf._base;
- if (HASUB (fp))
- FREEUB (ptr, fp);
- fp->_flags &= ~__SEOF;
- n = target - curoff;
- if (n)
- {
- if (__srefill_r (ptr, fp) || fp->_r < n)
- goto dumb;
- fp->_p += n;
- fp->_r -= n;
- }
- memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
- _funlockfile (fp);
- __sfp_lock_release ();
- return 0;
-
- /*
- * We get here if we cannot optimise the seek ... just
- * do it. Allow the seek function to change fp->_bf._base.
- */
-
dumb:
if (_fflush_r (ptr, fp)
|| seekfn (ptr, fp->_cookie, offset, whence) == POS_ERR)
diff -rupN _source/newlib-1.19.0/newlib/libc/stdlib/mallocr.c newlib-1.19.0/newlib/libc/stdlib/mallocr.c
--- _source/newlib-1.19.0/newlib/libc/stdlib/mallocr.c 2010-05-31 14:15:41.000000000 -0500
+++ newlib-1.19.0/newlib/libc/stdlib/mallocr.c 2011-04-30 21:28:46.000000000 -0500
@@ -609,8 +609,11 @@ do {
operating system immediately after a free().
*/
+#define HAVE_MMAP 0
+#define HAVE_MREMAP 0
+
#ifndef HAVE_MMAP
-#define HAVE_MMAP 1
+#define HAVE_MMAP 0
#endif
/*
diff -rupN _source/newlib-1.19.0/newlib/libc/sys/configure newlib-1.19.0/newlib/libc/sys/configure
--- _source/newlib-1.19.0/newlib/libc/sys/configure 2010-12-16 15:59:03.000000000 -0600
+++ newlib-1.19.0/newlib/libc/sys/configure 2011-04-24 20:39:58.000000000 -0500
@@ -798,6 +798,7 @@ sysvi386
sysvnecv70
tic80
w65
+toaru
z8ksim'
# Initialize some variables set by options.
@@ -11820,6 +11827,8 @@ subdirs="$subdirs a29khif"
;;
w65) subdirs="$subdirs w65"
;;
+ toaru) subdirs="$subdirs toaru"
+ ;;
z8ksim) subdirs="$subdirs z8ksim"
;;
esac;
diff -rupN _source/newlib-1.19.0/newlib/libc/sys/configure.in newlib-1.19.0/newlib/libc/sys/configure.in
--- _source/newlib-1.19.0/newlib/libc/sys/configure.in 2010-02-24 14:59:55.000000000 -0600
+++ newlib-1.19.0/newlib/libc/sys/configure.in 2011-04-24 20:37:33.000000000 -0500
@@ -45,6 +45,7 @@ if test -n "${sys_dir}"; then
sysvnecv70) AC_CONFIG_SUBDIRS(sysvnecv70) ;;
tic80) AC_CONFIG_SUBDIRS(tic80) ;;
w65) AC_CONFIG_SUBDIRS(w65) ;;
+ toaru) AC_CONFIG_SUBDIRS(toaru) ;;
z8ksim) AC_CONFIG_SUBDIRS(z8ksim) ;;
esac;
fi