summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlastair D'Silva <alastair@d-silva.org>2016-12-23 14:26:05 (GMT)
committerAlastair D'Silva <alastair@d-silva.org>2017-01-09 23:51:32 (GMT)
commit14896a2600f99ddb86d7c100ec8e57557c013438 (patch)
tree941ba5f4e19c5475754fce22348fb5a73cbbb294 /scripts
parent2ac39621bcb8fa205029591d3e6c67d66080e001 (diff)
Support building Newlib with Link Time Optimisation
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/libc/newlib.sh23
1 files changed, 13 insertions, 10 deletions
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 442b92c..0a87581 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -116,6 +116,9 @@ ENABLE_TARGET_OPTSPACE:target-optspace
[ "${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")
cflags_for_target="${CT_TARGET_CFLAGS} ${CT_LIBC_NEWLIB_TARGET_CFLAGS}"
@@ -125,16 +128,16 @@ ENABLE_TARGET_OPTSPACE:target-optspace
# 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"