# HG changeset patch # User Remy Bohmer # Date 1274995099 -7200 # Node ID 51e4597b07fc14e62aaecd22bb6f282606205b6a # Parent 441be7e9dc789e73bdd24875ea0375bf5efb1105 scripts: add option to strip all toolchain executables To reduce filesizes of the toolchain and even improve build times of projects to be build with this toolchain it is usefull to strip the delivered toolchain executables. Since it is not likely that we will debug the toolchain executables itself we do not need the debug information inside the executables itself. Signed-off-by: Remy Bohmer diff -r 441be7e9dc78 -r 51e4597b07fc config/global/paths.in --- a/config/global/paths.in Sun Aug 01 13:39:10 2010 +0200 +++ b/config/global/paths.in Thu May 27 23:18:19 2010 +0200 @@ -78,3 +78,13 @@ read-only. Usefull for toolchains destined for production. + +config STRIP_ALL_TOOLCHAIN_EXECUTABLES + bool + prompt "Strip all toolchain executables" + default y + help + All build host executables contain a lot of unnecessary info. + By stripping all executables it slightly speeds up the compilation + of large projects. + NOTE: It does NOT strip the target libraries, only HOST executables diff -r 441be7e9dc78 -r 51e4597b07fc scripts/build/internals.sh --- a/scripts/build/internals.sh Sun Aug 01 13:39:10 2010 +0200 +++ b/scripts/build/internals.sh Thu May 27 23:18:19 2010 +0200 @@ -8,6 +8,21 @@ CT_DoStep INFO "Cleaning-up the toolchain's directory" + if [ "${CT_STRIP_ALL_TOOLCHAIN_EXECUTABLES}" = "y" ]; then + CT_DoLog INFO "Stripping all toolchain executables" + CT_Pushd "${CT_PREFIX_DIR}" + for t in ar as c++ c++filt cpp dlltool dllwrap g++ gcc gcc-${CT_CC_VERSION} gcov gprof ld nm objcopy objdump ranlib readelf size strings strip addr2line windmc windres; do + [ -x bin/${CT_TARGET}-${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip --strip-all -v bin/${CT_TARGET}-${t}${CT_HOST_SUFFIX} + [ -x ${CT_TARGET}/bin/${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip --strip-all -v ${CT_TARGET}/bin/${t}${CT_HOST_SUFFIX} + done + CT_Popd + CT_Pushd "${CT_PREFIX_DIR}/libexec/gcc/${CT_TARGET}/${CT_CC_VERSION}" + for t in cc1 cc1plus collect2; do + [ -x ${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip --strip-all -v ${t}${CT_HOST_SUFFIX} + done + CT_Popd + fi + if [ "${CT_BARE_METAL}" != "y" ]; then CT_DoLog EXTRA "Installing the populate helper" sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \ diff -r 441be7e9dc78 -r 51e4597b07fc scripts/crosstool-NG.sh.in --- a/scripts/crosstool-NG.sh.in Sun Aug 01 13:39:10 2010 +0200 +++ b/scripts/crosstool-NG.sh.in Thu May 27 23:18:19 2010 +0200 @@ -441,6 +441,9 @@ gcj) CT_TestAndAbort "Missing: '${t}${tool}${!s}' or '${t}${tool}' or '${tool}' : either needed!" "${CT_CC_LANG_JAVA}" = "y" ;; + strip) + CT_TestAndAbort "Missing: '${t}${tool}${!s}' or '${t}${tool}' or '${tool}' : either needed!" "${CT_STRIP_ALL_TOOLCHAIN_EXECUTABLES}" = "y" + ;; # If any other is missing, only warn at low level *) # It does not deserve a WARN level.