This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: bug - newlib 1.16.0 - w/ reent-small
- From: Jeff Johnston <jjohnstn at redhat dot com>
- To: duane-newlib at duaneellis dot com
- Cc: Newlib <newlib at sourceware dot org>
- Date: Mon, 03 Mar 2008 14:03:56 -0500
- Subject: Re: bug - newlib 1.16.0 - w/ reent-small
- References: <47C9F57C.1010801@duaneellis.com>
Duane,
Please try the attached patch.
-- Jeff J.
duane ellis wrote:
Hello,
There's a small set of problems with newlib - I believe centered
around "--enable-newlib-reent-small".
{more detail about what I have ./configured is below}.
The following files end up with 'undefined' references to
CHECK_STD_INT - which is really a macro in local.h
These three, easy - they are missing a '#include "local.h"' statement.
newlib/libc/stdio/dprintf.c
newlib/libc/stdio/vdiprintf.c
newlib/libc/stdio/vdprintf.c
These two are a little tougher situation,
As either their instance of 'local.h' needs fixing, or -
they need access to the local.h over in the above directory.
newlib/libc/stdlib/mallstatsr.c
newlib/libc/stdlib/mstats.c
I'm not familiar enough with that portion to go mucking about, and
creating a patch.
-Duane.
=====
My -full-configure- that I am using is this:
The full conif configured as follows:
configured by ./configure, generated by GNU Autoconf 2.59,
with options \"'--prefix=/home/duane/lostarm/install'
'--target=arm-elf' '--disable-newlib-io-pos-args'
'--disable-newlib-io-c99-formats' '--enable-newlib-io-long-long'
'--enable-newlib-io-long-double' '--disable-newlib-mb'
'--disable-newlib-iconv-external-ccs' '--disable-newlib-atexit-alloc'
'--enable-newlib-reent-small' '--enable-multilib'
'--enable-target-optspace' '--disable-malloc-debugging'
'--enable-newlib-multithread' '--disable-newlib-iconv'
'--enable-newlib-io-float' '--disable-newlib-supplied-syscalls'
'--disable-dependency-tracking' '--disable-maintainer-mode'
'--disable-shared' '--enable-static' '--enable-fast-install'
'--disable-libtool-lock' 'target_alias=arm-elf'\"
Index: libc/include/sys/reent.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/reent.h,v
retrieving revision 1.39
diff -u -p -r1.39 reent.h
--- libc/include/sys/reent.h 7 Sep 2007 21:16:25 -0000 1.39
+++ libc/include/sys/reent.h 3 Mar 2008 18:49:59 -0000
@@ -149,8 +149,19 @@ struct __sFILE_fake {
struct _reent *_data;
};
-/* CHECK_STD_INIT() comes from stdio/local.h; be sure to include that. */
-# define _REENT_SMALL_CHECK_INIT(ptr) CHECK_STD_INIT(ptr)
+
+/* Following is needed both in libc/stdio and libc/stdlib so we put it
+ * here instead of libc/stdio/local.h where it was previously. */
+
+extern _VOID _EXFUN(__sinit,(struct _reent *));
+
+# define _REENT_SMALL_CHECK_INIT(ptr) \
+ do \
+ { \
+ if ((ptr) && !(ptr)->__sdidinit) \
+ __sinit (ptr); \
+ } \
+ while (0)
#else
# define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */
#endif
Index: libc/stdio/dprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/dprintf.c,v
retrieving revision 1.3
diff -u -p -r1.3 dprintf.c
--- libc/stdio/dprintf.c 4 May 2007 02:55:16 -0000 1.3
+++ libc/stdio/dprintf.c 3 Mar 2008 18:49:59 -0000
@@ -45,6 +45,7 @@ Supporting OS subroutines required: <<sb
#include <stdio.h>
#include <unistd.h>
#include <stdarg.h>
+#include "local.h"
int
_DEFUN(_dprintf_r, (ptr, fd, format),
Index: libc/stdio/vdiprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vdiprintf.c,v
retrieving revision 1.2
diff -u -p -r1.2 vdiprintf.c
--- libc/stdio/vdiprintf.c 4 May 2007 02:55:16 -0000 1.2
+++ libc/stdio/vdiprintf.c 3 Mar 2008 18:49:59 -0000
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
+#include "local.h"
int
_DEFUN(_vdiprintf_r, (ptr, fd, format, ap),
Index: libc/stdio/vdprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vdprintf.c,v
retrieving revision 1.3
diff -u -p -r1.3 vdprintf.c
--- libc/stdio/vdprintf.c 4 May 2007 02:55:16 -0000 1.3
+++ libc/stdio/vdprintf.c 3 Mar 2008 18:49:59 -0000
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
+#include "local.h"
int
_DEFUN(_vdprintf_r, (ptr, fd, format, ap),