summaryrefslogtreecommitdiff
path: root/scripts/build/libc/newlib.sh
diff options
context:
space:
mode:
authorAlastair D'Silva <alastair@d-silva.org>2016-12-23 01:02:42 (GMT)
committerAlastair D'Silva <alastair@d-silva.org>2017-01-09 22:47:35 (GMT)
commit2ac39621bcb8fa205029591d3e6c67d66080e001 (patch)
tree0b6cd7b08c9a55cc9bd7c43c9966379d481947c9 /scripts/build/libc/newlib.sh
parenta2d49174dffdb9e33aa6cb53da16d84824fd4ed6 (diff)
Add more newlib options
Diffstat (limited to 'scripts/build/libc/newlib.sh')
-rw-r--r--scripts/build/libc/newlib.sh49
1 files changed, 33 insertions, 16 deletions
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 6ae579b..442b92c 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -66,16 +66,6 @@ do_libc() {
extra_config+=("--disable-multilib")
fi
- if [ "${CT_LIBC_NEWLIB_IO_C99FMT}" = "y" ]; then
- newlib_opts+=( "--enable-newlib-io-c99-formats" )
- else
- newlib_opts+=( "--disable-newlib-io-c99-formats" )
- fi
- if [ "${CT_LIBC_NEWLIB_IO_LL}" = "y" ]; then
- newlib_opts+=( "--enable-newlib-io-long-long" )
- else
- newlib_opts+=( "--disable-newlib-io-long-long" )
- fi
if [ "${CT_LIBC_NEWLIB_IO_FLOAT}" = "y" ]; then
newlib_opts+=( "--enable-newlib-io-float" )
if [ "${CT_LIBC_NEWLIB_IO_LDBL}" = "y" ]; then
@@ -87,17 +77,44 @@ do_libc() {
newlib_opts+=( "--disable-newlib-io-float" )
newlib_opts+=( "--disable-newlib-io-long-double" )
fi
+
if [ "${CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS}" = "y" ]; then
newlib_opts+=( "--disable-newlib-supplied-syscalls" )
else
newlib_opts+=( "--enable-newlib-supplied-syscalls" )
fi
- if [ "${CT_LIBC_NEWLIB_NANO_MALLOC}" = "y" ]; then
- newlib_opts+=( "--enable-newlib-nano-malloc" )
- fi
- if [ "${CT_LIBC_NEWLIB_NANO_FORMATTED_IO}" = "y" ]; then
- newlib_opts+=( "--enable-newlib-nano-formatted-io" )
- fi
+
+ yn_args="IO_POS_ARGS:newlib-io-pos-args
+IO_C99FMT:newlib-io-c99-formats
+IO_LL:newlib-io-long-long
+NEWLIB_REGISTER_FINI:newlib-register-fini
+NANO_MALLOC:newlib-nano-malloc
+NANO_FORMATTED_IO:newlib-nano-formatted-io
+ATEXIT_DYNAMIC_ALLOC:atexit-dynamic-alloc
+GLOBAL_ATEXIT:newlib-global-atexit
+LITE_EXIT:lite-exit
+REENT_SMALL:reent-small
+MULTITHREAD:multithread
+WIDE_ORIENT:newlib-wide-orient
+UNBUF_STREAM_OPT:unbuf-stream-opt
+ENABLE_TARGET_OPTSPACE:target-optspace
+ "
+
+ for ynarg in $yn_args; do
+ var="CT_LIBC_NEWLIB_${ynarg%:*}"
+ eval var=\$${var}
+ argument=${ynarg#*:}
+
+
+ if [ "${var}" = "y" ]; then
+ newlib_opts+=( "--enable-$argument" )
+ else
+ newlib_opts+=( "--disable-$argument" )
+ fi
+ done
+
+ [ "${CT_LIBC_NEWLIB_EXTRA_SECTIONS}" = "y" ] && \
+ CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -ffunction-sections -fdata-sections"
[ "${CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE}" = "y" ] && newlib_opts+=("--enable-target-optspace")