Add --enable-newlib-reent-binary-compat

Add the --enable-newlib-reent-binary-compat configure option.  This option is
disabled by default.  If enabled, then unused members in struct _reent are
preserved to maintain the structure layout.
This commit is contained in:
Sebastian Huber 2022-05-13 13:55:06 +02:00
parent 5c7af4227d
commit 065d77dd02
5 changed files with 51 additions and 0 deletions

View File

@ -310,6 +310,12 @@ One feature can be enabled by specifying `--enable-FEATURE=yes' or
Enable small reentrant struct support. Enable small reentrant struct support.
Disabled by default. Disabled by default.
`--enable-newlib-reent-binary-compat'
Enable backward binary compatibility for struct _reent. If enabled, then
unused members in struct _reent are preserved to maintain the structure
layout.
Disabled by default.
`--disable-newlib-fvwrite-in-streamio' `--disable-newlib-fvwrite-in-streamio'
NEWLIB implements the vector buffer mechanism to support stream IO NEWLIB implements the vector buffer mechanism to support stream IO
buffering required by C standard. This feature is possibly buffering required by C standard. This feature is possibly

21
newlib/configure vendored
View File

@ -972,6 +972,7 @@ enable_newlib_iconv_external_ccs
enable_newlib_atexit_dynamic_alloc enable_newlib_atexit_dynamic_alloc
enable_newlib_global_atexit enable_newlib_global_atexit
enable_newlib_reent_small enable_newlib_reent_small
enable_newlib_reent_binary_compat
enable_newlib_global_stdio_streams enable_newlib_global_stdio_streams
enable_newlib_fvwrite_in_streamio enable_newlib_fvwrite_in_streamio
enable_newlib_fseek_optimization enable_newlib_fseek_optimization
@ -1639,6 +1640,7 @@ Optional Features:
--disable-newlib-atexit-dynamic-alloc disable dynamic allocation of atexit entries --disable-newlib-atexit-dynamic-alloc disable dynamic allocation of atexit entries
--enable-newlib-global-atexit enable atexit data structure as global --enable-newlib-global-atexit enable atexit data structure as global
--enable-newlib-reent-small enable small reentrant struct support --enable-newlib-reent-small enable small reentrant struct support
--enable-newlib-reent-binary-compat enable backward binary compatibility for struct _reent
--enable-newlib-global-stdio-streams enable global stdio streams --enable-newlib-global-stdio-streams enable global stdio streams
--disable-newlib-fvwrite-in-streamio disable iov in streamio --disable-newlib-fvwrite-in-streamio disable iov in streamio
--disable-newlib-fseek-optimization disable fseek optimization --disable-newlib-fseek-optimization disable fseek optimization
@ -2390,6 +2392,19 @@ else
newlib_reent_small= newlib_reent_small=
fi fi
# Check whether --enable-newlib-reent-binary-compat was given.
if test "${enable_newlib_reent_binary_compat+set}" = set; then :
enableval=$enable_newlib_reent_binary_compat; if test "${newlib_reent_binary_compat+set}" != set; then
case "${enableval}" in
yes) newlib_reent_binary_compat=yes ;;
no) newlib_reent_binary_compat=no ;;
*) as_fn_error $? "bad value ${enableval} for newlib-enable-reent-binary-compat option" "$LINENO" 5 ;;
esac
fi
else
newlib_reent_binary_compat=no
fi
# Check whether --enable-newlib-global-stdio-streams was given. # Check whether --enable-newlib-global-stdio-streams was given.
if test "${enable_newlib_global_stdio_streams+set}" = set; then : if test "${enable_newlib_global_stdio_streams+set}" = set; then :
enableval=$enable_newlib_global_stdio_streams; case "${enableval}" in enableval=$enable_newlib_global_stdio_streams; case "${enableval}" in
@ -6418,6 +6433,12 @@ $as_echo "#define _WANT_REENT_SMALL 1" >>confdefs.h
fi fi
if test "${newlib_reent_binary_compat}" = "yes"; then
$as_echo "#define _WANT_REENT_BACKWARD_BINARY_COMPAT 1" >>confdefs.h
fi
if test "${newlib_global_stdio_streams}" = "yes"; then if test "${newlib_global_stdio_streams}" = "yes"; then
$as_echo "#define _WANT_REENT_GLOBAL_STDIO_STREAMS 1" >>confdefs.h $as_echo "#define _WANT_REENT_GLOBAL_STDIO_STREAMS 1" >>confdefs.h

View File

@ -162,6 +162,17 @@ AC_ARG_ENABLE(newlib-reent-small,
*) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;; *) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;;
esac], [newlib_reent_small=])dnl esac], [newlib_reent_small=])dnl
dnl Support --enable-newlib-reent-binary-compat
AC_ARG_ENABLE(newlib-reent-binary-compat,
[ --enable-newlib-reent-binary-compat enable backward binary compatibility for struct _reent],
[if test "${newlib_reent_binary_compat+set}" != set; then
case "${enableval}" in
yes) newlib_reent_binary_compat=yes ;;
no) newlib_reent_binary_compat=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-enable-reent-binary-compat option) ;;
esac
fi], [newlib_reent_binary_compat=no])dnl
dnl Support --enable-newlib-global-stdio-streams dnl Support --enable-newlib-global-stdio-streams
AC_ARG_ENABLE(newlib-global-stdio-streams, AC_ARG_ENABLE(newlib-global-stdio-streams,
[ --enable-newlib-global-stdio-streams enable global stdio streams], [ --enable-newlib-global-stdio-streams enable global stdio streams],
@ -420,6 +431,10 @@ if test "${newlib_reent_small}" = "yes"; then
AC_DEFINE(_WANT_REENT_SMALL, 1, [Optional reentrant struct support. Used mostly on platforms with very restricted storage.]) AC_DEFINE(_WANT_REENT_SMALL, 1, [Optional reentrant struct support. Used mostly on platforms with very restricted storage.])
fi fi
if test "${newlib_reent_binary_compat}" = "yes"; then
AC_DEFINE(_WANT_REENT_BACKWARD_BINARY_COMPAT, 1, [Define to enable backward binary compatibility for struct _reent.])
fi
if test "${newlib_global_stdio_streams}" = "yes"; then if test "${newlib_global_stdio_streams}" = "yes"; then
AC_DEFINE(_WANT_REENT_GLOBAL_STDIO_STREAMS, 1, AC_DEFINE(_WANT_REENT_GLOBAL_STDIO_STREAMS, 1,
[Define to move the stdio stream FILE objects out of struct _reent and make them global. [Define to move the stdio stream FILE objects out of struct _reent and make them global.

View File

@ -299,6 +299,12 @@
#endif #endif
#endif #endif
#ifdef _WANT_REENT_BACKWARD_BINARY_COMPAT
#ifndef _REENT_BACKWARD_BINARY_COMPAT
#define _REENT_BACKWARD_BINARY_COMPAT
#endif
#endif
/* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended /* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended
charsets. The extended charsets add a few functions and a couple charsets. The extended charsets add a few functions and a couple
of tables of a few K each. */ of tables of a few K each. */

View File

@ -402,6 +402,9 @@
/* Positional argument support in printf functions enabled. */ /* Positional argument support in printf functions enabled. */
#undef _WANT_IO_POS_ARGS #undef _WANT_IO_POS_ARGS
/* Define to enable backward binary compatibility for struct _reent. */
#undef _WANT_REENT_BACKWARD_BINARY_COMPAT
/* Define to move the stdio stream FILE objects out of struct _reent and make /* Define to move the stdio stream FILE objects out of struct _reent and make
them global. The stdio stream pointers of struct _reent are initialized to them global. The stdio stream pointers of struct _reent are initialized to
point to the global stdio FILE stream objects. */ point to the global stdio FILE stream objects. */