Newlib 1.8.0 making problems
Joel Sherrill
joel at oarcorp.com
Wed Oct 15 13:03:25 UTC 1997
On Tue, 14 Oct 1997, Jacob W Janovetz wrote:
> Is newlib-1.8.0 supported for RTEMS? I know it has a m68k-rtems
> option (which I'm using).
Semi. It has most of the rtems support merged but is missing a few key
pieces.
Below my signature I have put the initial patch set for newlib 1.8.0 rtems
configurations. Mostly this is a pretty simple patch and is fairly
obviosu if you see what was missing from newlib 1.7.0-posix. There are
still a couple of problems with the i960 and i386 rtems
configurations which are not in this patch set. These will be fixed in
newlib 1.8.1.
I do not know how this works with rtems 3.6.0. I have only tested this
with current rtems development tree. But it is better than fighting this
battle yourself. If you use this patch, please let me if it needs more
work. We need to get fixes into newlib 1.8.1.
--joel
Joel Sherrill Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (205) 722-9985
Wed Sep 3 09:28:50 CDT 1997 Joel Sherrill (joel at OARcorp.com)
* configure.in (*-*-rtems*): Do not build libgloss for rtems.
* newlib/configure.in (*-*-rtems*): Add -DSIGNAL_PROVIDED and
-DREENTRANT_SYSCALLS_PROVIDED to the target_cflags.
* newlib/libc/include/sys/errno.h: Add ENOTSUP.
* newlib/libc/reent/reent.c: Add _wrapup_reent.
* newlib/libc/reent/signalr.c: Do not use kill_r if SIGNAL_PROVIDED.
* newlib/libc/sys/rtems/sys/types.h: Avoid redefinitions for go32.
diff -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 Mon Aug 11 13:45:34 1997
***************
*** 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 -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 Thu Aug 14 13:39:35 1997
***************
*** 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.
--- 240,251 ----
# 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"
;;
# VxWorks supplies its own version of malloc, and the newlib one
# doesn't work because VxWorks does not have sbrk.
diff -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 Mon Aug 25 12:56:42 1997
***************
*** 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 -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 Wed Aug 13 17:34:20 1997
***************
*** 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 -r -c newlib-1.8.0-orig/newlib/libc/reent/signalr.c newlib-1.8.0/newlib/libc/reent/signalr.c
*** newlib-1.8.0-orig/newlib/libc/reent/signalr.c Fri Aug 2 20:31:53 1996
--- newlib-1.8.0/newlib/libc/reent/signalr.c Wed Aug 13 17:44:09 1997
***************
*** 47,52 ****
--- 47,57 ----
<<errno>>.
*/
+ #ifdef SIGNAL_PROVIDED
+
+ int _dummy_kill_r;
+
+ #else
int
_kill_r (ptr, pid, sig)
struct _reent *ptr;
***************
*** 60,65 ****
--- 65,72 ----
ptr->_errno = errno;
return ret;
}
+
+ #endif /* ! defined (SIGNAL_PROVIDED) */
/*
FUNCTION
diff -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 Sat Aug 9 09:28:20 1997
***************
*** 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
More information about the users
mailing list