aboutsummaryrefslogtreecommitdiff
path: root/newlib/configure.in
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2016-10-25 17:38:19 +0100
committerJeff Johnston <jjohnstn@redhat.com>2017-02-13 17:07:11 -0500
commitbd54749095ee45d7136b6e7c8a1e5218749c87b6 (patch)
tree44af0f859a2f5f43d7bf62d92caa2ae27a9eabe2 /newlib/configure.in
parentfa55c610facaae12e38d90d14e44fecd1259b3ab (diff)
downloadnewlib-bd54749095ee45d7136b6e7c8a1e5218749c87b6.zip
newlib-bd54749095ee45d7136b6e7c8a1e5218749c87b6.tar.gz
newlib-bd54749095ee45d7136b6e7c8a1e5218749c87b6.tar.bz2
Allow locking routine to be retargeted
At the moment when targeting bare-metal targets or systems without definition for the locking primitives newlib, uses dummy empty macros. This has the advantage of reduced size and faster implementation but does not allow the application to retarget the locking routines. Retargeting is useful for a single toolchain to support multiple systems since then it's only at link time that you know which system you are targeting. This patch adds a new configure option --enable-newlib-retargetable-locking to use dummy empty functions instead of dummy empty macros. The default is to keep the current behavior to not have any size or speed impact on targets not interested in this feature. To allow for any size of lock, the _LOCK_T type is changed into pointer to struct _lock and the _init function are tasked with allocating the locks. The platform being targeted must provide the static locks. A dummy implementation of the locking routines and static lock is provided for single-threaded applications to link successfully out of the box. To ensure that the behavior is consistent (either no locking whatsoever or working locking), the dummy implementation is strongly defined such that a partial retargeting will cause a doubly defined link error. Indeed, the linker will only pull in the file providing the dummy implementation if it cannot find an implementation for one of the routine or lock.
Diffstat (limited to 'newlib/configure.in')
-rw-r--r--newlib/configure.in15
1 files changed, 15 insertions, 0 deletions
diff --git a/newlib/configure.in b/newlib/configure.in
index bfaf038..354c07c 100644
--- a/newlib/configure.in
+++ b/newlib/configure.in
@@ -218,6 +218,17 @@ AC_ARG_ENABLE(newlib_nano_formatted_io,
*) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-formatted-io) ;;
esac],[newlib_nano_formatted_io=no])
+dnl Support --enable-retargetable-locking
+dnl This option is also read in libc/configure.in. It is repeated
+dnl here so that it shows up in the help text.
+AC_ARG_ENABLE(newlib-retargetable-locking,
+[ --enable-newlib-retargetable-locking Allow locking routines to be retargeted at link time],
+[case "${enableval}" in
+ yes) newlib_retargetable_locking=yes ;;
+ no) newlib_retargetable_locking=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for newlib-retargetable-locking) ;;
+ esac],[newlib_retargetable_locking=no])
+
NEWLIB_CONFIGURE(.)
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
@@ -458,6 +469,10 @@ if test "${newlib_nano_formatted_io}" = "yes"; then
AC_DEFINE_UNQUOTED(_NANO_FORMATTED_IO)
fi
+if test "${newlib_retargetable_locking}" = "yes"; then
+AC_DEFINE_UNQUOTED(_RETARGETABLE_LOCKING)
+fi
+
dnl
dnl Parse --enable-newlib-iconv-encodings option argument
dnl