[PATCH 1/7] Add --enable-newlib-backward-binary-compat

Sebastian Huber <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Add the --enable-newlib-backward-binary-compat configure option.  This option
is disabled by default.  If enabled, then for example unused members in struct
_reent are preserved to maintain the structure layout.
---
 newlib/README                    |  5 +++++
 newlib/configure                 | 21 +++++++++++++++++++++
 newlib/configure.ac              | 15 +++++++++++++++
 newlib/libc/include/sys/config.h |  6 ++++++
 newlib/newlib.hin                |  3 +++
 5 files changed, 50 insertions(+)

diff --git a/newlib/README b/newlib/README
index 97890b9d2..54921893f 100644
--- a/newlib/README
+++ b/newlib/README
@@ -362,6 +362,11 @@ One feature can be enabled by specifying `--enable-FEATURE=yes' or
      less conversion accuracy.
      Enabled by default.
 
+`--enable-newlib-backward-binary-compat'
+     Enable backward binary compatibility.  If enabled, then for example unused
+     members in struct _reent are preserved to maintain the structure layout.
+     Disabled by default.
+
 `--enable-multilib'
      Build many library versions.
      Enabled by default.
diff --git a/newlib/configure b/newlib/configure
index c83511da6..6ea3f5631 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -983,6 +983,7 @@ enable_newlib_nano_formatted_io
 enable_newlib_retargetable_locking
 enable_newlib_long_time_t
 enable_newlib_use_gdtoa
+enable_newlib_backward_binary_compat
 enable_multilib
 enable_target_optspace
 enable_malloc_debugging
@@ -1650,6 +1651,7 @@ Optional Features:
   --enable-newlib-retargetable-locking    Allow locking routines to be retargeted at link time
   --enable-newlib-long-time_t   define time_t to long
   --enable-newlib-use-gdtoa   Use gdtoa rather than legacy ldtoa
+  --enable-newlib-backward-binary-compat   enable backward binary compatibility
   --enable-multilib       build many library versions (default)
   --enable-target-optspace  optimize for space
   --enable-malloc-debugging indicate malloc debugging requested
@@ -2552,6 +2554,19 @@ else
   newlib_use_gdtoa=yes
 fi
 
+# Check whether --enable-newlib-backward-binary-compat was given.
+if test "${enable_newlib_backward_binary_compat+set}" = set; then :
+  enableval=$enable_newlib_backward_binary_compat; if test "${newlib_enable_backward_binary_compat+set}" != set; then
+  case "${enableval}" in
+    yes) newlib_enable_backward_binary_compat=yes ;;
+    no)  newlib_enable_backward_binary_compat=no  ;;
+    *)   as_fn_error $? "bad value ${enableval} for newlib-enable-backward-binary-compat option" "$LINENO" 5 ;;
+  esac
+ fi
+else
+  newlib_enable_backward_binary_compat=no
+fi
+
 # Default to --enable-multilib
 # Check whether --enable-multilib was given.
 if test "${enable_multilib+set}" = set; then :
@@ -6529,6 +6544,12 @@ $as_echo "#define _WANT_USE_GDTOA 1" >>confdefs.h
 
 fi
 
+if test "${newlib_enable_backward_binary_compat}" = "yes"; then
+
+$as_echo "#define _WANT_NEWLIB_BACKWARD_BINARY_COMPAT 1" >>confdefs.h
+
+fi
+
 
 if test "x${iconv_encodings}" != "x" \
    || test "x${iconv_to_encodings}" != "x" \
diff --git a/newlib/configure.ac b/newlib/configure.ac
index 195d336f2..556580967 100644
--- a/newlib/configure.ac
+++ b/newlib/configure.ac
@@ -288,6 +288,17 @@ AC_ARG_ENABLE(newlib-use-gdtoa,
   esac
  fi], [newlib_use_gdtoa=yes])dnl
 
+dnl Support --enable-newlib-backward-binary-compat
+AC_ARG_ENABLE(newlib-backward-binary-compat,
+[  --enable-newlib-backward-binary-compat   enable backward binary compatibility],
+[if test "${newlib_enable_backward_binary_compat+set}" != set; then
+  case "${enableval}" in
+    yes) newlib_enable_backward_binary_compat=yes ;;
+    no)  newlib_enable_backward_binary_compat=no  ;;
+    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-enable-backward-binary-compat option) ;;
+  esac
+ fi], [newlib_enable_backward_binary_compat=no])dnl
+
 AM_ENABLE_MULTILIB(, ..)
 NEWLIB_CONFIGURE(.)
 
@@ -499,6 +510,10 @@ if test "${newlib_use_gdtoa}" = "yes"; then
   AC_DEFINE(_WANT_USE_GDTOA, 1, [Define if using gdtoa rather than legacy ldtoa.])
 fi
 
+if test "${newlib_enable_backward_binary_compat}" = "yes"; then
+  AC_DEFINE(_WANT_NEWLIB_BACKWARD_BINARY_COMPAT, 1, [Define to enable backward binary compatibility.])
+fi
+
 dnl
 dnl Parse --enable-newlib-iconv-encodings option argument
 dnl
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
index 61a6f95d8..fbc1e0fe1 100644
--- a/newlib/libc/include/sys/config.h
+++ b/newlib/libc/include/sys/config.h
@@ -299,6 +299,12 @@
 #endif
 #endif
 
+#ifdef _WANT_NEWLIB_BACKWARD_BINARY_COMPAT
+#ifndef _NEWLIB_BACKWARD_BINARY_COMPAT
+#define _NEWLIB_BACKWARD_BINARY_COMPAT
+#endif
+#endif
+
 /* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended
    charsets.  The extended charsets add a few functions and a couple
    of tables of a few K each. */
diff --git a/newlib/newlib.hin b/newlib/newlib.hin
index b52bc7460..cf3086c32 100644
--- a/newlib/newlib.hin
+++ b/newlib/newlib.hin
@@ -402,6 +402,9 @@
 /* Positional argument support in printf functions enabled. */
 #undef _WANT_IO_POS_ARGS
 
+/* Define to enable backward binary compatibility. */
+#undef _WANT_NEWLIB_BACKWARD_BINARY_COMPAT
+
 /* 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
    point to the global stdio FILE stream objects. */
-- 
2.35.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.