Fix building core C compiler.

PowerPC unveiled that you can't reliably build a target libgcc until you have C library headers.
In fact you can't build it at all. The fact that it did build for some architectures was purely coincidental, and a mistake.
This fix should still allow to build uClibc-based toolchains (some ARM uClibc toolchains were build-tested).

 /trunk/scripts/build/cc_gcc.sh |  100    47    53     0 +++++++++++++++++++++++-------------------------
 1 file changed, 47 insertions(+), 53 deletions(-)
This commit is contained in:
Yann E. MORIN" 2008-08-07 13:28:02 +00:00
parent e348d316b7
commit f53dd7e985

View File

@ -30,23 +30,28 @@ do_cc_core_pass_1() {
# In case we're NPTL, build the static core gcc; # In case we're NPTL, build the static core gcc;
# in any other case, do nothing. # in any other case, do nothing.
case "${CT_THREADS}" in case "${CT_THREADS}" in
nptl) do_cc_core_static;; nptl) do_cc_core_static build_libgcc=no;;
esac esac
} }
# Core gcc pass 2 # Core gcc pass 2
do_cc_core_pass_2() { do_cc_core_pass_2() {
# In case we're NPTL, build the shared core gcc, # In case we're NPTL, build the shared core gcc,
# in any other case, build the static core gcc. # in any other case, build the static core gcc and the target libgcc.
case "${CT_THREADS}" in case "${CT_THREADS}" in
nptl) do_cc_core_shared;; nptl) do_cc_core_shared;;
*) do_cc_core_static;; *) do_cc_core_static build_libgcc=yes;;
esac esac
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Build static core gcc # Build static core gcc
# We need to know wether to build the target libgcc!
# Usage: do_cc_core_static <build_libgcc=[yes|no]>
do_cc_core_static() { do_cc_core_static() {
eval $1
CT_TestOrAbort "Internal Error: '$0' does not know wether to build, or not to build, target libgcc" -n "${build_libgcc}"
mkdir -p "${CT_BUILD_DIR}/build-cc-core-static" mkdir -p "${CT_BUILD_DIR}/build-cc-core-static"
cd "${CT_BUILD_DIR}/build-cc-core-static" cd "${CT_BUILD_DIR}/build-cc-core-static"
@ -90,22 +95,7 @@ do_cc_core_static() {
--enable-target-optspace \ --enable-target-optspace \
${CT_CC_CORE_EXTRA_CONFIG} ${CT_CC_CORE_EXTRA_CONFIG}
# HACK: we need to override SHLIB_LC from gcc/config/t-slibgcc-elf-ver or if [ "${build_libgcc}" = "yes" ]; then
# 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 if [ ! -f "${CT_SRC_DIR}/${CT_CC_FILE}/gcc/BASE-VER" ]; then
CT_DoExecLog ALL make configure-libiberty CT_DoExecLog ALL make configure-libiberty
CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libiberty libiberty.a CT_DoExecLog ALL make ${PARALLELMFLAGS} -C libiberty libiberty.a
@ -140,6 +130,10 @@ do_cc_core_static() {
CT_DoExecLog ALL make ${PARALLELMFLAGS} -C gcc ${libgcc_rule} CT_DoExecLog ALL make ${PARALLELMFLAGS} -C gcc ${libgcc_rule}
sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule} sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule}
else # build_libgcc
build_rules="all-gcc"
install_rules="install-gcc"
fi # ! build libgcc
if [ "${CT_CANADIAN}" = "y" ]; then if [ "${CT_CANADIAN}" = "y" ]; then
CT_DoLog EXTRA "Building libiberty" CT_DoLog EXTRA "Building libiberty"