scripts: add option to strip all toolchain executables
authorRemy Bohmer <linux@bohmer.net>
Thu May 27 23:18:19 2010 +0200 (2010-05-27)
changeset 206051e4597b07fc
parent 2056 441be7e9dc78
child 2061 5744ba6e8297
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 <linux@bohmer.net>
config/global/paths.in
scripts/build/internals.sh
scripts/crosstool-NG.sh.in
     1.1 --- a/config/global/paths.in	Sun Aug 01 13:39:10 2010 +0200
     1.2 +++ b/config/global/paths.in	Thu May 27 23:18:19 2010 +0200
     1.3 @@ -78,3 +78,13 @@
     1.4        read-only.
     1.5        
     1.6        Usefull for toolchains destined for production.
     1.7 +
     1.8 +config STRIP_ALL_TOOLCHAIN_EXECUTABLES
     1.9 +    bool
    1.10 +    prompt "Strip all toolchain executables"
    1.11 +    default y
    1.12 +    help
    1.13 +      All build host executables contain a lot of unnecessary info.
    1.14 +      By stripping all executables it slightly speeds up the compilation
    1.15 +      of large projects.
    1.16 +      NOTE: It does NOT strip the target libraries, only HOST executables
     2.1 --- a/scripts/build/internals.sh	Sun Aug 01 13:39:10 2010 +0200
     2.2 +++ b/scripts/build/internals.sh	Thu May 27 23:18:19 2010 +0200
     2.3 @@ -8,6 +8,21 @@
     2.4  
     2.5      CT_DoStep INFO "Cleaning-up the toolchain's directory"
     2.6  
     2.7 +    if [ "${CT_STRIP_ALL_TOOLCHAIN_EXECUTABLES}" = "y" ]; then
     2.8 +        CT_DoLog INFO "Stripping all toolchain executables"
     2.9 +        CT_Pushd "${CT_PREFIX_DIR}"
    2.10 +	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
    2.11 +            [ -x bin/${CT_TARGET}-${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip --strip-all -v bin/${CT_TARGET}-${t}${CT_HOST_SUFFIX}
    2.12 +            [ -x ${CT_TARGET}/bin/${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip --strip-all -v ${CT_TARGET}/bin/${t}${CT_HOST_SUFFIX}
    2.13 +        done
    2.14 +        CT_Popd
    2.15 +        CT_Pushd "${CT_PREFIX_DIR}/libexec/gcc/${CT_TARGET}/${CT_CC_VERSION}"
    2.16 +	for t in cc1 cc1plus collect2; do
    2.17 +            [ -x ${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip --strip-all -v ${t}${CT_HOST_SUFFIX}
    2.18 +        done
    2.19 +        CT_Popd
    2.20 +    fi
    2.21 +
    2.22      if [ "${CT_BARE_METAL}" != "y" ]; then
    2.23          CT_DoLog EXTRA "Installing the populate helper"
    2.24          sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
     3.1 --- a/scripts/crosstool-NG.sh.in	Sun Aug 01 13:39:10 2010 +0200
     3.2 +++ b/scripts/crosstool-NG.sh.in	Thu May 27 23:18:19 2010 +0200
     3.3 @@ -441,6 +441,9 @@
     3.4                      gcj)
     3.5                          CT_TestAndAbort "Missing: '${t}${tool}${!s}' or '${t}${tool}' or '${tool}' : either needed!" "${CT_CC_LANG_JAVA}" = "y"
     3.6                          ;;
     3.7 +                    strip)
     3.8 +                        CT_TestAndAbort "Missing: '${t}${tool}${!s}' or '${t}${tool}' or '${tool}' : either needed!" "${CT_STRIP_ALL_TOOLCHAIN_EXECUTABLES}" = "y"
     3.9 +                        ;;
    3.10                      # If any other is missing, only warn at low level
    3.11                      *)
    3.12                          # It does not deserve a WARN level.