2007-03-15 Jeff Johnston <jjohnstn@redhat.com>
* configure.in: Add new --enable-newlib-reent-small option. * configure: Regenerated. * acconfig.h: Add _WANT_REENT_SMALL. * newlib.hin: Regenerated minus PACKAGE macros to add _WANT_REENT_SMALL macro. * libc/include/sys/config.h[_WANT_REENT_SMALL]: Set _REENT_SMALL if not already set. * libc/stdio/fflush.c[_REENT_SMALL]: Return immediately if there is no buffer. * libc/stdio/local.h[_REENT_SMALL]: Fix CHECK_INIT macro to use reentrant pointer passed in when resetting the file pointer to one of the std streams.
This commit is contained in:
parent
14ba5e14d9
commit
826b5591dd
@ -1,3 +1,18 @@
|
|||||||
|
2007-03-15 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
* configure.in: Add new --enable-newlib-reent-small option.
|
||||||
|
* configure: Regenerated.
|
||||||
|
* acconfig.h: Add _WANT_REENT_SMALL.
|
||||||
|
* newlib.hin: Regenerated minus PACKAGE macros to add
|
||||||
|
_WANT_REENT_SMALL macro.
|
||||||
|
* libc/include/sys/config.h[_WANT_REENT_SMALL]: Set _REENT_SMALL
|
||||||
|
if not already set.
|
||||||
|
* libc/stdio/fflush.c[_REENT_SMALL]: Return immediately if
|
||||||
|
there is no buffer.
|
||||||
|
* libc/stdio/local.h[_REENT_SMALL]: Fix CHECK_INIT macro to
|
||||||
|
use reentrant pointer passed in when resetting the file
|
||||||
|
pointer to one of the std streams.
|
||||||
|
|
||||||
2007-03-15 Eric Blake <ebb9@byu.net>
|
2007-03-15 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
* libc/stdio/local.h (cantwrite, FREEUB, FREELB): Make reentrant.
|
* libc/stdio/local.h (cantwrite, FREEUB, FREELB): Make reentrant.
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
/* Positional argument support in printf functions enabled. */
|
/* Positional argument support in printf functions enabled. */
|
||||||
#undef _WANT_IO_POS_ARGS
|
#undef _WANT_IO_POS_ARGS
|
||||||
|
|
||||||
|
/* Optional reentrant struct support. Used mostly on platforms with
|
||||||
|
very restricted storage. */
|
||||||
|
#undef _WANT_REENT_SMALL
|
||||||
|
|
||||||
/* Multibyte supported */
|
/* Multibyte supported */
|
||||||
#undef _MB_CAPABLE
|
#undef _MB_CAPABLE
|
||||||
|
|
||||||
|
23
newlib/configure
vendored
23
newlib/configure
vendored
@ -831,6 +831,7 @@ Optional Features:
|
|||||||
--enable-newlib-iconv-to-encodings enable specific comma-separated list of \"to\" iconv encodings to be built-in
|
--enable-newlib-iconv-to-encodings enable specific comma-separated list of \"to\" iconv encodings to be built-in
|
||||||
--enable-newlib-iconv-external-ccs enable capabilities to load external CCS files for iconv
|
--enable-newlib-iconv-external-ccs enable capabilities to load external CCS files for iconv
|
||||||
--disable-newlib-atexit-alloc disable dynamic allocation of atexit entries
|
--disable-newlib-atexit-alloc disable dynamic allocation of atexit entries
|
||||||
|
--enable-newlib-reent-small enable small reentrant struct support
|
||||||
--enable-multilib build many library versions (default)
|
--enable-multilib build many library versions (default)
|
||||||
--enable-target-optspace optimize for space
|
--enable-target-optspace optimize for space
|
||||||
--enable-malloc-debugging indicate malloc debugging requested
|
--enable-malloc-debugging indicate malloc debugging requested
|
||||||
@ -1464,6 +1465,19 @@ echo "$as_me: error: bad value ${enableval} for newlib-atexit-dynamic-alloc opti
|
|||||||
else
|
else
|
||||||
newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}
|
newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}
|
||||||
fi;
|
fi;
|
||||||
|
# Check whether --enable-newlib-reent-small or --disable-newlib-reent-small was given.
|
||||||
|
if test "${enable_newlib_reent_small+set}" = set; then
|
||||||
|
enableval="$enable_newlib_reent_small"
|
||||||
|
case "${enableval}" in
|
||||||
|
yes) newlib_reent_small=yes;;
|
||||||
|
no) newlib_reent_small=no ;;
|
||||||
|
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for newlib-reent-small option" >&5
|
||||||
|
echo "$as_me: error: bad value ${enableval} for newlib-reent-small option" >&2;}
|
||||||
|
{ (exit 1); exit 1; }; } ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
newlib_reent_small=
|
||||||
|
fi;
|
||||||
|
|
||||||
# Make sure we can run config.sub.
|
# Make sure we can run config.sub.
|
||||||
$ac_config_sub sun4 >/dev/null 2>&1 ||
|
$ac_config_sub sun4 >/dev/null 2>&1 ||
|
||||||
@ -4764,7 +4778,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
|
|||||||
case $host in
|
case $host in
|
||||||
*-*-irix6*)
|
*-*-irix6*)
|
||||||
# Find out which ABI we are using.
|
# Find out which ABI we are using.
|
||||||
echo '#line 4767 "configure"' > conftest.$ac_ext
|
echo '#line 4781 "configure"' > conftest.$ac_ext
|
||||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
(eval $ac_compile) 2>&5
|
(eval $ac_compile) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
@ -5204,6 +5218,13 @@ _ACEOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "${newlib_reent_small}" = "yes"; then
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define _WANT_REENT_SMALL 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if test "${newlib_mb}" = "yes"; then
|
if test "${newlib_mb}" = "yes"; then
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define _MB_CAPABLE 1
|
#define _MB_CAPABLE 1
|
||||||
|
@ -97,6 +97,15 @@ AC_ARG_ENABLE(newlib-atexit-dynamic-alloc,
|
|||||||
esac
|
esac
|
||||||
fi], [newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}])dnl
|
fi], [newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}])dnl
|
||||||
|
|
||||||
|
dnl Support --enable-newlib-reent-small
|
||||||
|
AC_ARG_ENABLE(newlib-reent-small,
|
||||||
|
[ --enable-newlib-reent-small enable small reentrant struct support],
|
||||||
|
[case "${enableval}" in
|
||||||
|
yes) newlib_reent_small=yes;;
|
||||||
|
no) newlib_reent_small=no ;;
|
||||||
|
*) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;;
|
||||||
|
esac], [newlib_reent_small=])dnl
|
||||||
|
|
||||||
NEWLIB_CONFIGURE(.)
|
NEWLIB_CONFIGURE(.)
|
||||||
|
|
||||||
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
|
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
|
||||||
@ -232,6 +241,10 @@ if test "${newlib_io_pos_args}" = "yes"; then
|
|||||||
AC_DEFINE_UNQUOTED(_WANT_IO_POS_ARGS)
|
AC_DEFINE_UNQUOTED(_WANT_IO_POS_ARGS)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "${newlib_reent_small}" = "yes"; then
|
||||||
|
AC_DEFINE_UNQUOTED(_WANT_REENT_SMALL)
|
||||||
|
fi
|
||||||
|
|
||||||
if test "${newlib_mb}" = "yes"; then
|
if test "${newlib_mb}" = "yes"; then
|
||||||
AC_DEFINE_UNQUOTED(_MB_CAPABLE)
|
AC_DEFINE_UNQUOTED(_MB_CAPABLE)
|
||||||
AC_DEFINE_UNQUOTED(_MB_LEN_MAX,8)
|
AC_DEFINE_UNQUOTED(_MB_LEN_MAX,8)
|
||||||
|
@ -202,4 +202,12 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* See if small reent asked for at configuration time and
|
||||||
|
is not chosen by the platform by default. */
|
||||||
|
#ifdef _WANT_REENT_SMALL
|
||||||
|
#ifndef _REENT_SMALL
|
||||||
|
#define _REENT_SMALL
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __SYS_CONFIG_H__ */
|
#endif /* __SYS_CONFIG_H__ */
|
||||||
|
@ -67,6 +67,22 @@ _DEFUN(fflush, (fp),
|
|||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return _fwalk (_GLOBAL_REENT, fflush);
|
return _fwalk (_GLOBAL_REENT, fflush);
|
||||||
|
|
||||||
|
#ifdef _REENT_SMALL
|
||||||
|
/* For REENT_SMALL platforms, it is possible we are being
|
||||||
|
called for the first time on a std stream. This std
|
||||||
|
stream can belong to a reentrant struct that is not
|
||||||
|
_REENT. If CHECK_INIT gets called below based on _REENT,
|
||||||
|
we will end up changing said file pointers to the equivalent
|
||||||
|
std stream off of _REENT. This causes unexpected behavior if
|
||||||
|
there is any data to flush on the _REENT std stream. There
|
||||||
|
are two alternatives to fix this: 1) make a reentrant fflush
|
||||||
|
or 2) simply recognize that this file has nothing to flush
|
||||||
|
and return immediately before performing a CHECK_INIT. Choice
|
||||||
|
2 is implemented here due to its simplicity. */
|
||||||
|
if (fp->_bf._base == NULL)
|
||||||
|
return 0;
|
||||||
|
#endif /* _REENT_SMALL */
|
||||||
|
|
||||||
CHECK_INIT (_REENT, fp);
|
CHECK_INIT (_REENT, fp);
|
||||||
|
|
||||||
_flockfile (fp);
|
_flockfile (fp);
|
||||||
|
@ -55,11 +55,11 @@ struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n));
|
|||||||
if ((ptr) && !(ptr)->__sdidinit) \
|
if ((ptr) && !(ptr)->__sdidinit) \
|
||||||
__sinit (ptr); \
|
__sinit (ptr); \
|
||||||
if ((fp) == (FILE *)&__sf_fake_stdin) \
|
if ((fp) == (FILE *)&__sf_fake_stdin) \
|
||||||
(fp) = stdin; \
|
(fp) = _stdin_r(ptr); \
|
||||||
else if ((fp) == (FILE *)&__sf_fake_stdout) \
|
else if ((fp) == (FILE *)&__sf_fake_stdout) \
|
||||||
(fp) = stdout; \
|
(fp) = _stdout_r(ptr); \
|
||||||
else if ((fp) == (FILE *)&__sf_fake_stderr) \
|
else if ((fp) == (FILE *)&__sf_fake_stderr) \
|
||||||
(fp) = stderr; \
|
(fp) = _stderr_r(ptr); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
#else /* !_REENT_SMALL */
|
#else /* !_REENT_SMALL */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* newlib.hin. Generated automatically from configure.in by autoheader. */
|
/* newlib.hin. Generated from configure.in by autoheader. */
|
||||||
#ifndef __NEWLIB_H__
|
#ifndef __NEWLIB_H__
|
||||||
|
|
||||||
#define __NEWLIB_H__ 1
|
#define __NEWLIB_H__ 1
|
||||||
@ -18,6 +18,10 @@
|
|||||||
/* Positional argument support in printf functions enabled. */
|
/* Positional argument support in printf functions enabled. */
|
||||||
#undef _WANT_IO_POS_ARGS
|
#undef _WANT_IO_POS_ARGS
|
||||||
|
|
||||||
|
/* Optional reentrant struct support. Used mostly on platforms with
|
||||||
|
very restricted storage. */
|
||||||
|
#undef _WANT_REENT_SMALL
|
||||||
|
|
||||||
/* Multibyte supported */
|
/* Multibyte supported */
|
||||||
#undef _MB_CAPABLE
|
#undef _MB_CAPABLE
|
||||||
|
|
||||||
@ -40,6 +44,7 @@
|
|||||||
|
|
||||||
/* Define if the compiler supports aliasing an array to an address. */
|
/* Define if the compiler supports aliasing an array to an address. */
|
||||||
#undef _HAVE_ARRAY_ALIASING
|
#undef _HAVE_ARRAY_ALIASING
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Iconv encodings enabled ("to" direction)
|
* Iconv encodings enabled ("to" direction)
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user