cc/gcc: do not use the core pass-2 to build the baremetal compiler
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 17 22:43:07 2011 +0200 (2011-07-17)
changeset 2893a8a65758664f
parent 2892 aa934ec4b4ee
child 2894 7c6f2d990384
cc/gcc: do not use the core pass-2 to build the baremetal compiler

In case we build a baremetal compiler, use the standard passes:
- core_cc is used to build the C library;
- as such, it is meant to run on build, not host;
- the final compiler is meant to run on host;

As the current final compiler step can not build a baremetal compiler,
call the core backend from the final step.

NB: Currently, newlib is built during the start_files pass, so we have
to have a core compiler by then... Once we can build the baremetal
compiler from the final cc step, then we can move the newlib build to
the proper step, and then get rid of the core pass-1 static compiler...

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/cc/gcc.sh
     1.1 --- a/scripts/build/cc/gcc.sh	Sun Jul 17 22:46:47 2011 +0200
     1.2 +++ b/scripts/build/cc/gcc.sh	Sun Jul 17 22:43:07 2011 +0200
     1.3 @@ -105,17 +105,11 @@
     1.4      case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in
     1.5          y,*,*)
     1.6              do_core=y
     1.7 -            core_opts+=( "mode=baremetal" )
     1.8              core_opts+=( "host=${CT_HOST}" )
     1.9 -            core_opts+=( "build_libgcc=yes" )
    1.10 -            core_opts+=( "build_libstdcxx=yes" )
    1.11 +            core_opts+=( "mode=static" )
    1.12 +            core_opts+=( "prefix=${CT_CC_CORE_STATIC_PREFIX_DIR}" )
    1.13              core_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
    1.14 -            core_opts+=( "prefix=${CT_PREFIX_DIR}" )
    1.15              core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    1.16 -            if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
    1.17 -                core_opts+=( "build_staticlinked=yes" )
    1.18 -            fi
    1.19 -            core_opts+=( "build_manuals=yes" )
    1.20              ;;
    1.21          ,y,*)   ;;
    1.22          ,,nptl)
    1.23 @@ -488,13 +482,26 @@
    1.24  # Build final gcc
    1.25  do_cc() {
    1.26      local -a final_opts
    1.27 +    local final_backend
    1.28  
    1.29      final_opts+=( "host=${CT_HOST}" )
    1.30      final_opts+=( "prefix=${CT_PREFIX_DIR}" )
    1.31      final_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
    1.32      final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    1.33 +    if [ "${CT_BARE_METAL}" = "y" ]; then
    1.34 +        final_opts+=( "mode=baremetal" )
    1.35 +        final_opts+=( "build_libgcc=yes" )
    1.36 +        final_opts+=( "build_libstdcxx=yes" )
    1.37 +        if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
    1.38 +            final_opts+=( "build_staticlinked=yes" )
    1.39 +        fi
    1.40 +        final_opts+=( "build_manuals=yes" )
    1.41 +        final_backend=do_cc_core_backend
    1.42 +    else
    1.43 +        final_backend=do_cc_backend
    1.44 +    fi
    1.45  
    1.46 -    do_cc_backend "${final_opts[@]}"
    1.47 +    "${final_backend}" "${final_opts[@]}"
    1.48  }
    1.49  
    1.50  #------------------------------------------------------------------------------