From 3049c4c1e2483c4109add23738ec838baf42c56e Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 29 May 2015 21:40:47 +0100 Subject: multi_cc: Prepare ct-ng for multiple compilers This commit moves gcc.sh to 100-gcc.sh to accomodate for other cross-compilers that crosstool-ng might be able to build. The first, to come soon, is llvm/clang. Signed-off-by: Ray Donnelly Reviewed-by: Bryan Hundven Reviewed-by: Yann Diorcet diff --git a/scripts/build/cc.sh b/scripts/build/cc.sh new file mode 100644 index 0000000..3c8aaef --- /dev/null +++ b/scripts/build/cc.sh @@ -0,0 +1,58 @@ +# Wrapper to build the companion tools facilities + +# List all companion tools facilities, and parse their scripts +CT_CC_FACILITY_LIST= +for f in "${CT_LIB_DIR}/scripts/build/cc/"*.sh; do + _f="$(basename "${f}" .sh)" + _f="${_f#???-}" + __f="CT_CC_${_f}" + if [ "${!__f}" = "y" ]; then + CT_DoLog DEBUG "Enabling cc '${_f}'" + . "${f}" + CT_CC_FACILITY_LIST="${CT_CC_FACILITY_LIST} ${_f}" + else + CT_DoLog DEBUG "Disabling cc '${_f}'" + fi +done + +# Download the cc facilities +do_cc_get() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_get + done +} + +# Extract and patch the cc facilities +do_cc_extract() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_extract + done +} + +# Core pass 1 the cc facilities +do_cc_core_pass_1() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_core_pass_1 + done +} + +# Core pass 2 the cc facilities +do_cc_core_pass_2() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_core_pass_2 + done +} + +# Build for build the cc facilities +do_cc_for_build() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_for_build + done +} + +# Build for host the cc facilities +do_cc_for_host() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_for_host + done +} diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh new file mode 100644 index 0000000..835aea0 --- /dev/null +++ b/scripts/build/cc/100-gcc.sh @@ -0,0 +1,911 @@ +# This file adds the function to build the gcc C compiler +# Copyright 2007 Yann E. MORIN +# Licensed under the GPL v2. See COPYING in the root of this package + +# Download gcc +do_cc_get() { + local linaro_version="" + local linaro_series="" + + if [ "${CT_CC_CUSTOM}" = "y" ]; then + CT_GetCustom "gcc" "${CT_CC_VERSION}" "${CT_CC_CUSTOM_LOCATION}" + else + # Account for the Linaro versioning + linaro_version="$( echo "${CT_CC_VERSION}" \ + |${sed} -r -e 's/^linaro-//;' \ + )" + linaro_series="$( echo "${linaro_version}" \ + |${sed} -r -e 's/-.*//;' \ + )" + + # The official gcc hosts put gcc under a gcc/release/ directory, + # whereas the mirrors put it in the gcc/ directory. + # Also, Split out linaro mirrors, so that downloads happen faster. + if [ x"${linaro_version}" = x"${CT_CC_VERSION}" ]; then + CT_GetFile "gcc-${CT_CC_VERSION}" \ + {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_VERSION} \ + ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_VERSION} + else + YYMM=`echo ${CT_CC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'` + CT_GetFile "gcc-${CT_CC_VERSION}" \ + "http://launchpad.net/gcc-linaro/${linaro_series}/${linaro_version}/+download" \ + https://releases.linaro.org/${YYMM}/components/toolchain/gcc-linaro/${linaro_series} \ + http://cbuild.validation.linaro.org/snapshots + fi + + fi # ! custom location + # Starting with GCC 4.3, ecj is used for Java, and will only be + # built if the configure script finds ecj.jar at the top of the + # GCC source tree, which will not be there unless we get it and + # put it there ourselves + if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" ]; then + CT_GetFile ecj-latest .jar http://mirrors.kernel.org/sourceware/java/ \ + http://crosstool-ng.org/pub/java \ + ftp://gcc.gnu.org/pub/java \ + ftp://sourceware.org/pub/java + fi +} + +# Extract gcc +do_cc_extract() { + # If using custom directory location, nothing to do + if [ "${CT_CC_CUSTOM}" = "y" \ + -a -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}" ]; then + return 0 + fi + + CT_Extract "gcc-${CT_CC_VERSION}" + CT_Patch "gcc" "${CT_CC_VERSION}" + + # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree + if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" \ + -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" \ + ]; then + CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" + fi +} + +#------------------------------------------------------------------------------ +# This function builds up the set of languages to enable +# No argument expected, returns the comma-separated language list on stdout +cc_gcc_lang_list() { + local lang_list + + lang_list="c" + [ "${CT_CC_LANG_CXX}" = "y" ] && lang_list+=",c++" + [ "${CT_CC_LANG_FORTRAN}" = "y" ] && lang_list+=",fortran" + [ "${CT_CC_LANG_ADA}" = "y" ] && lang_list+=",ada" + [ "${CT_CC_LANG_JAVA}" = "y" ] && lang_list+=",java" + [ "${CT_CC_LANG_OBJC}" = "y" ] && lang_list+=",objc" + [ "${CT_CC_LANG_OBJCXX}" = "y" ] && lang_list+=",obj-c++" + [ "${CT_CC_LANG_GOLANG}" = "y" ] && lang_list+=",go" + lang_list+="${CT_CC_LANG_OTHERS:+,${CT_CC_LANG_OTHERS}}" + + printf "%s" "${lang_list}" +} + +#------------------------------------------------------------------------------ +# Core gcc pass 1 +do_cc_core_pass_1() { + local -a core_opts + + if [ "${CT_CC_CORE_PASS_1_NEEDED}" != "y" ]; then + return 0 + fi + + core_opts+=( "mode=static" ) + core_opts+=( "host=${CT_BUILD}" ) + core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) + core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) + core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) + core_opts+=( "lang_list=c" ) + + CT_DoStep INFO "Installing pass-1 core C compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-core-pass-1" + + do_cc_core_backend "${core_opts[@]}" + + CT_Popd + CT_EndStep +} + +# Core gcc pass 2 +do_cc_core_pass_2() { + local -a core_opts + + if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then + return 0 + fi + + # Common options: + core_opts+=( "host=${CT_BUILD}" ) + core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) + core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) + core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) + core_opts+=( "lang_list=c" ) + + # Different conditions are at stake here: + # - In case the threading model is NPTL, we need a shared-capable core + # gcc; in all other cases, we need a static-only core gcc. + # - In case the threading model is NPTL or win32, or gcc is 4.3 or + # later, we need to build libgcc + case "${CT_THREADS}" in + nptl) + core_opts+=( "mode=shared" ) + core_opts+=( "build_libgcc=yes" ) + ;; + win32) + core_opts+=( "mode=static" ) + core_opts+=( "build_libgcc=yes" ) + ;; + *) + core_opts+=( "mode=static" ) + if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then + core_opts+=( "build_libgcc=yes" ) + fi + ;; + esac + + CT_DoStep INFO "Installing pass-2 core C compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-core-pass-2" + + do_cc_core_backend "${core_opts[@]}" + + CT_Popd + CT_EndStep +} + +#------------------------------------------------------------------------------ +# Build core gcc +# This function is used to build the core C compiler. +# Usage: do_cc_core_backend param=value [...] +# Parameter : Definition : Type : Default +# mode : build a 'static', 'shared' or 'baremetal' : string : (none) +# host : the machine the core will run on : tuple : (none) +# prefix : dir prefix to install into : dir : (none) +# complibs : dir where complibs are isntalled : dir : (none) +# lang_list : the list of languages to build : string : (empty) +# build_libgcc : build libgcc or not : bool : no +# build_libstdcxx : build libstdc++ or not : bool : no +# build_libgfortran : build libgfortran or not : bool : no +# build_staticlinked : build statically linked or not : bool : no +# build_manuals : whether to build manuals or not : bool : no +# cflags : cflags to use : string : (empty) +# ldflags : ldflags to use : string : (empty) +# Usage: do_cc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] +do_cc_core_backend() { + local mode + local build_libgcc=no + local build_libstdcxx=no + local build_libgfortran=no + local build_staticlinked=no + local build_manuals=no + local host + local prefix + local complibs + local lang_list + local cflags + local ldflags + local tmp + local -a host_libstdcxx_flags + local -a extra_config + local -a core_LDFLAGS + local -a core_targets + local -a extra_user_config + local arg + + for arg in "$@"; do + eval "${arg// /\\ }" + done + + CT_DoLog EXTRA "Configuring gcc" + + case "${mode}" in + static) + extra_config+=("--with-newlib") + extra_config+=("--enable-threads=no") + extra_config+=("--disable-shared") + extra_user_config=( "${CT_CC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) + ;; + shared) + extra_config+=("--enable-shared") + extra_user_config=( "${CT_CC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) + ;; + baremetal) + extra_config+=("--with-newlib") + extra_config+=("--enable-threads=no") + extra_config+=("--disable-shared") + extra_user_config=( "${CT_CC_EXTRA_CONFIG_ARRAY[@]}" ) + ;; + *) + CT_Abort "Internal Error: 'mode' must be one of: 'static', 'shared' or 'baremetal', not '${mode:-(empty)}'" + ;; + esac + + if [ "${CT_CC_GCC_HAS_PKGVERSION_BUGURL}" = "y" ]; then + # Bare metal delivers the core compiler as final compiler, so add version info and bugurl + extra_config+=("--with-pkgversion=${CT_PKGVERSION}") + [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") + fi + + CT_DoLog DEBUG "Copying headers to install area of core C compiler" + CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include" + + for tmp in ARCH ABI CPU TUNE FPU FLOAT; do + eval tmp="\${CT_ARCH_WITH_${tmp}}" + if [ -n "${tmp}" ]; then + extra_config+=("${tmp}") + fi + done + if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then + extra_config+=("--enable-__cxa_atexit") + else + extra_config+=("--disable-__cxa_atexit") + fi + + core_LDFLAGS+=("${ldflags}") + + # *** WARNING ! *** + # Keep this full if-else-if-elif-fi-fi block in sync + # with the same block in do_cc, below. + if [ "${build_staticlinked}" = "yes" ]; then + core_LDFLAGS+=("-static") + host_libstdcxx_flags+=("-static-libgcc") + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++") + host_libstdcxx_flags+=("-lm") + # Companion libraries are build static (eg !shared), so + # the libstdc++ is not pulled automatically, although it + # is needed. Shoe-horn it in our LDFLAGS + # Ditto libm on some Fedora boxen + core_LDFLAGS+=("-lstdc++") + core_LDFLAGS+=("-lm") + else + if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then + # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 + # build script + # INFO: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, + # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html + host_libstdcxx_flags+=("-static-libgcc") + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic") + host_libstdcxx_flags+=("-lm") + elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then + # When companion libraries are build static (eg !shared), + # the libstdc++ is not pulled automatically, although it + # is needed. Shoe-horn it in our LDFLAGS + # Ditto libm on some Fedora boxen + core_LDFLAGS+=("-lstdc++") + core_LDFLAGS+=("-lm") + fi + fi + + if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then + extra_config+=("--with-gmp=${complibs}") + extra_config+=("--with-mpfr=${complibs}") + fi + if [ "${CT_CC_GCC_USE_MPC}" = "y" ]; then + extra_config+=("--with-mpc=${complibs}") + fi + if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then + if [ "${CT_PPL}" = "y" ]; then + extra_config+=("--with-ppl=${complibs}") + # With PPL 0.11+, also pull libpwl if needed + if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then + host_libstdcxx_flags+=("-L${complibs}/lib") + host_libstdcxx_flags+=("-lpwl") + fi + fi + if [ "${CT_ISL}" = "y" ]; then + extra_config+=("--with-isl=${complibs}") + fi + extra_config+=("--with-cloog=${complibs}") + elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then + extra_config+=("--with-ppl=no") + extra_config+=("--with-isl=no") + extra_config+=("--with-cloog=no") + fi + if [ "${CT_CC_GCC_USE_LTO}" = "y" ]; then + extra_config+=("--with-libelf=${complibs}") + extra_config+=("--enable-lto") + elif [ "${CT_CC_GCC_HAS_LTO}" = "y" ]; then + extra_config+=("--with-libelf=no") + extra_config+=("--disable-lto") + fi + + if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then + extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}") + fi + + if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then + extra_config+=("--enable-target-optspace") + fi + + case "${CT_CC_GCC_LDBL_128}" in + y) extra_config+=("--with-long-double-128");; + m) ;; + "") extra_config+=("--without-long-double-128");; + esac + + if [ "${CT_CC_GCC_BUILD_ID}" = "y" ]; then + extra_config+=( --enable-linker-build-id ) + fi + + case "${CT_CC_GCC_LNK_HASH_STYLE}" in + "") ;; + *) extra_config+=( "--with-linker-hash-style=${CT_CC_GCC_LNK_HASH_STYLE}" );; + esac + + case "${CT_CC_GCC_DEC_FLOATS}" in + "") ;; + *) extra_config+=( "--enable-decimal-float=${CT_CC_GCC_DEC_FLOATS}" );; + esac + + case "${CT_ARCH}" in + mips) + case "${CT_CC_GCC_mips_llsc}" in + y) extra_config+=( --with-llsc );; + m) ;; + *) extra_config+=( --without-llsc );; + esac + case "${CT_CC_GCC_mips_synci}" in + y) extra_config+=( --with-synci );; + m) ;; + *) extra_config+=( --without-synci );; + esac + if [ "${CT_CC_GCC_mips_plt}" ]; then + extra_config+=( --with-mips-plt ) + fi + ;; # ARCH is mips + esac + + extra_config+=(--disable-libgomp) + extra_config+=(--disable-libmudflap) + + [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls") + + [ "${CT_CC_GCC_DISABLE_PCH}" = "y" ] && extra_config+=("--disable-libstdcxx-pch") + + if [ "${CT_CC_GCC_SYSTEM_ZLIB}" = "y" ]; then + extra_config+=("--with-system-zlib") + fi + + # Some versions of gcc have a deffective --enable-multilib. + # Since that's the default, only pass --disable-multilib. + if [ "${CT_MULTILIB}" != "y" ]; then + extra_config+=("--disable-multilib") + fi + + CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" + + # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) + CT_DoExecLog CFG \ + CC_FOR_BUILD="${CT_BUILD}-gcc" \ + CFLAGS="${cflags}" \ + CXXFLAGS="${cflags}" \ + LDFLAGS="${core_LDFLAGS[*]}" \ + "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host=${host} \ + --target=${CT_TARGET} \ + --prefix="${prefix}" \ + --with-local-prefix="${CT_SYSROOT_DIR}" \ + --disable-libmudflap \ + ${CC_CORE_SYSROOT_ARG} \ + "${extra_config[@]}" \ + --enable-languages="${lang_list}" \ + "${extra_user_config[@]}" + + if [ "${build_libgcc}" = "yes" ]; then + # HACK: we need to override SHLIB_LC from gcc/config/t-slibgcc-elf-ver or + # gcc/config/t-libunwind so -lc is removed from the link for + # libgcc_s.so, as we do not have a target -lc yet. + # This is not as ugly as it appears to be ;-) All symbols get resolved + # during the glibc build, and we provide a proper libgcc_s.so for the + # cross toolchain during the final gcc build. + # + # As we cannot modify the source tree, nor override SHLIB_LC itself + # during configure or make, we have to edit the resultant + # gcc/libgcc.mk itself to remove -lc from the link. + # This causes us to have to jump through some hoops... + # + # To produce libgcc.mk to edit we firstly require libiberty.a, + # so we configure then build it. + # Next we have to configure gcc, create libgcc.mk then edit it... + # So much easier if we just edit the source tree, but hey... + if [ ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then + CT_DoExecLog CFG make ${JOBSFLAGS} configure-libiberty + CT_DoExecLog ALL make ${JOBSFLAGS} -C libiberty libiberty.a + CT_DoExecLog CFG make ${JOBSFLAGS} configure-gcc configure-libcpp + CT_DoExecLog ALL make ${JOBSFLAGS} all-libcpp + else + CT_DoExecLog CFG make ${JOBSFLAGS} configure-gcc configure-libcpp configure-build-libiberty + CT_DoExecLog ALL make ${JOBSFLAGS} all-libcpp all-build-libiberty + fi + # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here. + if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/libdecnumber" ]; then + CT_DoExecLog CFG make ${JOBSFLAGS} configure-libdecnumber + CT_DoExecLog ALL make ${JOBSFLAGS} -C libdecnumber libdecnumber.a + fi + # HACK: gcc-4.8 uses libbacktrace to make libgcc.mvars, so make it here. + if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/libbacktrace" ]; then + CT_DoExecLog CFG make ${JOBSFLAGS} configure-libbacktrace + CT_DoExecLog ALL make ${JOBSFLAGS} -C libbacktrace + fi + + # Starting with GCC 4.3, libgcc.mk is no longer built, + # and libgcc.mvars is used instead. + + if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then + libgcc_rule="libgcc.mvars" + core_targets=( gcc target-libgcc ) + else + libgcc_rule="libgcc.mk" + core_targets=( gcc ) + fi + + # On bare metal and canadian build the host-compiler is used when + # actually the build-system compiler is required. Choose the correct + # compilers for canadian build and use the defaults on other + # configurations. + if [ "${CT_BARE_METAL},${CT_CANADIAN}" = "y,y" ]; then + repair_cc="CC_FOR_BUILD=${CT_BUILD}-gcc \ + CXX_FOR_BUILD=${CT_BUILD}-g++ \ + GCC_FOR_TARGET=${CT_TARGET}-gcc" + else + repair_cc="" + fi + + CT_DoExecLog ALL make ${JOBSFLAGS} -C gcc ${libgcc_rule} \ + ${repair_cc} + sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule} + else # build_libgcc + core_targets=( gcc ) + fi # ! build libgcc + if [ "${build_libstdcxx}" = "yes" \ + -a "${CT_CC_LANG_CXX}" = "y" \ + ]; then + core_targets+=( target-libstdc++-v3 ) + fi + + if [ "${build_libgfortran}" = "yes" \ + -a "${CT_CC_LANG_FORTRAN}" = "y" \ + ]; then + core_targets+=( target-libgfortran ) + fi + + CT_DoLog EXTRA "Building gcc" + CT_DoExecLog ALL make ${JOBSFLAGS} "${core_targets[@]/#/all-}" + + CT_DoLog EXTRA "Installing gcc" + CT_DoExecLog ALL make ${JOBSFLAGS} "${core_targets[@]/#/install-}" + + if [ "${build_manuals}" = "yes" ]; then + CT_DoLog EXTRA "Building the GCC manuals" + CT_DoExecLog ALL make pdf html + CT_DoLog EXTRA "Installing the GCC manuals" + CT_DoExecLog ALL make install-{pdf,html}-gcc + fi + + # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able + # to call the C compiler with the same, somewhat canonical name. + # check whether compiler has an extension + file="$( ls -1 "${prefix}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" + [ -z "${file}" ] || ext=".${file##*.}" + if [ -f "${prefix}/bin/${CT_TARGET}-gcc${ext}" ]; then + CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}" + fi + + if [ "${CT_MULTILIB}" = "y" ]; then + if [ "${CT_CANADIAN}" = "y" -a "${mode}" = "baremetal" \ + -a "${host}" = "${CT_HOST}" ]; then + CT_DoLog WARN "Canadian Cross unable to confirm multilibs configured correctly" + else + multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib \ + |tail -n +2 ) ) + if [ ${#multilibs[@]} -ne 0 ]; then + CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):" + for i in "${multilibs[@]}"; do + dir="${i%%;*}" + flags="${i#*;}" + CT_DoLog EXTRA " ${flags//@/ -} --> ${dir}/" + done + else + CT_DoLog WARN "gcc configured for multilib, but none available" + fi + fi + fi +} + +#------------------------------------------------------------------------------ +# Build complete gcc to run on build +do_cc_for_build() { + local -a build_final_opts + local build_final_backend + + # In case we're canadian or cross-native, it seems that a + # real, complete compiler is needed?!? WTF? Sigh... + # Otherwise, there is nothing to do. + case "${CT_TOOLCHAIN_TYPE}" in + native|cross) return 0;; + esac + + build_final_opts+=( "host=${CT_BUILD}" ) + build_final_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) + build_final_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) + build_final_opts+=( "lang_list=$( cc_gcc_lang_list )" ) + if [ "${CT_BARE_METAL}" = "y" ]; then + # In the tests I've done, bare-metal was not impacted by the + # lack of such a compiler, but better safe than sorry... + build_final_opts+=( "mode=baremetal" ) + build_final_opts+=( "build_libgcc=yes" ) + build_final_opts+=( "build_libstdcxx=yes" ) + build_final_opts+=( "build_libgfortran=yes" ) + if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then + build_final_opts+=( "build_staticlinked=yes" ) + fi + build_final_backend=do_cc_core_backend + else + build_final_backend=do_cc_backend + fi + + CT_DoStep INFO "Installing final compiler for build" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final-build-${CT_BUILD}" + + "${build_final_backend}" "${build_final_opts[@]}" + + CT_Popd + CT_EndStep +} + +#------------------------------------------------------------------------------ +# Build final gcc to run on host +do_cc_for_host() { + local -a final_opts + local final_backend + + final_opts+=( "host=${CT_HOST}" ) + final_opts+=( "prefix=${CT_PREFIX_DIR}" ) + final_opts+=( "complibs=${CT_HOST_COMPLIBS_DIR}" ) + final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) + final_opts+=( "lang_list=$( cc_gcc_lang_list )" ) + if [ "${CT_BUILD_MANUALS}" = "y" ]; then + final_opts+=( "build_manuals=yes" ) + fi + if [ "${CT_BARE_METAL}" = "y" ]; then + final_opts+=( "mode=baremetal" ) + final_opts+=( "build_libgcc=yes" ) + final_opts+=( "build_libstdcxx=yes" ) + final_opts+=( "build_libgfortran=yes" ) + if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then + final_opts+=( "build_staticlinked=yes" ) + fi + final_backend=do_cc_core_backend + else + final_backend=do_cc_backend + fi + + CT_DoStep INFO "Installing final compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final" + + "${final_backend}" "${final_opts[@]}" + + CT_Popd + CT_EndStep +} + +#------------------------------------------------------------------------------ +# Build the final gcc +# Usage: do_cc_backend param=value [...] +# Parameter : Definition : Type : Default +# host : the host we run onto : tuple : (none) +# prefix : the runtime prefix : dir : (none) +# complibs : the companion libraries prefix : dir : (none) +# cflags : cflags to use : string : (empty) +# ldflags : ldflags to use : string : (empty) +# lang_list : the list of languages to build : string : (empty) +# build_manuals : whether to build manuals or not : bool : no +do_cc_backend() { + local host + local prefix + local complibs + local cflags + local ldflags + local lang_list + local build_manuals + local -a host_libstdcxx_flags + local -a extra_config + local -a final_LDFLAGS + local tmp + local arg + + for arg in "$@"; do + eval "${arg// /\\ }" + done + + CT_DoLog EXTRA "Configuring gcc" + + # Enable selected languages + extra_config+=("--enable-languages=${lang_list}") + + for tmp in ARCH ABI CPU TUNE FPU FLOAT; do + eval tmp="\${CT_ARCH_WITH_${tmp}}" + if [ -n "${tmp}" ]; then + extra_config+=("${tmp}") + fi + done + + [ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared") + if [ "${CT_CC_GCC_HAS_PKGVERSION_BUGURL}" = "y" ]; then + extra_config+=("--with-pkgversion=${CT_PKGVERSION}") + [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") + fi + case "${CT_CC_GCC_SJLJ_EXCEPTIONS}" in + y) extra_config+=("--enable-sjlj-exceptions");; + m) ;; + "") extra_config+=("--disable-sjlj-exceptions");; + esac + if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then + extra_config+=("--enable-__cxa_atexit") + else + extra_config+=("--disable-__cxa_atexit") + fi + if [ -n "${CT_CC_ENABLE_CXX_FLAGS}" ]; then + extra_config+=("--enable-cxx-flags=${CT_CC_ENABLE_CXX_FLAGS}") + fi + if [ "${CT_CC_GCC_4_8_or_later}" = "y" ]; then + if [ "${CT_THREADS}" = "none" ]; then + extra_config+=(--disable-libatomic) + fi + fi + if [ "${CT_CC_GCC_LIBMUDFLAP}" = "y" ]; then + extra_config+=(--enable-libmudflap) + else + extra_config+=(--disable-libmudflap) + fi + if [ "${CT_CC_GCC_LIBGOMP}" = "y" ]; then + extra_config+=(--enable-libgomp) + else + extra_config+=(--disable-libgomp) + fi + if [ "${CT_CC_GCC_LIBSSP}" = "y" ]; then + extra_config+=(--enable-libssp) + else + extra_config+=(--disable-libssp) + fi + if [ "${CT_CC_GCC_HAS_LIBQUADMATH}" = "y" ]; then + if [ "${CT_CC_GCC_LIBQUADMATH}" = "y" ]; then + extra_config+=(--enable-libquadmath) + extra_config+=(--enable-libquadmath-support) + else + extra_config+=(--disable-libquadmath) + extra_config+=(--disable-libquadmath-support) + fi + fi + if [ "${CT_CC_GCC_HAS_LIBSANITIZER}" = "y" ]; then + if [ "${CT_CC_GCC_LIBSANITIZER}" = "y" ]; then + extra_config+=(--enable-libsanitizer) + else + extra_config+=(--disable-libsanitizer) + fi + fi + + final_LDFLAGS+=("${ldflags}") + + # *** WARNING ! *** + # Keep this full if-else-if-elif-fi-fi block in sync + # with the same block in do_cc_core, above. + if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then + final_LDFLAGS+=("-static") + host_libstdcxx_flags+=("-static-libgcc") + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++") + host_libstdcxx_flags+=("-lm") + # Companion libraries are build static (eg !shared), so + # the libstdc++ is not pulled automatically, although it + # is needed. Shoe-horn it in our LDFLAGS + # Ditto libm on some Fedora boxen + final_LDFLAGS+=("-lstdc++") + final_LDFLAGS+=("-lm") + else + if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then + # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 + # build script + # INFO: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, + # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html + host_libstdcxx_flags+=("-static-libgcc") + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic") + host_libstdcxx_flags+=("-lm") + elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then + # When companion libraries are build static (eg !shared), + # the libstdc++ is not pulled automatically, although it + # is needed. Shoe-horn it in our LDFLAGS + # Ditto libm on some Fedora boxen + final_LDFLAGS+=("-lstdc++") + final_LDFLAGS+=("-lm") + fi + fi + + if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then + extra_config+=("--with-gmp=${complibs}") + extra_config+=("--with-mpfr=${complibs}") + fi + if [ "${CT_CC_GCC_USE_MPC}" = "y" ]; then + extra_config+=("--with-mpc=${complibs}") + fi + if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then + if [ "${CT_PPL}" = "y" ]; then + extra_config+=("--with-ppl=${complibs}") + # With PPL 0.11+, also pull libpwl if needed + if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then + host_libstdcxx_flags+=("-L${complibs}/lib") + host_libstdcxx_flags+=("-lpwl") + fi + fi + if [ "${CT_ISL}" = "y" ]; then + extra_config+=("--with-isl=${complibs}") + fi + extra_config+=("--with-cloog=${complibs}") + elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then + extra_config+=("--with-ppl=no") + extra_config+=("--with-isl=no") + extra_config+=("--with-cloog=no") + fi + if [ "${CT_CC_GCC_USE_LTO}" = "y" ]; then + extra_config+=("--with-libelf=${complibs}") + elif [ "${CT_CC_GCC_HAS_LTO}" = "y" ]; then + extra_config+=("--with-libelf=no") + fi + + if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then + extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}") + fi + + if [ "${CT_THREADS}" = "none" ]; then + extra_config+=("--disable-threads") + if [ "${CT_CC_GCC_4_2_or_later}" = y ]; then + CT_Test "Disabling libgomp for no-thread gcc>=4.2" "${CT_CC_GCC_LIBGOMP}" = "Y" + extra_config+=("--disable-libgomp") + fi + else + if [ "${CT_THREADS}" = "win32" ]; then + extra_config+=("--enable-threads=win32") + extra_config+=("--disable-win32-registry") + else + extra_config+=("--enable-threads=posix") + fi + fi + + if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then + extra_config+=("--enable-target-optspace") + fi + if [ "${CT_CC_GCC_DISABLE_PCH}" = "y" ]; then + extra_config+=("--disable-libstdcxx-pch") + fi + + case "${CT_CC_GCC_LDBL_128}" in + y) extra_config+=("--with-long-double-128");; + m) ;; + "") extra_config+=("--without-long-double-128");; + esac + + if [ "${CT_CC_GCC_BUILD_ID}" = "y" ]; then + extra_config+=( --enable-linker-build-id ) + fi + + case "${CT_CC_GCC_LNK_HASH_STYLE}" in + "") ;; + *) extra_config+=( "--with-linker-hash-style=${CT_CC_GCC_LNK_HASH_STYLE}" );; + esac + + case "${CT_CC_GCC_DEC_FLOATS}" in + "") ;; + *) extra_config+=( "--enable-decimal-float=${CT_CC_GCC_DEC_FLOATS}" );; + esac + + if [ "${CT_CC_GCC_ENABLE_PLUGINS}" = "y" ]; then + extra_config+=( --enable-plugin ) + fi + if [ "${CT_CC_GCC_GOLD}" = "y" ]; then + extra_config+=( --enable-gold ) + fi + + case "${CT_ARCH}" in + mips) + case "${CT_CC_GCC_mips_llsc}" in + y) extra_config+=( --with-llsc );; + m) ;; + *) extra_config+=( --without-llsc );; + esac + case "${CT_CC_GCC_mips_synci}" in + y) extra_config+=( --with-synci );; + m) ;; + *) extra_config+=( --without-synci );; + esac + if [ "${CT_CC_GCC_mips_plt}" ]; then + extra_config+=( --with-mips-plt ) + fi + ;; # ARCH is mips + esac + + [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls") + + if [ "${CT_CC_GCC_SYSTEM_ZLIB}" = "y" ]; then + extra_config+=("--with-system-zlib") + fi + + + # Some versions of gcc have a deffective --enable-multilib. + # Since that's the default, only pass --disable-multilib. + if [ "${CT_MULTILIB}" != "y" ]; then + extra_config+=("--disable-multilib") + fi + + CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" + + CT_DoExecLog CFG \ + CC_FOR_BUILD="${CT_BUILD}-gcc" \ + CFLAGS="${cflags}" \ + CXXFLAGS="${cflags}" \ + LDFLAGS="${final_LDFLAGS[*]}" \ + CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ + CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ + LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \ + "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host=${host} \ + --target=${CT_TARGET} \ + --prefix="${prefix}" \ + ${CC_SYSROOT_ARG} \ + "${extra_config[@]}" \ + --with-local-prefix="${CT_SYSROOT_DIR}" \ + --enable-c99 \ + --enable-long-long \ + "${CT_CC_EXTRA_CONFIG_ARRAY[@]}" + + if [ "${CT_CANADIAN}" = "y" ]; then + CT_DoLog EXTRA "Building libiberty" + CT_DoExecLog ALL make ${JOBSFLAGS} all-build-libiberty + fi + + CT_DoLog EXTRA "Building gcc" + CT_DoExecLog ALL make ${JOBSFLAGS} all + + CT_DoLog EXTRA "Installing gcc" + CT_DoExecLog ALL make ${JOBSFLAGS} install + + if [ "${build_manuals}" = "yes" ]; then + CT_DoLog EXTRA "Building the GCC manuals" + CT_DoExecLog ALL make pdf html + CT_DoLog EXTRA "Installing the GCC manuals" + CT_DoExecLog ALL make install-{pdf,html}-gcc + fi + + # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able + # to call the C compiler with the same, somewhat canonical name. + # check whether compiler has an extension + file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" + [ -z "${file}" ] || ext=".${file##*.}" + if [ -f "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc${ext}" ]; then + CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}" + fi + + if [ "${CT_MULTILIB}" = "y" ]; then + if [ "${CT_CANADIAN}" = "y" ]; then + CT_DoLog WARN "Canadian Cross unable to confirm multilibs configured correctly" + else + multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib \ + |tail -n +2 ) ) + if [ ${#multilibs[@]} -ne 0 ]; then + CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):" + for i in "${multilibs[@]}"; do + dir="${i%%;*}" + flags="${i#*;}" + CT_DoLog EXTRA " ${flags//@/ -} --> ${dir}/" + done + else + CT_DoLog WARN "gcc configured for multilib, but none available" + fi + fi + fi +} diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh deleted file mode 100644 index 835aea0..0000000 --- a/scripts/build/cc/gcc.sh +++ /dev/null @@ -1,911 +0,0 @@ -# This file adds the function to build the gcc C compiler -# Copyright 2007 Yann E. MORIN -# Licensed under the GPL v2. See COPYING in the root of this package - -# Download gcc -do_cc_get() { - local linaro_version="" - local linaro_series="" - - if [ "${CT_CC_CUSTOM}" = "y" ]; then - CT_GetCustom "gcc" "${CT_CC_VERSION}" "${CT_CC_CUSTOM_LOCATION}" - else - # Account for the Linaro versioning - linaro_version="$( echo "${CT_CC_VERSION}" \ - |${sed} -r -e 's/^linaro-//;' \ - )" - linaro_series="$( echo "${linaro_version}" \ - |${sed} -r -e 's/-.*//;' \ - )" - - # The official gcc hosts put gcc under a gcc/release/ directory, - # whereas the mirrors put it in the gcc/ directory. - # Also, Split out linaro mirrors, so that downloads happen faster. - if [ x"${linaro_version}" = x"${CT_CC_VERSION}" ]; then - CT_GetFile "gcc-${CT_CC_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_VERSION} \ - ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_VERSION} - else - YYMM=`echo ${CT_CC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'` - CT_GetFile "gcc-${CT_CC_VERSION}" \ - "http://launchpad.net/gcc-linaro/${linaro_series}/${linaro_version}/+download" \ - https://releases.linaro.org/${YYMM}/components/toolchain/gcc-linaro/${linaro_series} \ - http://cbuild.validation.linaro.org/snapshots - fi - - fi # ! custom location - # Starting with GCC 4.3, ecj is used for Java, and will only be - # built if the configure script finds ecj.jar at the top of the - # GCC source tree, which will not be there unless we get it and - # put it there ourselves - if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" ]; then - CT_GetFile ecj-latest .jar http://mirrors.kernel.org/sourceware/java/ \ - http://crosstool-ng.org/pub/java \ - ftp://gcc.gnu.org/pub/java \ - ftp://sourceware.org/pub/java - fi -} - -# Extract gcc -do_cc_extract() { - # If using custom directory location, nothing to do - if [ "${CT_CC_CUSTOM}" = "y" \ - -a -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}" ]; then - return 0 - fi - - CT_Extract "gcc-${CT_CC_VERSION}" - CT_Patch "gcc" "${CT_CC_VERSION}" - - # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree - if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" \ - -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" \ - ]; then - CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" - fi -} - -#------------------------------------------------------------------------------ -# This function builds up the set of languages to enable -# No argument expected, returns the comma-separated language list on stdout -cc_gcc_lang_list() { - local lang_list - - lang_list="c" - [ "${CT_CC_LANG_CXX}" = "y" ] && lang_list+=",c++" - [ "${CT_CC_LANG_FORTRAN}" = "y" ] && lang_list+=",fortran" - [ "${CT_CC_LANG_ADA}" = "y" ] && lang_list+=",ada" - [ "${CT_CC_LANG_JAVA}" = "y" ] && lang_list+=",java" - [ "${CT_CC_LANG_OBJC}" = "y" ] && lang_list+=",objc" - [ "${CT_CC_LANG_OBJCXX}" = "y" ] && lang_list+=",obj-c++" - [ "${CT_CC_LANG_GOLANG}" = "y" ] && lang_list+=",go" - lang_list+="${CT_CC_LANG_OTHERS:+,${CT_CC_LANG_OTHERS}}" - - printf "%s" "${lang_list}" -} - -#------------------------------------------------------------------------------ -# Core gcc pass 1 -do_cc_core_pass_1() { - local -a core_opts - - if [ "${CT_CC_CORE_PASS_1_NEEDED}" != "y" ]; then - return 0 - fi - - core_opts+=( "mode=static" ) - core_opts+=( "host=${CT_BUILD}" ) - core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) - core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) - core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) - core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) - core_opts+=( "lang_list=c" ) - - CT_DoStep INFO "Installing pass-1 core C compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-core-pass-1" - - do_cc_core_backend "${core_opts[@]}" - - CT_Popd - CT_EndStep -} - -# Core gcc pass 2 -do_cc_core_pass_2() { - local -a core_opts - - if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then - return 0 - fi - - # Common options: - core_opts+=( "host=${CT_BUILD}" ) - core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) - core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) - core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) - core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) - core_opts+=( "lang_list=c" ) - - # Different conditions are at stake here: - # - In case the threading model is NPTL, we need a shared-capable core - # gcc; in all other cases, we need a static-only core gcc. - # - In case the threading model is NPTL or win32, or gcc is 4.3 or - # later, we need to build libgcc - case "${CT_THREADS}" in - nptl) - core_opts+=( "mode=shared" ) - core_opts+=( "build_libgcc=yes" ) - ;; - win32) - core_opts+=( "mode=static" ) - core_opts+=( "build_libgcc=yes" ) - ;; - *) - core_opts+=( "mode=static" ) - if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then - core_opts+=( "build_libgcc=yes" ) - fi - ;; - esac - - CT_DoStep INFO "Installing pass-2 core C compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-core-pass-2" - - do_cc_core_backend "${core_opts[@]}" - - CT_Popd - CT_EndStep -} - -#------------------------------------------------------------------------------ -# Build core gcc -# This function is used to build the core C compiler. -# Usage: do_cc_core_backend param=value [...] -# Parameter : Definition : Type : Default -# mode : build a 'static', 'shared' or 'baremetal' : string : (none) -# host : the machine the core will run on : tuple : (none) -# prefix : dir prefix to install into : dir : (none) -# complibs : dir where complibs are isntalled : dir : (none) -# lang_list : the list of languages to build : string : (empty) -# build_libgcc : build libgcc or not : bool : no -# build_libstdcxx : build libstdc++ or not : bool : no -# build_libgfortran : build libgfortran or not : bool : no -# build_staticlinked : build statically linked or not : bool : no -# build_manuals : whether to build manuals or not : bool : no -# cflags : cflags to use : string : (empty) -# ldflags : ldflags to use : string : (empty) -# Usage: do_cc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] -do_cc_core_backend() { - local mode - local build_libgcc=no - local build_libstdcxx=no - local build_libgfortran=no - local build_staticlinked=no - local build_manuals=no - local host - local prefix - local complibs - local lang_list - local cflags - local ldflags - local tmp - local -a host_libstdcxx_flags - local -a extra_config - local -a core_LDFLAGS - local -a core_targets - local -a extra_user_config - local arg - - for arg in "$@"; do - eval "${arg// /\\ }" - done - - CT_DoLog EXTRA "Configuring gcc" - - case "${mode}" in - static) - extra_config+=("--with-newlib") - extra_config+=("--enable-threads=no") - extra_config+=("--disable-shared") - extra_user_config=( "${CT_CC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) - ;; - shared) - extra_config+=("--enable-shared") - extra_user_config=( "${CT_CC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) - ;; - baremetal) - extra_config+=("--with-newlib") - extra_config+=("--enable-threads=no") - extra_config+=("--disable-shared") - extra_user_config=( "${CT_CC_EXTRA_CONFIG_ARRAY[@]}" ) - ;; - *) - CT_Abort "Internal Error: 'mode' must be one of: 'static', 'shared' or 'baremetal', not '${mode:-(empty)}'" - ;; - esac - - if [ "${CT_CC_GCC_HAS_PKGVERSION_BUGURL}" = "y" ]; then - # Bare metal delivers the core compiler as final compiler, so add version info and bugurl - extra_config+=("--with-pkgversion=${CT_PKGVERSION}") - [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") - fi - - CT_DoLog DEBUG "Copying headers to install area of core C compiler" - CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include" - - for tmp in ARCH ABI CPU TUNE FPU FLOAT; do - eval tmp="\${CT_ARCH_WITH_${tmp}}" - if [ -n "${tmp}" ]; then - extra_config+=("${tmp}") - fi - done - if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then - extra_config+=("--enable-__cxa_atexit") - else - extra_config+=("--disable-__cxa_atexit") - fi - - core_LDFLAGS+=("${ldflags}") - - # *** WARNING ! *** - # Keep this full if-else-if-elif-fi-fi block in sync - # with the same block in do_cc, below. - if [ "${build_staticlinked}" = "yes" ]; then - core_LDFLAGS+=("-static") - host_libstdcxx_flags+=("-static-libgcc") - host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++") - host_libstdcxx_flags+=("-lm") - # Companion libraries are build static (eg !shared), so - # the libstdc++ is not pulled automatically, although it - # is needed. Shoe-horn it in our LDFLAGS - # Ditto libm on some Fedora boxen - core_LDFLAGS+=("-lstdc++") - core_LDFLAGS+=("-lm") - else - if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then - # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 - # build script - # INFO: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, - # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html - host_libstdcxx_flags+=("-static-libgcc") - host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic") - host_libstdcxx_flags+=("-lm") - elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then - # When companion libraries are build static (eg !shared), - # the libstdc++ is not pulled automatically, although it - # is needed. Shoe-horn it in our LDFLAGS - # Ditto libm on some Fedora boxen - core_LDFLAGS+=("-lstdc++") - core_LDFLAGS+=("-lm") - fi - fi - - if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then - extra_config+=("--with-gmp=${complibs}") - extra_config+=("--with-mpfr=${complibs}") - fi - if [ "${CT_CC_GCC_USE_MPC}" = "y" ]; then - extra_config+=("--with-mpc=${complibs}") - fi - if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then - if [ "${CT_PPL}" = "y" ]; then - extra_config+=("--with-ppl=${complibs}") - # With PPL 0.11+, also pull libpwl if needed - if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then - host_libstdcxx_flags+=("-L${complibs}/lib") - host_libstdcxx_flags+=("-lpwl") - fi - fi - if [ "${CT_ISL}" = "y" ]; then - extra_config+=("--with-isl=${complibs}") - fi - extra_config+=("--with-cloog=${complibs}") - elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then - extra_config+=("--with-ppl=no") - extra_config+=("--with-isl=no") - extra_config+=("--with-cloog=no") - fi - if [ "${CT_CC_GCC_USE_LTO}" = "y" ]; then - extra_config+=("--with-libelf=${complibs}") - extra_config+=("--enable-lto") - elif [ "${CT_CC_GCC_HAS_LTO}" = "y" ]; then - extra_config+=("--with-libelf=no") - extra_config+=("--disable-lto") - fi - - if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then - extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}") - fi - - if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then - extra_config+=("--enable-target-optspace") - fi - - case "${CT_CC_GCC_LDBL_128}" in - y) extra_config+=("--with-long-double-128");; - m) ;; - "") extra_config+=("--without-long-double-128");; - esac - - if [ "${CT_CC_GCC_BUILD_ID}" = "y" ]; then - extra_config+=( --enable-linker-build-id ) - fi - - case "${CT_CC_GCC_LNK_HASH_STYLE}" in - "") ;; - *) extra_config+=( "--with-linker-hash-style=${CT_CC_GCC_LNK_HASH_STYLE}" );; - esac - - case "${CT_CC_GCC_DEC_FLOATS}" in - "") ;; - *) extra_config+=( "--enable-decimal-float=${CT_CC_GCC_DEC_FLOATS}" );; - esac - - case "${CT_ARCH}" in - mips) - case "${CT_CC_GCC_mips_llsc}" in - y) extra_config+=( --with-llsc );; - m) ;; - *) extra_config+=( --without-llsc );; - esac - case "${CT_CC_GCC_mips_synci}" in - y) extra_config+=( --with-synci );; - m) ;; - *) extra_config+=( --without-synci );; - esac - if [ "${CT_CC_GCC_mips_plt}" ]; then - extra_config+=( --with-mips-plt ) - fi - ;; # ARCH is mips - esac - - extra_config+=(--disable-libgomp) - extra_config+=(--disable-libmudflap) - - [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls") - - [ "${CT_CC_GCC_DISABLE_PCH}" = "y" ] && extra_config+=("--disable-libstdcxx-pch") - - if [ "${CT_CC_GCC_SYSTEM_ZLIB}" = "y" ]; then - extra_config+=("--with-system-zlib") - fi - - # Some versions of gcc have a deffective --enable-multilib. - # Since that's the default, only pass --disable-multilib. - if [ "${CT_MULTILIB}" != "y" ]; then - extra_config+=("--disable-multilib") - fi - - CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" - - # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) - CT_DoExecLog CFG \ - CC_FOR_BUILD="${CT_BUILD}-gcc" \ - CFLAGS="${cflags}" \ - CXXFLAGS="${cflags}" \ - LDFLAGS="${core_LDFLAGS[*]}" \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \ - --build=${CT_BUILD} \ - --host=${host} \ - --target=${CT_TARGET} \ - --prefix="${prefix}" \ - --with-local-prefix="${CT_SYSROOT_DIR}" \ - --disable-libmudflap \ - ${CC_CORE_SYSROOT_ARG} \ - "${extra_config[@]}" \ - --enable-languages="${lang_list}" \ - "${extra_user_config[@]}" - - if [ "${build_libgcc}" = "yes" ]; then - # HACK: we need to override SHLIB_LC from gcc/config/t-slibgcc-elf-ver or - # gcc/config/t-libunwind so -lc is removed from the link for - # libgcc_s.so, as we do not have a target -lc yet. - # This is not as ugly as it appears to be ;-) All symbols get resolved - # during the glibc build, and we provide a proper libgcc_s.so for the - # cross toolchain during the final gcc build. - # - # As we cannot modify the source tree, nor override SHLIB_LC itself - # during configure or make, we have to edit the resultant - # gcc/libgcc.mk itself to remove -lc from the link. - # This causes us to have to jump through some hoops... - # - # To produce libgcc.mk to edit we firstly require libiberty.a, - # so we configure then build it. - # Next we have to configure gcc, create libgcc.mk then edit it... - # So much easier if we just edit the source tree, but hey... - if [ ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then - CT_DoExecLog CFG make ${JOBSFLAGS} configure-libiberty - CT_DoExecLog ALL make ${JOBSFLAGS} -C libiberty libiberty.a - CT_DoExecLog CFG make ${JOBSFLAGS} configure-gcc configure-libcpp - CT_DoExecLog ALL make ${JOBSFLAGS} all-libcpp - else - CT_DoExecLog CFG make ${JOBSFLAGS} configure-gcc configure-libcpp configure-build-libiberty - CT_DoExecLog ALL make ${JOBSFLAGS} all-libcpp all-build-libiberty - fi - # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here. - if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/libdecnumber" ]; then - CT_DoExecLog CFG make ${JOBSFLAGS} configure-libdecnumber - CT_DoExecLog ALL make ${JOBSFLAGS} -C libdecnumber libdecnumber.a - fi - # HACK: gcc-4.8 uses libbacktrace to make libgcc.mvars, so make it here. - if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/libbacktrace" ]; then - CT_DoExecLog CFG make ${JOBSFLAGS} configure-libbacktrace - CT_DoExecLog ALL make ${JOBSFLAGS} -C libbacktrace - fi - - # Starting with GCC 4.3, libgcc.mk is no longer built, - # and libgcc.mvars is used instead. - - if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then - libgcc_rule="libgcc.mvars" - core_targets=( gcc target-libgcc ) - else - libgcc_rule="libgcc.mk" - core_targets=( gcc ) - fi - - # On bare metal and canadian build the host-compiler is used when - # actually the build-system compiler is required. Choose the correct - # compilers for canadian build and use the defaults on other - # configurations. - if [ "${CT_BARE_METAL},${CT_CANADIAN}" = "y,y" ]; then - repair_cc="CC_FOR_BUILD=${CT_BUILD}-gcc \ - CXX_FOR_BUILD=${CT_BUILD}-g++ \ - GCC_FOR_TARGET=${CT_TARGET}-gcc" - else - repair_cc="" - fi - - CT_DoExecLog ALL make ${JOBSFLAGS} -C gcc ${libgcc_rule} \ - ${repair_cc} - sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule} - else # build_libgcc - core_targets=( gcc ) - fi # ! build libgcc - if [ "${build_libstdcxx}" = "yes" \ - -a "${CT_CC_LANG_CXX}" = "y" \ - ]; then - core_targets+=( target-libstdc++-v3 ) - fi - - if [ "${build_libgfortran}" = "yes" \ - -a "${CT_CC_LANG_FORTRAN}" = "y" \ - ]; then - core_targets+=( target-libgfortran ) - fi - - CT_DoLog EXTRA "Building gcc" - CT_DoExecLog ALL make ${JOBSFLAGS} "${core_targets[@]/#/all-}" - - CT_DoLog EXTRA "Installing gcc" - CT_DoExecLog ALL make ${JOBSFLAGS} "${core_targets[@]/#/install-}" - - if [ "${build_manuals}" = "yes" ]; then - CT_DoLog EXTRA "Building the GCC manuals" - CT_DoExecLog ALL make pdf html - CT_DoLog EXTRA "Installing the GCC manuals" - CT_DoExecLog ALL make install-{pdf,html}-gcc - fi - - # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able - # to call the C compiler with the same, somewhat canonical name. - # check whether compiler has an extension - file="$( ls -1 "${prefix}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" - [ -z "${file}" ] || ext=".${file##*.}" - if [ -f "${prefix}/bin/${CT_TARGET}-gcc${ext}" ]; then - CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}" - fi - - if [ "${CT_MULTILIB}" = "y" ]; then - if [ "${CT_CANADIAN}" = "y" -a "${mode}" = "baremetal" \ - -a "${host}" = "${CT_HOST}" ]; then - CT_DoLog WARN "Canadian Cross unable to confirm multilibs configured correctly" - else - multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib \ - |tail -n +2 ) ) - if [ ${#multilibs[@]} -ne 0 ]; then - CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):" - for i in "${multilibs[@]}"; do - dir="${i%%;*}" - flags="${i#*;}" - CT_DoLog EXTRA " ${flags//@/ -} --> ${dir}/" - done - else - CT_DoLog WARN "gcc configured for multilib, but none available" - fi - fi - fi -} - -#------------------------------------------------------------------------------ -# Build complete gcc to run on build -do_cc_for_build() { - local -a build_final_opts - local build_final_backend - - # In case we're canadian or cross-native, it seems that a - # real, complete compiler is needed?!? WTF? Sigh... - # Otherwise, there is nothing to do. - case "${CT_TOOLCHAIN_TYPE}" in - native|cross) return 0;; - esac - - build_final_opts+=( "host=${CT_BUILD}" ) - build_final_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) - build_final_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) - build_final_opts+=( "lang_list=$( cc_gcc_lang_list )" ) - if [ "${CT_BARE_METAL}" = "y" ]; then - # In the tests I've done, bare-metal was not impacted by the - # lack of such a compiler, but better safe than sorry... - build_final_opts+=( "mode=baremetal" ) - build_final_opts+=( "build_libgcc=yes" ) - build_final_opts+=( "build_libstdcxx=yes" ) - build_final_opts+=( "build_libgfortran=yes" ) - if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then - build_final_opts+=( "build_staticlinked=yes" ) - fi - build_final_backend=do_cc_core_backend - else - build_final_backend=do_cc_backend - fi - - CT_DoStep INFO "Installing final compiler for build" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final-build-${CT_BUILD}" - - "${build_final_backend}" "${build_final_opts[@]}" - - CT_Popd - CT_EndStep -} - -#------------------------------------------------------------------------------ -# Build final gcc to run on host -do_cc_for_host() { - local -a final_opts - local final_backend - - final_opts+=( "host=${CT_HOST}" ) - final_opts+=( "prefix=${CT_PREFIX_DIR}" ) - final_opts+=( "complibs=${CT_HOST_COMPLIBS_DIR}" ) - final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) - final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) - final_opts+=( "lang_list=$( cc_gcc_lang_list )" ) - if [ "${CT_BUILD_MANUALS}" = "y" ]; then - final_opts+=( "build_manuals=yes" ) - fi - if [ "${CT_BARE_METAL}" = "y" ]; then - final_opts+=( "mode=baremetal" ) - final_opts+=( "build_libgcc=yes" ) - final_opts+=( "build_libstdcxx=yes" ) - final_opts+=( "build_libgfortran=yes" ) - if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then - final_opts+=( "build_staticlinked=yes" ) - fi - final_backend=do_cc_core_backend - else - final_backend=do_cc_backend - fi - - CT_DoStep INFO "Installing final compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final" - - "${final_backend}" "${final_opts[@]}" - - CT_Popd - CT_EndStep -} - -#------------------------------------------------------------------------------ -# Build the final gcc -# Usage: do_cc_backend param=value [...] -# Parameter : Definition : Type : Default -# host : the host we run onto : tuple : (none) -# prefix : the runtime prefix : dir : (none) -# complibs : the companion libraries prefix : dir : (none) -# cflags : cflags to use : string : (empty) -# ldflags : ldflags to use : string : (empty) -# lang_list : the list of languages to build : string : (empty) -# build_manuals : whether to build manuals or not : bool : no -do_cc_backend() { - local host - local prefix - local complibs - local cflags - local ldflags - local lang_list - local build_manuals - local -a host_libstdcxx_flags - local -a extra_config - local -a final_LDFLAGS - local tmp - local arg - - for arg in "$@"; do - eval "${arg// /\\ }" - done - - CT_DoLog EXTRA "Configuring gcc" - - # Enable selected languages - extra_config+=("--enable-languages=${lang_list}") - - for tmp in ARCH ABI CPU TUNE FPU FLOAT; do - eval tmp="\${CT_ARCH_WITH_${tmp}}" - if [ -n "${tmp}" ]; then - extra_config+=("${tmp}") - fi - done - - [ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared") - if [ "${CT_CC_GCC_HAS_PKGVERSION_BUGURL}" = "y" ]; then - extra_config+=("--with-pkgversion=${CT_PKGVERSION}") - [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") - fi - case "${CT_CC_GCC_SJLJ_EXCEPTIONS}" in - y) extra_config+=("--enable-sjlj-exceptions");; - m) ;; - "") extra_config+=("--disable-sjlj-exceptions");; - esac - if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then - extra_config+=("--enable-__cxa_atexit") - else - extra_config+=("--disable-__cxa_atexit") - fi - if [ -n "${CT_CC_ENABLE_CXX_FLAGS}" ]; then - extra_config+=("--enable-cxx-flags=${CT_CC_ENABLE_CXX_FLAGS}") - fi - if [ "${CT_CC_GCC_4_8_or_later}" = "y" ]; then - if [ "${CT_THREADS}" = "none" ]; then - extra_config+=(--disable-libatomic) - fi - fi - if [ "${CT_CC_GCC_LIBMUDFLAP}" = "y" ]; then - extra_config+=(--enable-libmudflap) - else - extra_config+=(--disable-libmudflap) - fi - if [ "${CT_CC_GCC_LIBGOMP}" = "y" ]; then - extra_config+=(--enable-libgomp) - else - extra_config+=(--disable-libgomp) - fi - if [ "${CT_CC_GCC_LIBSSP}" = "y" ]; then - extra_config+=(--enable-libssp) - else - extra_config+=(--disable-libssp) - fi - if [ "${CT_CC_GCC_HAS_LIBQUADMATH}" = "y" ]; then - if [ "${CT_CC_GCC_LIBQUADMATH}" = "y" ]; then - extra_config+=(--enable-libquadmath) - extra_config+=(--enable-libquadmath-support) - else - extra_config+=(--disable-libquadmath) - extra_config+=(--disable-libquadmath-support) - fi - fi - if [ "${CT_CC_GCC_HAS_LIBSANITIZER}" = "y" ]; then - if [ "${CT_CC_GCC_LIBSANITIZER}" = "y" ]; then - extra_config+=(--enable-libsanitizer) - else - extra_config+=(--disable-libsanitizer) - fi - fi - - final_LDFLAGS+=("${ldflags}") - - # *** WARNING ! *** - # Keep this full if-else-if-elif-fi-fi block in sync - # with the same block in do_cc_core, above. - if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then - final_LDFLAGS+=("-static") - host_libstdcxx_flags+=("-static-libgcc") - host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++") - host_libstdcxx_flags+=("-lm") - # Companion libraries are build static (eg !shared), so - # the libstdc++ is not pulled automatically, although it - # is needed. Shoe-horn it in our LDFLAGS - # Ditto libm on some Fedora boxen - final_LDFLAGS+=("-lstdc++") - final_LDFLAGS+=("-lm") - else - if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then - # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 - # build script - # INFO: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, - # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html - host_libstdcxx_flags+=("-static-libgcc") - host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic") - host_libstdcxx_flags+=("-lm") - elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then - # When companion libraries are build static (eg !shared), - # the libstdc++ is not pulled automatically, although it - # is needed. Shoe-horn it in our LDFLAGS - # Ditto libm on some Fedora boxen - final_LDFLAGS+=("-lstdc++") - final_LDFLAGS+=("-lm") - fi - fi - - if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then - extra_config+=("--with-gmp=${complibs}") - extra_config+=("--with-mpfr=${complibs}") - fi - if [ "${CT_CC_GCC_USE_MPC}" = "y" ]; then - extra_config+=("--with-mpc=${complibs}") - fi - if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then - if [ "${CT_PPL}" = "y" ]; then - extra_config+=("--with-ppl=${complibs}") - # With PPL 0.11+, also pull libpwl if needed - if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then - host_libstdcxx_flags+=("-L${complibs}/lib") - host_libstdcxx_flags+=("-lpwl") - fi - fi - if [ "${CT_ISL}" = "y" ]; then - extra_config+=("--with-isl=${complibs}") - fi - extra_config+=("--with-cloog=${complibs}") - elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then - extra_config+=("--with-ppl=no") - extra_config+=("--with-isl=no") - extra_config+=("--with-cloog=no") - fi - if [ "${CT_CC_GCC_USE_LTO}" = "y" ]; then - extra_config+=("--with-libelf=${complibs}") - elif [ "${CT_CC_GCC_HAS_LTO}" = "y" ]; then - extra_config+=("--with-libelf=no") - fi - - if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then - extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}") - fi - - if [ "${CT_THREADS}" = "none" ]; then - extra_config+=("--disable-threads") - if [ "${CT_CC_GCC_4_2_or_later}" = y ]; then - CT_Test "Disabling libgomp for no-thread gcc>=4.2" "${CT_CC_GCC_LIBGOMP}" = "Y" - extra_config+=("--disable-libgomp") - fi - else - if [ "${CT_THREADS}" = "win32" ]; then - extra_config+=("--enable-threads=win32") - extra_config+=("--disable-win32-registry") - else - extra_config+=("--enable-threads=posix") - fi - fi - - if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then - extra_config+=("--enable-target-optspace") - fi - if [ "${CT_CC_GCC_DISABLE_PCH}" = "y" ]; then - extra_config+=("--disable-libstdcxx-pch") - fi - - case "${CT_CC_GCC_LDBL_128}" in - y) extra_config+=("--with-long-double-128");; - m) ;; - "") extra_config+=("--without-long-double-128");; - esac - - if [ "${CT_CC_GCC_BUILD_ID}" = "y" ]; then - extra_config+=( --enable-linker-build-id ) - fi - - case "${CT_CC_GCC_LNK_HASH_STYLE}" in - "") ;; - *) extra_config+=( "--with-linker-hash-style=${CT_CC_GCC_LNK_HASH_STYLE}" );; - esac - - case "${CT_CC_GCC_DEC_FLOATS}" in - "") ;; - *) extra_config+=( "--enable-decimal-float=${CT_CC_GCC_DEC_FLOATS}" );; - esac - - if [ "${CT_CC_GCC_ENABLE_PLUGINS}" = "y" ]; then - extra_config+=( --enable-plugin ) - fi - if [ "${CT_CC_GCC_GOLD}" = "y" ]; then - extra_config+=( --enable-gold ) - fi - - case "${CT_ARCH}" in - mips) - case "${CT_CC_GCC_mips_llsc}" in - y) extra_config+=( --with-llsc );; - m) ;; - *) extra_config+=( --without-llsc );; - esac - case "${CT_CC_GCC_mips_synci}" in - y) extra_config+=( --with-synci );; - m) ;; - *) extra_config+=( --without-synci );; - esac - if [ "${CT_CC_GCC_mips_plt}" ]; then - extra_config+=( --with-mips-plt ) - fi - ;; # ARCH is mips - esac - - [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls") - - if [ "${CT_CC_GCC_SYSTEM_ZLIB}" = "y" ]; then - extra_config+=("--with-system-zlib") - fi - - - # Some versions of gcc have a deffective --enable-multilib. - # Since that's the default, only pass --disable-multilib. - if [ "${CT_MULTILIB}" != "y" ]; then - extra_config+=("--disable-multilib") - fi - - CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" - - CT_DoExecLog CFG \ - CC_FOR_BUILD="${CT_BUILD}-gcc" \ - CFLAGS="${cflags}" \ - CXXFLAGS="${cflags}" \ - LDFLAGS="${final_LDFLAGS[*]}" \ - CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ - CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ - LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \ - --build=${CT_BUILD} \ - --host=${host} \ - --target=${CT_TARGET} \ - --prefix="${prefix}" \ - ${CC_SYSROOT_ARG} \ - "${extra_config[@]}" \ - --with-local-prefix="${CT_SYSROOT_DIR}" \ - --enable-c99 \ - --enable-long-long \ - "${CT_CC_EXTRA_CONFIG_ARRAY[@]}" - - if [ "${CT_CANADIAN}" = "y" ]; then - CT_DoLog EXTRA "Building libiberty" - CT_DoExecLog ALL make ${JOBSFLAGS} all-build-libiberty - fi - - CT_DoLog EXTRA "Building gcc" - CT_DoExecLog ALL make ${JOBSFLAGS} all - - CT_DoLog EXTRA "Installing gcc" - CT_DoExecLog ALL make ${JOBSFLAGS} install - - if [ "${build_manuals}" = "yes" ]; then - CT_DoLog EXTRA "Building the GCC manuals" - CT_DoExecLog ALL make pdf html - CT_DoLog EXTRA "Installing the GCC manuals" - CT_DoExecLog ALL make install-{pdf,html}-gcc - fi - - # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able - # to call the C compiler with the same, somewhat canonical name. - # check whether compiler has an extension - file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )" - [ -z "${file}" ] || ext=".${file##*.}" - if [ -f "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc${ext}" ]; then - CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}" - fi - - if [ "${CT_MULTILIB}" = "y" ]; then - if [ "${CT_CANADIAN}" = "y" ]; then - CT_DoLog WARN "Canadian Cross unable to confirm multilibs configured correctly" - else - multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib \ - |tail -n +2 ) ) - if [ ${#multilibs[@]} -ne 0 ]; then - CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):" - for i in "${multilibs[@]}"; do - dir="${i%%;*}" - flags="${i#*;}" - CT_DoLog EXTRA " ${flags//@/ -} --> ${dir}/" - done - else - CT_DoLog WARN "gcc configured for multilib, but none available" - fi - fi - fi -} diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index e101856..78abd96 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -143,7 +143,7 @@ CT_DoLog INFO "Building environment variables" . "${CT_LIB_DIR}/scripts/build/companion_libs.sh" . "${CT_LIB_DIR}/scripts/build/binutils/${CT_BINUTILS}.sh" . "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh" -. "${CT_LIB_DIR}/scripts/build/cc/${CT_CC}.sh" +. "${CT_LIB_DIR}/scripts/build/cc.sh" . "${CT_LIB_DIR}/scripts/build/debug.sh" . "${CT_LIB_DIR}/scripts/build/test_suite.sh" -- cgit v0.10.2-6-g49f6 From 541199de3a6dc195898b880b4ef2084c106b53ae Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 29 May 2015 21:40:49 +0100 Subject: config: Add config support for multiple compilers This change updates the config to support multiple compilers by moving CC_.* to CC_GCC_.* to make room for other compilers. We also update gen_in_frags.sh to check for a default cc. Signed-off-by: Ray Donnelly Reviewed-by: Yann Diorcet Reviewed-by: Bryan Hundven diff --git a/config/cc.in b/config/cc.in index aca8380..5603738 100644 --- a/config/cc.in +++ b/config/cc.in @@ -4,6 +4,7 @@ menu "C compiler" config CC string + default "gcc" config CC_VERSION string @@ -134,6 +135,4 @@ config CC_LANG_OTHERS Eg. gcc-4.1+ has a toy programming language, treelang. As it is not useful in real life, it is not available in the selection above. -source "config.gen/cc.in.2" - endmenu diff --git a/config/cc/gcc.in b/config/cc/gcc.in index a91e143..c03ffa5 100644 --- a/config/cc/gcc.in +++ b/config/cc/gcc.in @@ -1,5 +1,6 @@ # Compiler options # +## default y ## select CC_SUPPORT_CXX ## select CC_SUPPORT_FORTRAN ## select CC_SUPPORT_JAVA @@ -36,256 +37,256 @@ choice # Don't remove next line # CT_INSERT_VERSION_BELOW -config CC_V_5_1 +config CC_GCC_V_5_1 bool prompt "5.1.0" select CC_GCC_5_1 -config CC_V_linaro_4_9 +config CC_GCC_V_linaro_4_9 bool prompt "linaro-4.9-2015.03" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_9 -config CC_V_4_9_2 +config CC_GCC_V_4_9_2 bool prompt "4.9.2" select CC_GCC_4_9 -config CC_V_4_9_1 +config CC_GCC_V_4_9_1 bool prompt "4.9.1" select CC_GCC_4_9 -config CC_V_4_9_0 +config CC_GCC_V_4_9_0 bool prompt "4.9.0" select CC_GCC_4_9 -config CC_V_linaro_4_8 +config CC_GCC_V_linaro_4_8 bool prompt "linaro-4.8-2015.02" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_8 -config CC_V_4_8_4 +config CC_GCC_V_4_8_4 bool prompt "4.8.4" select CC_GCC_4_8 -config CC_V_4_8_3 +config CC_GCC_V_4_8_3 bool prompt "4.8.3" select CC_GCC_4_8 -config CC_V_4_8_2 +config CC_GCC_V_4_8_2 bool prompt "4.8.2" select CC_GCC_4_8 -config CC_V_4_8_1 +config CC_GCC_V_4_8_1 bool prompt "4.8.1" select CC_GCC_4_8 -config CC_V_4_8_0 +config CC_GCC_V_4_8_0 bool prompt "4.8.0" select CC_GCC_4_8 -config CC_V_linaro_4_7 +config CC_GCC_V_linaro_4_7 bool prompt "linaro-4.7-2014.06" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_7 -config CC_V_4_7_4 +config CC_GCC_V_4_7_4 bool prompt "4.7.4" select CC_GCC_4_7 -config CC_V_4_7_3 +config CC_GCC_V_4_7_3 bool prompt "4.7.3" select CC_GCC_4_7 -config CC_V_4_7_2 +config CC_GCC_V_4_7_2 bool prompt "4.7.2" select CC_GCC_4_7 -config CC_V_4_7_1 +config CC_GCC_V_4_7_1 bool prompt "4.7.1" select CC_GCC_4_7 -config CC_V_4_7_0 +config CC_GCC_V_4_7_0 bool prompt "4.7.0" select CC_GCC_4_7 -config CC_V_linaro_4_6 +config CC_GCC_V_linaro_4_6 bool prompt "linaro-4.6-2013.05" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_6 -config CC_V_4_6_4 +config CC_GCC_V_4_6_4 bool prompt "4.6.4" select CC_GCC_4_6 -config CC_V_4_6_3 +config CC_GCC_V_4_6_3 bool prompt "4.6.3" select CC_GCC_4_6 -config CC_V_4_6_2 +config CC_GCC_V_4_6_2 bool prompt "4.6.2" select CC_GCC_4_6 -config CC_V_4_6_1 +config CC_GCC_V_4_6_1 bool prompt "4.6.1" select CC_GCC_4_6 -config CC_V_4_6_0 +config CC_GCC_V_4_6_0 bool prompt "4.6.0" select CC_GCC_4_6 -config CC_V_linaro_4_5 +config CC_GCC_V_linaro_4_5 bool prompt "linaro-4.5-2012.03" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_5 -config CC_V_4_5_3 +config CC_GCC_V_4_5_3 bool prompt "4.5.3" select CC_GCC_4_5 -config CC_V_4_5_2 +config CC_GCC_V_4_5_2 bool prompt "4.5.2" select CC_GCC_4_5 -config CC_V_4_5_1 +config CC_GCC_V_4_5_1 bool prompt "4.5.1" select CC_GCC_4_5 -config CC_V_4_5_0 +config CC_GCC_V_4_5_0 bool prompt "4.5.0" select CC_GCC_4_5 -config CC_V_linaro_4_4 +config CC_GCC_V_linaro_4_4 bool prompt "linaro-4.4-2011.02-0" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_4 -config CC_V_4_4_7 +config CC_GCC_V_4_4_7 bool prompt "4.4.7" select CC_GCC_4_4 -config CC_V_4_4_6 +config CC_GCC_V_4_4_6 bool prompt "4.4.6" select CC_GCC_4_4 -config CC_V_4_4_5 +config CC_GCC_V_4_4_5 bool prompt "4.4.5" select CC_GCC_4_4 -config CC_V_4_4_4 +config CC_GCC_V_4_4_4 bool prompt "4.4.4" select CC_GCC_4_4 -config CC_V_4_4_3 +config CC_GCC_V_4_4_3 bool prompt "4.4.3" select CC_GCC_4_4 -config CC_V_4_4_2 +config CC_GCC_V_4_4_2 bool prompt "4.4.2" select CC_GCC_4_4 -config CC_V_4_4_1 +config CC_GCC_V_4_4_1 bool prompt "4.4.1" select CC_GCC_4_4 -config CC_V_4_4_0 +config CC_GCC_V_4_4_0 bool prompt "4.4.0" select CC_GCC_4_4 -config CC_V_4_3_6 +config CC_GCC_V_4_3_6 bool prompt "4.3.6" select CC_GCC_4_3 -config CC_V_4_3_5 +config CC_GCC_V_4_3_5 bool prompt "4.3.5" select CC_GCC_4_3 -config CC_V_4_3_4 +config CC_GCC_V_4_3_4 bool prompt "4.3.4" select CC_GCC_4_3 -config CC_V_4_3_3 +config CC_GCC_V_4_3_3 bool prompt "4.3.3" select CC_GCC_4_3 -config CC_V_4_3_2 +config CC_GCC_V_4_3_2 bool prompt "4.3.2" select CC_GCC_4_3 -config CC_V_4_3_1 +config CC_GCC_V_4_3_1 bool prompt "4.3.1" select CC_GCC_4_3 -config CC_V_4_2_4 +config CC_GCC_V_4_2_4 bool prompt "4.2.4" select CC_GCC_4_2 # We need that one, it's the only version with avr32 support # because we have a patch for it -config CC_V_4_2_2 +config CC_GCC_V_4_2_2 bool prompt "4.2.2" select CC_GCC_4_2 -config CC_V_4_1_2 +config CC_GCC_V_4_1_2 bool prompt "4.1.2 (OBSOLETE)" depends on OBSOLETE -config CC_V_4_0_4 +config CC_GCC_V_4_0_4 bool prompt "4.0.4 (OBSOLETE)" depends on OBSOLETE -config CC_V_3_4_6 +config CC_GCC_V_3_4_6 bool prompt "3.4.6 (OBSOLETE)" depends on OBSOLETE -config CC_CUSTOM +config CC_GCC_CUSTOM bool prompt "Custom gcc" depends on EXPERIMENTAL @@ -293,9 +294,9 @@ config CC_CUSTOM endchoice -if CC_CUSTOM +if CC_GCC_CUSTOM -config CC_CUSTOM_LOCATION +config CC_GCC_CUSTOM_LOCATION string prompt "Full path to custom gcc source" default "" @@ -303,7 +304,7 @@ config CC_CUSTOM_LOCATION Enter the path to the directory (or tarball) of your source for gcc, or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/gcc -endif #CC_CUSTOM +endif #CC_GCC_CUSTOM config CC_GCC_4_2 bool @@ -527,7 +528,7 @@ config CC_GCC_HAS_LIBQUADMATH config CC_GCC_HAS_LIBSANITIZER bool -config CC_VERSION +config CC_GCC_VERSION string # Don't remove next line # CT_INSERT_VERSION_STRING_BELOW @@ -591,3 +592,5 @@ config CC_LANG_JAVA_USE_ECJ # Fortran always requires GMP+MPFR, whatever the gcc version config CC_LANG_FORTRAN select CC_GCC_USE_GMP_MPFR + +source "config/cc/gcc.in.2" diff --git a/config/cc/gcc.in.2 b/config/cc/gcc.in.2 index b088515..fb19938 100644 --- a/config/cc/gcc.in.2 +++ b/config/cc/gcc.in.2 @@ -1,6 +1,6 @@ # gcc configuration options -config CC_ENABLE_CXX_FLAGS +config CC_GCC_ENABLE_CXX_FLAGS string prompt "Flags to pass to --enable-cxx-flags" default "" @@ -11,7 +11,7 @@ config CC_ENABLE_CXX_FLAGS Note: just pass in the option _value_, that is only the part that goes after the '=' sign. -config CC_CORE_EXTRA_CONFIG_ARRAY +config CC_GCC_CORE_EXTRA_CONFIG_ARRAY string prompt "Core gcc extra config" default "" @@ -26,7 +26,7 @@ config CC_CORE_EXTRA_CONFIG_ARRAY if they are properly quoted (or escaped, but prefer quotes). Eg.: --with-foo="1st arg with 4 spaces" --with-bar=2nd-arg-without-space -config CC_EXTRA_CONFIG_ARRAY +config CC_GCC_EXTRA_CONFIG_ARRAY string prompt "gcc extra config" default "" @@ -38,9 +38,9 @@ config CC_EXTRA_CONFIG_ARRAY --with-foo="1st arg with 4 spaces" --with-bar=2nd-arg-without-space config STATIC_TOOLCHAIN - select CC_STATIC_LIBSTDCXX if CC_GCC_4_4_or_later + select CC_GCC_STATIC_LIBSTDCXX if CC_GCC_4_4_or_later -config CC_STATIC_LIBSTDCXX +config CC_GCC_STATIC_LIBSTDCXX bool prompt "Link libstdc++ statically into the gcc binary" default y diff --git a/scripts/gen_in_frags.sh b/scripts/gen_in_frags.sh index 2451495..9c656a8 100755 --- a/scripts/gen_in_frags.sh +++ b/scripts/gen_in_frags.sh @@ -138,6 +138,9 @@ gen_menu() { _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}" printf ' bool\n' + if "${grep}" -E '^## default' ${file} >/dev/null 2>&1; then + "${sed}" -r -e '/^## default ?/!d; s/^## default ?/ default /;' ${file} 2>/dev/null + fi printf ' prompt "%s"\n' "${entry}" "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null -- cgit v0.10.2-6-g49f6 From 9cdbc7b1998c24b501af9b6a9c6730cc716fb220 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 29 May 2015 21:40:51 +0100 Subject: showSamples: Update showSamples.sh for multiple compilers This change adds support to show samples for multiple compilers. Signed-off-by: Ray Donnelly Reviewed-by: Bryan Hundven Reviewed-by: Yann Diorcet diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh index 011c75a..684e118 100755 --- a/scripts/showSamples.sh +++ b/scripts/showSamples.sh @@ -76,7 +76,15 @@ dump_single_sample() { [ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || printf " libelf-%s" "${CT_LIBELF_VERSION}" [ -z "${complibs}" ] || printf "\n" printf " %-*s : %s\n" ${width} "binutils" "binutils-${CT_BINUTILS_VERSION}" - printf " %-*s : %s" ${width} "C compiler" "${CT_CC}-${CT_CC_VERSION} (C" + printf " %-*s :" ${width} "C compilers" + for cc in $(env | ${sed} -n 's/^CT_CC_\(.*\)_VERSION.*/\1/p'); do + cc_variable=CT_CC_${cc}_VERSION + version=${!cc_variable} + compiler=$(echo $cc | ${awk} '{print tolower($0)}') + printf " $compiler-$version" + done + printf "\n" + printf " %-*s : %s" ${width} "Languages" "C" [ "${CT_CC_LANG_CXX}" = "y" ] && printf ",C++" [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran" [ "${CT_CC_LANG_JAVA}" = "y" ] && printf ",Java" @@ -85,7 +93,7 @@ dump_single_sample() { [ "${CT_CC_LANG_OBJCXX}" = "y" ] && printf ",Objective-C++" [ "${CT_CC_LANG_GOLANG}" = "y" ] && printf ",Go" [ -n "${CT_CC_LANG_OTHERS}" ] && printf ",${CT_CC_LANG_OTHERS}" - printf ")\n" + printf "\n" printf " %-*s : %s (threads: %s)\n" ${width} "C library" "${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}" "${CT_THREADS}" printf " %-*s :" ${width} "Tools" [ "${CT_TOOL_sstrip}" ] && printf " sstrip" @@ -120,8 +128,14 @@ dump_single_sample() { fi fi printf "| ${CT_BINUTILS_VERSION} " - printf "| ''${CT_CC}'' " - printf "| ${CT_CC_VERSION} " + printf "| " + for cc in $(env | ${sed} -n 's/^CT_CC_\(.*\)_VERSION.*/\1/p'); do + cc_variable=CT_CC_${cc}_VERSION + version=${!cc_variable} + compiler=$(echo $cc | ${awk} '{print tolower($0)}') + printf " $compiler-$version" + done + printf " " printf "| ''${CT_LIBC}'' |" if [ "${CT_LIBC}" != "none" ]; then printf " ${CT_LIBC_VERSION} " -- cgit v0.10.2-6-g49f6 From afbd17874a802b0903e47f0923ef520200c2baf6 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 29 May 2015 21:40:52 +0100 Subject: scripts: Update crosstool-NG internals for multiple compilers. This change updates the CC.* references to CC_GCC.* in the internal scripts. Signed-off-by: Ray Donnelly Reviewed-by: Bryan Hundven Reviewed-by: Yann Diorcet diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh index c7eb4c8..21f6472 100644 --- a/scripts/build/internals.sh +++ b/scripts/build/internals.sh @@ -28,33 +28,35 @@ do_finish() { CT_DoExecLog ALL "${CT_TARGET}-strip" ${strip_args} \ "${CT_TARGET}/debug-root/usr/bin/gdbserver" fi - # We can not use the version in CT_CC_VERSION because - # of the Linaro stuff. So, harvest the version string - # directly from the gcc sources... - # All gcc 4.x seem to have the version in gcc/BASE-VER - # while version prior to 4.x have the version in gcc/version.c - # Of course, here is not the better place to do that... - if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then - gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ) - else - gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c" \ - ) + if [ "${CT_CC_gcc}" = "y" ]; then + # We can not use the version in CT_CC_GCC_VERSION because + # of the Linaro stuff. So, harvest the version string + # directly from the gcc sources... + # All gcc 4.x seem to have the version in gcc/BASE-VER + # while version prior to 4.x have the version in gcc/version.c + # Of course, here is not the better place to do that... + if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then + gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ) + else + gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \ + ) + fi + for _t in "bin/${CT_TARGET}-"* \ + "${CT_TARGET}/bin/"* \ + "libexec/gcc/${CT_TARGET}/${gcc_version}/"* \ + "libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \ + ; do + _type="$( file "${_t}" |cut -d ' ' -f 2- )" + case "${_type}" in + *script*executable*) + ;; + *executable*) + CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}" + ;; + esac + done fi - for _t in "bin/${CT_TARGET}-"* \ - "${CT_TARGET}/bin/"* \ - "libexec/gcc/${CT_TARGET}/${gcc_version}/"* \ - "libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \ - ; do - _type="$( file "${_t}" |cut -d ' ' -f 2- )" - case "${_type}" in - *script*executable*) - ;; - *executable*) - CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}" - ;; - esac - done CT_Popd fi diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index 78abd96..ab654da 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -165,8 +165,8 @@ CT_PREFIX_DIR="$( "${sed}" -r -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )" # Put user-supplied flags at the end, so that they take precedence. CT_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}" CT_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}" -CT_CC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) -CT_CC_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_EXTRA_CONFIG} "${CT_CC_EXTRA_CONFIG_ARRAY[@]}" ) +CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) +CT_CC_GCC_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_EXTRA_CONFIG} "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" ) # Compute the package version string CT_PKGVERSION="crosstool-NG ${CT_VERSION}${CT_TOOLCHAIN_PKGVERSION:+ - ${CT_TOOLCHAIN_PKGVERSION}}" @@ -548,8 +548,8 @@ if [ -z "${CT_RESTART}" ]; then CT_EndStep fi - if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then - CT_DoStep DEBUG "Checking that gcc can statically link libstdc++ (CT_CC_STATIC_LIBSTDCXX)" + if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" ]; then + CT_DoStep DEBUG "Checking that gcc can statically link libstdc++ (CT_CC_GCC_STATIC_LIBSTDCXX)" CT_DoLog DEBUG "You may need to ensure that libstdc++.a is installed on your system" CT_DoExecLog DEBUG "${CT_HOST}-gcc" ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST} "${testc}" -static -lstdc++ -o "${gccout}" rm -f "${gccout}" -- cgit v0.10.2-6-g49f6 From 8ce2abf57db613b423470bfc5c16bdaf8ac67992 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 29 May 2015 21:40:54 +0100 Subject: cc: Update 100-gcc.sh for multiple compilers Update 100-gcc.sh to use the new config option names. Signed-off-by: Ray Donnelly Reviewed-by: Bryan Hundven Reviewed-by: Yann Diorcet diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh index 835aea0..f6ea34e 100644 --- a/scripts/build/cc/100-gcc.sh +++ b/scripts/build/cc/100-gcc.sh @@ -3,15 +3,15 @@ # Licensed under the GPL v2. See COPYING in the root of this package # Download gcc -do_cc_get() { +do_gcc_get() { local linaro_version="" local linaro_series="" - if [ "${CT_CC_CUSTOM}" = "y" ]; then - CT_GetCustom "gcc" "${CT_CC_VERSION}" "${CT_CC_CUSTOM_LOCATION}" + if [ "${CT_CC_GCC_CUSTOM}" = "y" ]; then + CT_GetCustom "gcc" "${CT_CC_GCC_VERSION}" "${CT_CC_GCC_CUSTOM_LOCATION}" else # Account for the Linaro versioning - linaro_version="$( echo "${CT_CC_VERSION}" \ + linaro_version="$( echo "${CT_CC_GCC_VERSION}" \ |${sed} -r -e 's/^linaro-//;' \ )" linaro_series="$( echo "${linaro_version}" \ @@ -21,13 +21,13 @@ do_cc_get() { # The official gcc hosts put gcc under a gcc/release/ directory, # whereas the mirrors put it in the gcc/ directory. # Also, Split out linaro mirrors, so that downloads happen faster. - if [ x"${linaro_version}" = x"${CT_CC_VERSION}" ]; then - CT_GetFile "gcc-${CT_CC_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_VERSION} \ - ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_VERSION} + if [ x"${linaro_version}" = x"${CT_CC_GCC_VERSION}" ]; then + CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \ + {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_GCC_VERSION} \ + ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_GCC_VERSION} else - YYMM=`echo ${CT_CC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'` - CT_GetFile "gcc-${CT_CC_VERSION}" \ + YYMM=`echo ${CT_CC_GCC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'` + CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \ "http://launchpad.net/gcc-linaro/${linaro_series}/${linaro_version}/+download" \ https://releases.linaro.org/${YYMM}/components/toolchain/gcc-linaro/${linaro_series} \ http://cbuild.validation.linaro.org/snapshots @@ -47,21 +47,21 @@ do_cc_get() { } # Extract gcc -do_cc_extract() { +do_gcc_extract() { # If using custom directory location, nothing to do - if [ "${CT_CC_CUSTOM}" = "y" \ - -a -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}" ]; then + if [ "${CT_CC_GCC_CUSTOM}" = "y" \ + -a -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}" ]; then return 0 fi - CT_Extract "gcc-${CT_CC_VERSION}" - CT_Patch "gcc" "${CT_CC_VERSION}" + CT_Extract "gcc-${CT_CC_GCC_VERSION}" + CT_Patch "gcc" "${CT_CC_GCC_VERSION}" # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" \ - -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" \ + -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar" \ ]; then - CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" + CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar" fi } @@ -86,7 +86,7 @@ cc_gcc_lang_list() { #------------------------------------------------------------------------------ # Core gcc pass 1 -do_cc_core_pass_1() { +do_gcc_core_pass_1() { local -a core_opts if [ "${CT_CC_CORE_PASS_1_NEEDED}" != "y" ]; then @@ -101,17 +101,17 @@ do_cc_core_pass_1() { core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) core_opts+=( "lang_list=c" ) - CT_DoStep INFO "Installing pass-1 core C compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-core-pass-1" + CT_DoStep INFO "Installing pass-1 core C gcc compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core-pass-1" - do_cc_core_backend "${core_opts[@]}" + do_gcc_core_backend "${core_opts[@]}" CT_Popd CT_EndStep } # Core gcc pass 2 -do_cc_core_pass_2() { +do_gcc_core_pass_2() { local -a core_opts if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then @@ -148,10 +148,10 @@ do_cc_core_pass_2() { ;; esac - CT_DoStep INFO "Installing pass-2 core C compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-core-pass-2" + CT_DoStep INFO "Installing pass-2 core C gcc compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core-pass-2" - do_cc_core_backend "${core_opts[@]}" + do_gcc_core_backend "${core_opts[@]}" CT_Popd CT_EndStep @@ -160,7 +160,7 @@ do_cc_core_pass_2() { #------------------------------------------------------------------------------ # Build core gcc # This function is used to build the core C compiler. -# Usage: do_cc_core_backend param=value [...] +# Usage: do_gcc_core_backend param=value [...] # Parameter : Definition : Type : Default # mode : build a 'static', 'shared' or 'baremetal' : string : (none) # host : the machine the core will run on : tuple : (none) @@ -174,8 +174,8 @@ do_cc_core_pass_2() { # build_manuals : whether to build manuals or not : bool : no # cflags : cflags to use : string : (empty) # ldflags : ldflags to use : string : (empty) -# Usage: do_cc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] -do_cc_core_backend() { +# Usage: do_gcc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] +do_gcc_core_backend() { local mode local build_libgcc=no local build_libstdcxx=no @@ -200,7 +200,7 @@ do_cc_core_backend() { eval "${arg// /\\ }" done - CT_DoLog EXTRA "Configuring gcc" + CT_DoLog EXTRA "Configuring core C gcc compiler" case "${mode}" in static) @@ -249,7 +249,7 @@ do_cc_core_backend() { # *** WARNING ! *** # Keep this full if-else-if-elif-fi-fi block in sync - # with the same block in do_cc, below. + # with the same block in do_gcc, below. if [ "${build_staticlinked}" = "yes" ]; then core_LDFLAGS+=("-static") host_libstdcxx_flags+=("-static-libgcc") @@ -262,7 +262,7 @@ do_cc_core_backend() { core_LDFLAGS+=("-lstdc++") core_LDFLAGS+=("-lm") else - if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then + if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" ]; then # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 # build script # INFO: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, @@ -379,21 +379,21 @@ do_cc_core_backend() { CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) - CT_DoExecLog CFG \ - CC_FOR_BUILD="${CT_BUILD}-gcc" \ - CFLAGS="${cflags}" \ - CXXFLAGS="${cflags}" \ - LDFLAGS="${core_LDFLAGS[*]}" \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \ - --build=${CT_BUILD} \ - --host=${host} \ - --target=${CT_TARGET} \ - --prefix="${prefix}" \ - --with-local-prefix="${CT_SYSROOT_DIR}" \ - --disable-libmudflap \ - ${CC_CORE_SYSROOT_ARG} \ - "${extra_config[@]}" \ - --enable-languages="${lang_list}" \ + CT_DoExecLog CFG \ + CC_FOR_BUILD="${CT_BUILD}-gcc" \ + CFLAGS="${cflags}" \ + CXXFLAGS="${cflags}" \ + LDFLAGS="${core_LDFLAGS[*]}" \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host=${host} \ + --target=${CT_TARGET} \ + --prefix="${prefix}" \ + --with-local-prefix="${CT_SYSROOT_DIR}" \ + --disable-libmudflap \ + ${CC_CORE_SYSROOT_ARG} \ + "${extra_config[@]}" \ + --enable-languages="${lang_list}" \ "${extra_user_config[@]}" if [ "${build_libgcc}" = "yes" ]; then @@ -413,7 +413,7 @@ do_cc_core_backend() { # so we configure then build it. # Next we have to configure gcc, create libgcc.mk then edit it... # So much easier if we just edit the source tree, but hey... - if [ ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then + if [ ! -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libiberty CT_DoExecLog ALL make ${JOBSFLAGS} -C libiberty libiberty.a CT_DoExecLog CFG make ${JOBSFLAGS} configure-gcc configure-libcpp @@ -423,12 +423,12 @@ do_cc_core_backend() { CT_DoExecLog ALL make ${JOBSFLAGS} all-libcpp all-build-libiberty fi # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here. - if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/libdecnumber" ]; then + if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libdecnumber" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libdecnumber CT_DoExecLog ALL make ${JOBSFLAGS} -C libdecnumber libdecnumber.a fi # HACK: gcc-4.8 uses libbacktrace to make libgcc.mvars, so make it here. - if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/libbacktrace" ]; then + if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libbacktrace" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libbacktrace CT_DoExecLog ALL make ${JOBSFLAGS} -C libbacktrace fi @@ -519,7 +519,7 @@ do_cc_core_backend() { #------------------------------------------------------------------------------ # Build complete gcc to run on build -do_cc_for_build() { +do_gcc_for_build() { local -a build_final_opts local build_final_backend @@ -544,13 +544,13 @@ do_cc_for_build() { if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then build_final_opts+=( "build_staticlinked=yes" ) fi - build_final_backend=do_cc_core_backend + build_final_backend=do_gcc_core_backend else - build_final_backend=do_cc_backend + build_final_backend=do_gcc_backend fi - CT_DoStep INFO "Installing final compiler for build" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final-build-${CT_BUILD}" + CT_DoStep INFO "Installing final gcc compiler for build" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-final-build-${CT_BUILD}" "${build_final_backend}" "${build_final_opts[@]}" @@ -560,7 +560,7 @@ do_cc_for_build() { #------------------------------------------------------------------------------ # Build final gcc to run on host -do_cc_for_host() { +do_gcc_for_host() { local -a final_opts local final_backend @@ -581,13 +581,13 @@ do_cc_for_host() { if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then final_opts+=( "build_staticlinked=yes" ) fi - final_backend=do_cc_core_backend + final_backend=do_gcc_core_backend else - final_backend=do_cc_backend + final_backend=do_gcc_backend fi - CT_DoStep INFO "Installing final compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final" + CT_DoStep INFO "Installing final gcc compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-final" "${final_backend}" "${final_opts[@]}" @@ -597,7 +597,7 @@ do_cc_for_host() { #------------------------------------------------------------------------------ # Build the final gcc -# Usage: do_cc_backend param=value [...] +# Usage: do_gcc_backend param=value [...] # Parameter : Definition : Type : Default # host : the host we run onto : tuple : (none) # prefix : the runtime prefix : dir : (none) @@ -606,7 +606,7 @@ do_cc_for_host() { # ldflags : ldflags to use : string : (empty) # lang_list : the list of languages to build : string : (empty) # build_manuals : whether to build manuals or not : bool : no -do_cc_backend() { +do_gcc_backend() { local host local prefix local complibs @@ -624,7 +624,7 @@ do_cc_backend() { eval "${arg// /\\ }" done - CT_DoLog EXTRA "Configuring gcc" + CT_DoLog EXTRA "Configuring final gcc compiler" # Enable selected languages extra_config+=("--enable-languages=${lang_list}") @@ -651,8 +651,8 @@ do_cc_backend() { else extra_config+=("--disable-__cxa_atexit") fi - if [ -n "${CT_CC_ENABLE_CXX_FLAGS}" ]; then - extra_config+=("--enable-cxx-flags=${CT_CC_ENABLE_CXX_FLAGS}") + if [ -n "${CT_CC_GCC_ENABLE_CXX_FLAGS}" ]; then + extra_config+=("--enable-cxx-flags=${CT_CC_GCC_ENABLE_CXX_FLAGS}") fi if [ "${CT_CC_GCC_4_8_or_later}" = "y" ]; then if [ "${CT_THREADS}" = "none" ]; then @@ -695,7 +695,7 @@ do_cc_backend() { # *** WARNING ! *** # Keep this full if-else-if-elif-fi-fi block in sync - # with the same block in do_cc_core, above. + # with the same block in do_gcc_core, above. if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then final_LDFLAGS+=("-static") host_libstdcxx_flags+=("-static-libgcc") @@ -708,7 +708,7 @@ do_cc_backend() { final_LDFLAGS+=("-lstdc++") final_LDFLAGS+=("-lm") else - if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then + if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" ]; then # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 # build script # INFO: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, @@ -851,7 +851,7 @@ do_cc_backend() { CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/configure" \ --build=${CT_BUILD} \ --host=${host} \ --target=${CT_TARGET} \ @@ -861,17 +861,17 @@ do_cc_backend() { --with-local-prefix="${CT_SYSROOT_DIR}" \ --enable-c99 \ --enable-long-long \ - "${CT_CC_EXTRA_CONFIG_ARRAY[@]}" + "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" if [ "${CT_CANADIAN}" = "y" ]; then CT_DoLog EXTRA "Building libiberty" CT_DoExecLog ALL make ${JOBSFLAGS} all-build-libiberty fi - CT_DoLog EXTRA "Building gcc" + CT_DoLog EXTRA "Building final gcc compiler" CT_DoExecLog ALL make ${JOBSFLAGS} all - CT_DoLog EXTRA "Installing gcc" + CT_DoLog EXTRA "Installing final gcc compiler" CT_DoExecLog ALL make ${JOBSFLAGS} install if [ "${build_manuals}" = "yes" ]; then -- cgit v0.10.2-6-g49f6 From cfd4437bf70f2b77744a20259716279b5d3fa632 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 29 May 2015 21:40:56 +0100 Subject: gdb: Update 300-gdb.sh for multiple compilers Update 300-gdb.sh to use the new config options. Signed-off-by: Ray Donnelly Reviewed-by: Bryan Hundven Reviewed-by: Yann Diorcet diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index 4eee214..93086b9 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -188,11 +188,11 @@ do_debug_gdb_build() { if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then CT_DoLog EXTRA "Installing '.gdbinit' template" # See in scripts/build/internals.sh for why we do this - if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then - gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ) + if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then + gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ) else - gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c" \ + gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \ ) fi ${sed} -r \ -- cgit v0.10.2-6-g49f6 From 00e7d4fd7b7868f1b3cce0d502ae6ee7723c4188 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 29 May 2015 21:40:58 +0100 Subject: test_suite: Update gcc test_suite for multiple compilers This commit updates gcc's test suite to use the new config options. Signed-off-by: Ray Donnelly Reviewed-by: Bryan Hundven Reviewed-by: Yann Diorcet diff --git a/scripts/build/test_suite/gcc.sh b/scripts/build/test_suite/gcc.sh index 178cffd..c829a43 100644 --- a/scripts/build/test_suite/gcc.sh +++ b/scripts/build/test_suite/gcc.sh @@ -15,10 +15,10 @@ do_test_suite_gcc_build() { CT_DoStep INFO "Installing GCC test suite" CT_DoExecLog ALL mkdir -p "${CT_TEST_SUITE_DIR}/gcc" - CT_DoExecLog ALL cp -av "${CT_LIB_DIR}/contrib/gcc-test-suite/default.cfg" \ - "${CT_LIB_DIR}/contrib/gcc-test-suite/Makefile" \ - "${CT_LIB_DIR}/contrib/gcc-test-suite/README" \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/testsuite" \ + CT_DoExecLog ALL cp -av "${CT_LIB_DIR}/contrib/gcc-test-suite/default.cfg" \ + "${CT_LIB_DIR}/contrib/gcc-test-suite/Makefile" \ + "${CT_LIB_DIR}/contrib/gcc-test-suite/README" \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/testsuite" \ "${CT_TEST_SUITE_DIR}/gcc" CT_DoExecLog ALL sed -i -r -e "s/@@DG_TARGET@@/${CT_TARGET}/g;" \ -- cgit v0.10.2-6-g49f6