Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/arc.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array"
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
Expand Down
1 change: 1 addition & 0 deletions configs/arm.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array"
CT_CC_GCC_MULTILIB_LIST="rmprofile"
CT_CC_LANG_CXX=y
Expand Down
1 change: 1 addition & 0 deletions configs/i586.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array"
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
Expand Down
1 change: 1 addition & 0 deletions configs/iamcu.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array"
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
Expand Down
1 change: 1 addition & 0 deletions configs/mips.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array"
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
Expand Down
1 change: 1 addition & 0 deletions configs/nios2.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array"
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
Expand Down
1 change: 1 addition & 0 deletions configs/riscv64.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array"
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
Expand Down
1 change: 1 addition & 0 deletions configs/x86_64-zephyr-elf.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array --with-cpu-32=i586 --with-arch-32=i586 --with-cpu-64=generic --with-arch-64=x86-64"
# CT_CC_GCC_LIBMPX is not set
CT_CC_LANG_CXX=y
Expand Down
1 change: 1 addition & 0 deletions configs/xtensa_sample_controller.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CT_LIBC_NEWLIB_LITE_EXIT=y
# CT_LIBC_NEWLIB_WIDE_ORIENT is not set
CT_LIBC_NEWLIB_NANO_MALLOC=y
CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y
CT_LIBC_NEWLIB_NANO_SPEC=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array"
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
Expand Down
1 change: 1 addition & 0 deletions go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ if [ ! -d "crosstool-ng" ]; then
echo "Patching tree"
pushd crosstool-ng
git checkout ${COMMIT}
patch -p1 < ${GITDIR}/patches/0001-Add-config-option-to-setup-files-according-to-nano.s.patch
popd
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
From 4b07cb34a3f292c78f63069dcfe63f0e57195b9f Mon Sep 17 00:00:00 2001
From: Kumar Gala <[email protected]>
Date: Tue, 27 Aug 2019 08:55:41 -0500
Subject: [PATCH] Add config option to setup files according to nano.spec

Introduce config option LIBC_NEWLIB_NANO_SPEC that will have the build
setup file layout as aspected by nano.spec. This renames
lib{c,g,rdimon,stdc++,supc++}.a -> lib{c,g,rdimon,stdc++,supc++}_nano.a.
It also installs newlib.h in newlib-nano/newlib.h

Signed-off-by: Kumar Gala <[email protected]>
---
config/libc/newlib.in | 9 +++++++++
scripts/build/libc/newlib.sh | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)

diff --git a/config/libc/newlib.in b/config/libc/newlib.in
index 268f9564..29dd5149 100644
--- a/config/libc/newlib.in
+++ b/config/libc/newlib.in
@@ -209,6 +209,15 @@ config LIBC_NEWLIB_NANO_FORMATTED_IO
with size constraint issues. This option does not affect wide-char
formatted I/O functions.

+config LIBC_NEWLIB_NANO_SPEC
+ bool
+ prompt "Enable Nano SPEC layout"
+ depends on LIBC_NEWLIB_NANO_MALLOC || LIBC_NEWLIB_NANO_FORMATTED_IO
+ help
+ Layout files according to what the nano.spec file expects. This renames
+ lib{c,g,rdimon,stdc++,supc++}.a to have a nano postfix (ie libc_nano.a).
+ Also moves newlib.h to newlib-nano/newlib.h.
+
config LIBC_NEWLIB_EXTRA_CONFIG_ARRAY
string
prompt "Extra config for newlib"
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 95ab7910..e12adde5 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -5,6 +5,30 @@
# Edited by Martin Lund <[email protected]>
#

+newlib_nano_movelibs()
+{
+ local multi_flags multi_dir multi_os_dir multi_os_dir_gcc multi_root multi_index multi_count
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoExecLog ALL mv "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/libc.a" \
+ "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/libc_nano.a"
+ CT_DoExecLog ALL mv "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/libg.a" \
+ "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/libg_nano.a"
+ if [ -f ${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/librdimon.a ]; then
+ CT_DoExecLog ALL mv "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/librdimon.a" \
+ "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/librdimon_nano.a"
+ fi
+ if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" ]; then
+ CT_DoExecLog ALL mv "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/libstdc++.a" \
+ "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/libstdc++_nano.a"
+ CT_DoExecLog ALL mv "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/libsupc++.a" \
+ "${CT_PREFIX_DIR}/${CT_TARGET}/lib/${multi_dir}/libsupc++_nano.a"
+ fi
+}
+
newlib_start_files()
{
CT_DoStep INFO "Installing C library headers & start files"
@@ -131,3 +155,15 @@ ENABLE_TARGET_OPTSPACE:target-optspace
CT_Popd
CT_EndStep
}
+
+newlib_post_cc()
+{
+ if [ "${CT_LIBC_NEWLIB_NANO_SPEC}" = "y" ]; then
+ CT_DoLog EXTRA "Move files to match nano.spec layout"
+ CT_IterateMultilibs newlib_nano_movelibs newlib_nano_libs
+
+ CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}/${CT_TARGET}/include/newlib-nano"
+ CT_DoExecLog ALL mv "${CT_PREFIX_DIR}/${CT_TARGET}/include/newlib.h" \
+ "${CT_PREFIX_DIR}/${CT_TARGET}/include/newlib-nano"
+ fi
+}
--
2.20.1