public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: newlib@sourceware.org
Subject: [PATCH 1/7] Add --enable-newlib-backward-binary-compat
Date: Fri, 13 May 2022 15:46:54 +0200	[thread overview]
Message-ID: <20220513134700.68563-2-sebastian.huber@embedded-brains.de> (raw)
In-Reply-To: <20220513134700.68563-1-sebastian.huber@embedded-brains.de>

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


  reply	other threads:[~2022-05-13 13:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 13:46 [PATCH 0/7] Add --enable-newlib-backward-binary-compat configure option Sebastian Huber
2022-05-13 13:46 ` Sebastian Huber [this message]
2022-05-13 13:46 ` [PATCH 2/7] Cygwin: Enable backward binary compatibility Sebastian Huber
2022-05-13 20:15   ` Corinna Vinschen
2022-05-16  5:31     ` Sebastian Huber
2022-05-16 11:09       ` Corinna Vinschen
2022-05-13 13:46 ` [PATCH 3/7] Optional struct _reent::__unused_sdidinit Sebastian Huber
2022-05-13 13:46 ` [PATCH 4/7] Optional struct _reent::_unspecified_locale_info Sebastian Huber
2022-05-13 13:46 ` [PATCH 5/7] Optional struct _reent::_new::_unused Sebastian Huber
2022-05-13 13:46 ` [PATCH 6/7] Optional struct _reent::_new::_reent::_unused_rand Sebastian Huber
2022-05-13 13:47 ` [PATCH 7/7] Use global atexit data for all configurations Sebastian Huber
2022-05-13 16:30   ` Sebastian Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220513134700.68563-2-sebastian.huber@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).