This is the mail archive of the newlib@sourceware.org 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]
Other format: [Raw text]

[PATCH 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS


RTEMS provides the option to have a global or per-thread reentrancy
as part of application configuration. As part of this, RTEMS provides
the implementation of __getreent() as appropriate. Allow the target
to determine if this method is present in libc.a.
---
 newlib/configure.host        | 4 +++-
 newlib/libc/reent/getreent.c | 8 ++++++++
 newlib/libc/sys/rtems/crt0.c | 3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/newlib/configure.host b/newlib/configure.host
index fb3362b..f2049f4 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -605,9 +605,11 @@ case "${host}" in
 	default_newlib_io_long_long="yes"
 	default_newlib_io_c99_formats="yes"
 	newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
-	newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
+	newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
         # turn off unsupported items in posix directory 
 	newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN"
+        # turn off using cli/sti in i386 setjmp/longjmp
+	newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS"
 	;;
 # VxWorks supplies its own version of malloc, and the newlib one
 # doesn't work because VxWorks does not have sbrk.
diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c
index 60ae6fb..124abce 100644
--- a/newlib/libc/reent/getreent.c
+++ b/newlib/libc/reent/getreent.c
@@ -1,5 +1,11 @@
 /* default reentrant pointer when multithread enabled */
 
+#ifdef GETREENT_PROVIDED
+
+int _dummy_getreent;
+
+#else
+
 #include <_ansi.h>
 #include <reent.h>
 
@@ -12,3 +18,5 @@ _DEFUN_VOID(__getreent)
 {
   return _impure_ptr;
 }
+
+#endif
diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
index 0e9d426..4e2c207 100644
--- a/newlib/libc/sys/rtems/crt0.c
+++ b/newlib/libc/sys/rtems/crt0.c
@@ -125,6 +125,9 @@ RTEMS_STUB(int, waitpid (pid_t pid, int *status, int options), { return -1; })
 #endif
 RTEMS_STUB(_ssize_t, write (int fd, const void *buf, size_t nbytes), { return -1; })
 
+/* stubs for functions from sys/reent.h */
+RTEMS_STUB(struct _reent *, __getreent (), { })
+
 /* stubs for functions from reent.h */
 RTEMS_STUB(int, _close_r (struct _reent *r, int fd), { return -1; })
 #if defined(_NO_EXECVE)
-- 
1.8.3.1


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