diff -r d26d8cc7c460 -r 90e887b06da3 scripts/build/cc_gcc.sh --- a/scripts/build/cc_gcc.sh Sun Jul 27 16:35:37 2008 +0000 +++ b/scripts/build/cc_gcc.sh Mon Aug 04 12:38:06 2008 +0000 @@ -90,16 +90,67 @@ --enable-target-optspace \ ${CT_CC_CORE_EXTRA_CONFIG} + # 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}/${CT_CC_FILE}/gcc/BASE-VER" ]; then + CT_DoExecLog ALL make configure-libiberty + CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libiberty libiberty.a + CT_DoExecLog ALL make configure-gcc configure-libcpp + CT_DoExecLog ALL make ${PARALLELMFLAGS} all-libcpp + else + CT_DoExecLog ALL make configure-gcc configure-libcpp configure-build-libiberty + CT_DoExecLog ALL make ${PARALLELMFLAGS} 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}/${CT_CC_FILE}/libdecnumber" ]; then + CT_DoExecLog ALL make configure-libdecnumber + CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libdecnumber libdecnumber.a + fi + + # Starting with GCC 4.3, libgcc.mk is no longer built, + # and libgcc.mvars is used instead. + + gcc_version_major=$(echo ${CT_CC_VERSION} |sed -r -e 's/^([^\.]+)\..*/\1/') + gcc_version_minor=$(echo ${CT_CC_VERSION} |sed -r -e 's/^[^\.]+\.([^.]+).*/\1/') + + if [ ${gcc_version_major} -eq 4 -a ${gcc_version_minor} -ge 3 \ + -o ${gcc_version_major} -gt 4 ]; then + libgcc_rule="libgcc.mvars" + build_rules="all-gcc all-target-libgcc" + install_rules="install-gcc install-target-libgcc" + else + libgcc_rule="libgcc.mk" + build_rules="all-gcc" + install_rules="install-gcc" + fi + + CT_DoExecLog ALL make ${PARALLELMFLAGS} -C gcc ${libgcc_rule} + sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule} + if [ "${CT_CANADIAN}" = "y" ]; then CT_DoLog EXTRA "Building libiberty" CT_DoExecLog ALL make ${PARALLELMFLAGS} all-build-libiberty fi CT_DoLog EXTRA "Building static core C compiler" - CT_DoExecLog ALL make ${PARALLELMFLAGS} all-gcc + CT_DoExecLog ALL make ${PARALLELMFLAGS} ${build_rules} CT_DoLog EXTRA "Installing static core C compiler" - CT_DoExecLog ALL make install-gcc + CT_DoExecLog ALL make ${install_rules} CT_EndStep }