summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r--eclass/toolchain.eclass52
1 files changed, 35 insertions, 17 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index d93068619cf9..a145e74d5521 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1647,19 +1647,48 @@ gcc_do_make() {
fi
fi
- if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
- STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
- fi
+ local emakeargs=(
+ LDFLAGS="${LDFLAGS}"
+ LIBPATH="${LIBPATH}"
+ )
if is_crosscompile; then
# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
# but I'll leave this in anyways as someone might have had
# some reason for putting it in here... --eradicator
BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
+ emakeargs+=( BOOT_CFLAGS="${BOOT_CFLAGS}" )
else
- # we only want to use the system's CFLAGS if not building a
+ # XXX: Hack for bug #914881, clean this up when fixed and go back
+ # to just calling get_abi_LDFLAGS as before.
+ local abi_ldflags="$(get_abi_LDFLAGS ${TARGET_DEFAULT_ABI})"
+ printf -v abi_ldflags -- "-Wl,%s " ${abi_ldflags}
+
+ # If the host compiler is too old, let's use -O0 per the upstream
+ # default to be safe (to avoid a bootstrap comparison failure later).
+ #
+ # The last known issues are with < GCC 4.9 or so, but it's easier
+ # to keep this bound somewhat fresh just to avoid problems. Ultimately,
+ # using not-O0 is just a build-time speed improvement anyway.
+ if tc-is-gcc && ver_test $(gcc-fullversion) -lt 10 ; then
+ STAGE1_CFLAGS="-O0"
+ fi
+
+ # We only want to use the system's CFLAGS if not building a
# cross-compiler.
+ STAGE1_CFLAGS=${STAGE1_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
+ STAGE1_LDFLAGS=${STAGE1_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"}
BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
+ BOOT_LDFLAGS=${BOOT_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"}
+ LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}"
+
+ emakeargs+=(
+ STAGE1_CFLAGS="${STAGE1_CFLAGS}"
+ STAGE1_LDFLAGS="${STAGE1_LDFLAGS}"
+ BOOT_CFLAGS="${BOOT_CFLAGS}"
+ BOOT_LDFLAGS="${BOOT_LDFLAGS}"
+ LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET}"
+ )
fi
if is_jit ; then
@@ -1667,24 +1696,13 @@ gcc_do_make() {
pushd "${WORKDIR}"/build-jit > /dev/null || die
einfo "Building JIT"
- emake \
- LDFLAGS="${LDFLAGS}" \
- STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${BOOT_CFLAGS}"
+ emake "${emakeargs[@]}"
popd > /dev/null || die
fi
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
-
pushd "${WORKDIR}"/build >/dev/null || die
-
- emake \
- LDFLAGS="${LDFLAGS}" \
- STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${BOOT_CFLAGS}" \
- ${GCC_MAKE_TARGET}
+ emake "${emakeargs[@]}" ${GCC_MAKE_TARGET}
if is_ada; then
# Without these links, it is not getting the good compiler