Pass FOR_BUILD flags when building the pass-1/2 core GCC.

Current build passes {CFLAGS,LDFLAGS}_FOR_HOST - which breaks canadian cross
(e.g. tried building for x86_64-unknown-linux-uclibc host). This dates
back to the days of yore when CFLAGS were set directly in the do_gcc_core_backend
(and that function is used as the final gcc's backend).

do_gcc_core_backend is now passed with CFLAGS/LDFLAGS to use, so let
the pass-1/pass-2/final-for-build steps pass the appropriate flags.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2016-11-28 22:47:42 -08:00
parent 699a54d8ce
commit 2091c5dd2d

View File

@ -260,8 +260,8 @@ do_gcc_core_pass_1() {
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+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
core_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
core_opts+=( "lang_list=c" )
core_opts+=( "build_step=core1" )
@ -286,8 +286,8 @@ do_gcc_core_pass_2() {
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+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
core_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
core_opts+=( "lang_list=c" )
core_opts+=( "build_step=core2" )
@ -742,9 +742,8 @@ do_gcc_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.
# If native or simple cross toolchain is being built, then build==host;
# nothing to do.
case "${CT_TOOLCHAIN_TYPE}" in
native|cross) return 0;;
esac
@ -752,6 +751,8 @@ do_gcc_for_build() {
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+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
build_final_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
build_final_opts+=( "lang_list=$( cc_gcc_lang_list )" )
build_final_opts+=( "build_step=gcc_build" )
if [ "${CT_BARE_METAL}" = "y" ]; then