mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-19 04:47:52 +00:00
Merge pull request #519 from InfernoEmbedded/newlib-enhancements
Newlib enhancements
This commit is contained in:
commit
eff79ab714
@ -26,6 +26,41 @@ config LIBC_NEWLIB_IO_LDBL
|
||||
help
|
||||
Enable support for IOs on long doubles.
|
||||
|
||||
config LIBC_NEWLIB_IO_POS_ARGS
|
||||
bool
|
||||
prompt "Enable printf-family positional arg support"
|
||||
help
|
||||
Enable printf-family positional arg support.
|
||||
|
||||
config LIBC_NEWLIB_FVWRITE_IN_STREAMIO
|
||||
bool
|
||||
prompt "Vector buffer mechanism to support stream IO buffering"
|
||||
default y
|
||||
help
|
||||
NEWLIB implements the vector buffer mechanism to support stream IO
|
||||
buffering required by C standard. This feature is possibly
|
||||
unnecessary for embedded systems which won't change file buffering
|
||||
with functions like `setbuf' or `setvbuf'. The buffering mechanism
|
||||
still acts as default for STDIN/STDOUT/STDERR even if this option
|
||||
is specified.
|
||||
|
||||
config LIBC_NEWLIB_UNBUF_STREAM_OPT
|
||||
bool
|
||||
prompt "Optimize fprintf to unbuffered unix file"
|
||||
default y
|
||||
help
|
||||
NEWLIB does optimization when `fprintf to write only unbuffered unix
|
||||
file'. It creates a temorary buffer to do the optimization that
|
||||
increases stack consumption by about `BUFSIZ' bytes. Disabling this option
|
||||
disables the optimization and saves size of text and stack.
|
||||
|
||||
config LIBC_NEWLIB_FSEEK_OPTIMIZATION
|
||||
bool
|
||||
prompt "Fseek optimisation"
|
||||
default y
|
||||
help
|
||||
Disabling fseek optimisation can decrease code size.
|
||||
|
||||
config LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS
|
||||
bool
|
||||
prompt "Disable the syscalls supplied with newlib"
|
||||
@ -35,15 +70,82 @@ config LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS
|
||||
_write... If you plan to port newlib to a new
|
||||
platform/board, say Yes.
|
||||
|
||||
config LIBC_NEWLIB_REGISTER_FINI
|
||||
bool
|
||||
prompt "Enable finalization function registration using atexit"
|
||||
help
|
||||
Enable finalization function registration using atexit.
|
||||
|
||||
config LIBC_NEWLIB_ATEXIT_DYNAMIC_ALLOC
|
||||
bool
|
||||
prompt "Enable dynamic allocation of atexit entries"
|
||||
default y
|
||||
help
|
||||
Enable dynamic allocation of atexit entries.
|
||||
|
||||
config LIBC_NEWLIB_GLOBAL_ATEXIT
|
||||
bool
|
||||
prompt "Enable atexit data structure as global variable"
|
||||
help
|
||||
Enable atexit data structure as global variable. By doing so it is
|
||||
move out of _reent structure, and can be garbage collected if atexit
|
||||
is not referenced.
|
||||
|
||||
config LIBC_NEWLIB_LITE_EXIT
|
||||
bool
|
||||
prompt "Enable lite exit"
|
||||
help
|
||||
Enable lite exit, a size-reduced implementation of exit that doesn't
|
||||
invoke clean-up functions such as _fini or global destructors.
|
||||
|
||||
config LIBC_NEWLIB_REENT_SMALL
|
||||
bool
|
||||
prompt "Enable small reentrant struct support"
|
||||
help
|
||||
Enable small reentrant struct support.
|
||||
|
||||
config LIBC_NEWLIB_MULTITHREAD
|
||||
bool
|
||||
prompt "Enable support for multiple threads"
|
||||
default y
|
||||
help
|
||||
Enable support for multiple threads.
|
||||
|
||||
config LIBC_NEWLIB_EXTRA_SECTIONS
|
||||
bool
|
||||
prompt "Place each function & data element in their own section"
|
||||
help
|
||||
Place each function & data symbol in their own section. This allows
|
||||
the linker to garbage collect unused symbols at link time.
|
||||
|
||||
config LIBC_NEWLIB_WIDE_ORIENT
|
||||
bool
|
||||
prompt "Allow wide C99 stream orientation"
|
||||
default y
|
||||
help
|
||||
C99 states that each stream has an orientation, wide or byte. This
|
||||
feature is possibly unnecessary for embedded systems which only do
|
||||
byte input/output operations on stream. Disabling this feature can
|
||||
decrease code size.
|
||||
|
||||
config LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE
|
||||
bool
|
||||
prompt "Optimize newlib for size"
|
||||
default y
|
||||
help
|
||||
Pass --enable-target-optspace to newlib configure.
|
||||
|
||||
|
||||
This will compile newlib with -Os.
|
||||
|
||||
config LIBC_NEWLIB_LTO
|
||||
bool
|
||||
prompt "Enable Link Time Optimization"
|
||||
help
|
||||
Builds the libraries with -flto to enable more aggressive link time
|
||||
optimization. You will need to add -flto-partition=one to your
|
||||
application's link line to keep the RETURN assembler macro together
|
||||
with it's consumers.
|
||||
|
||||
config LIBC_NEWLIB_NANO_MALLOC
|
||||
bool
|
||||
prompt "Enable Nano Malloc"
|
||||
|
28
samples/arm-nano-eabi/crosstool.config
Normal file
28
samples/arm-nano-eabi/crosstool.config
Normal file
@ -0,0 +1,28 @@
|
||||
CT_LOCAL_TARBALLS_DIR="${HOME}/src"
|
||||
CT_SAVE_TARBALLS=y
|
||||
CT_LOG_EXTRA=y
|
||||
CT_ARCH_FLOAT_SW=y
|
||||
CT_ARCH_arm=y
|
||||
CT_LIBC_NEWLIB_IO_C99FMT=y
|
||||
CT_LIBC_NEWLIB_IO_LL=y
|
||||
CT_LIBC_NEWLIB_IO_FLOAT=n
|
||||
CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS=y
|
||||
CT_CC_LANG_CXX=y
|
||||
CT_LIBC_NEWLIB_IO_POS_ARGS=n
|
||||
CT_LIBC_NEWLIB_FVWRITE_IN_STREAMIO=n
|
||||
CT_LIBC_NEWLIB_UNBUF_STREAM_OPT=n
|
||||
CT_LIBC_NEWLIB_FSEEK_OPTIMIZATION=n
|
||||
CT_LIBC_NEWLIB_REGISTER_FINI=n
|
||||
CT_LIBC_NEWLIB_ATEXIT_DYNAMIC_ALLOC=n
|
||||
CT_LIBC_NEWLIB_GLOBAL_ATEXIT=y
|
||||
CT_LIBC_NEWLIB_LITE_EXIT=y
|
||||
CT_LIBC_NEWLIB_REENT_SMALL=y
|
||||
CT_LIBC_NEWLIB_MULTITHREAD=n
|
||||
CT_LIBC_NEWLIB_EXTRA_SECTIONS=y
|
||||
CT_LIBC_NEWLIB_WIDE_ORIENT=n
|
||||
CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE=y
|
||||
CT_LIBC_NEWLIB_NANO_MALLOC=y
|
||||
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
|
||||
CT_LIBC_NEWLIB_LTO=y
|
||||
CT_MULTILIB=y
|
||||
|
3
samples/arm-nano-eabi/reported.by
Normal file
3
samples/arm-nano-eabi/reported.by
Normal file
@ -0,0 +1,3 @@
|
||||
reporter_name="Alastair D'Silva"
|
||||
reporter_url="http://alastair.d-silva.org/"
|
||||
reporter_comment="Based on arm-unknown-eabi"
|
@ -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,47 @@ 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_LTO}" = "y" ] && \
|
||||
CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -flto"
|
||||
|
||||
[ "${CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE}" = "y" ] && newlib_opts+=("--enable-target-optspace")
|
||||
|
||||
@ -108,16 +128,16 @@ do_libc() {
|
||||
# build : not used
|
||||
# host : the machine building newlib
|
||||
# target : the machine newlib runs on
|
||||
CT_DoExecLog CFG \
|
||||
CC_FOR_BUILD="${CT_BUILD}-gcc" \
|
||||
CFLAGS_FOR_TARGET="${cflags_for_target}" \
|
||||
AR=${CT_TARGET}-ar \
|
||||
RANLIB=${CT_TARGET}-ranlib \
|
||||
"${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \
|
||||
--host=${CT_BUILD} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix=${CT_PREFIX_DIR} \
|
||||
"${newlib_opts[@]}" \
|
||||
CT_DoExecLog CFG \
|
||||
CC_FOR_BUILD="${CT_BUILD}-gcc" \
|
||||
CFLAGS_FOR_TARGET="${cflags_for_target}" \
|
||||
AR_FOR_TARGET="`which ${CT_TARGET}-gcc-ar`" \
|
||||
RANLIB_FOR_TARGET="`which ${CT_TARGET}-gcc-ranlib`" \
|
||||
"${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/configure" \
|
||||
--host=${CT_BUILD} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix=${CT_PREFIX_DIR} \
|
||||
"${newlib_opts[@]}" \
|
||||
"${CT_LIBC_NEWLIB_EXTRA_CONFIG_ARRAY[@]}"
|
||||
|
||||
CT_DoLog EXTRA "Building C library"
|
||||
|
Loading…
Reference in New Issue
Block a user