cc/gcc: build core compilers for canadian
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jan 03 22:57:25 2012 +0100 (2012-01-03)
changeset 29362dfea349d307
parent 2935 4a563f872440
child 2937 e94b6f607b05
cc/gcc: build core compilers for canadian

Currently, we rely on an existing external cross-compiler targetting
the target, to build the C library.

This can pause quite a few problems if that compiler is different from
the one we are building, because it could introduce some ABI issues.

This patch removes this dependency, by building the core compilers
as we do for standard cross, and also by building the binutils and
gcc, for running on the build machine.

This means we no longer need to offer the cross-sompiler selection in
the menuconfig.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/toolchain.in
scripts/build/cc/gcc.sh
scripts/crosstool-NG.sh.in
steps.mk
     1.1 --- a/config/toolchain.in	Mon Apr 02 22:54:30 2012 +0200
     1.2 +++ b/config/toolchain.in	Tue Jan 03 22:57:25 2012 +0100
     1.3 @@ -303,55 +303,6 @@
     1.4  
     1.5  endif # CANADIAN
     1.6  
     1.7 -if CROSS_NATIVE || CANADIAN
     1.8 -
     1.9 -comment "Target system"
    1.10 -
    1.11 -config TARGET_PREFIX
    1.12 -    string
    1.13 -    prompt "|  Tools prefix (READ HELP!)"
    1.14 -    default ""
    1.15 -    help
    1.16 -      If you have your *target system* tools in a weird location, and/or
    1.17 -      they have an unusual prefix, enter it here.
    1.18 -      
    1.19 -      Usually, you should leave that empty!
    1.20 -      
    1.21 -      Eg.:
    1.22 -        If your *target* gcc is /opt/target-tools/bin/weird-gcc then you
    1.23 -        should enter:
    1.24 -            /opt/target-tools/bin/weird-
    1.25 -        
    1.26 -        If your *target* gcc is /opt/target-tools/bin/weird-gcc and
    1.27 -        /opt/target-tools/bin is in your PATH, you should enter:
    1.28 -            weird-
    1.29 -        
    1.30 -        If your *target* gcc is /opt/target-tools/bin/gcc then you
    1.31 -        should enter (do not forget to add the trailing '/'):
    1.32 -            /opt/target-tools/bin/
    1.33 -
    1.34 -config TARGET_SUFFIX
    1.35 -    string
    1.36 -    prompt "|  Tools suffix (READ HELP!)"
    1.37 -    default ""
    1.38 -    help
    1.39 -      If your *target system* tools have an unusual suffix, enter it
    1.40 -      here.
    1.41 -      
    1.42 -      Usually, you should leave that empty!
    1.43 -      
    1.44 -      Eg.:
    1.45 -        If your 'default' gcc is gcc 4.3.1, but you also have gcc-3.4.2
    1.46 -        installed as gcc-3.4, then you should enter:
    1.47 -            -3.4
    1.48 -      
    1.49 -      It can happen that some of the tools have a suffix, when others
    1.50 -      don't, eg. you can have 'gcc-3.4' and 'ar'. crosstool-NG accounts
    1.51 -      for that by checking the tools without the suffix in case it can
    1.52 -      not find some of the tool.
    1.53 -
    1.54 -endif # CROSS_NATIVE || CANADIAN
    1.55 -
    1.56  comment "Misc options"
    1.57  
    1.58  config TOOLCHAIN_ENABLE_NLS
     2.1 --- a/scripts/build/cc/gcc.sh	Mon Apr 02 22:54:30 2012 +0200
     2.2 +++ b/scripts/build/cc/gcc.sh	Tue Jan 03 22:57:25 2012 +0100
     2.3 @@ -76,13 +76,10 @@
     2.4      local -a core_opts
     2.5      local do_core
     2.6  
     2.7 -    # Do nothing for canadian-crosses, we already have a target compiler.
     2.8      # We only need a pass-1 core gcc if the threading model is NPTL.
     2.9      # For all other cases, it is not used.
    2.10 -    case "${CT_CANADIAN},${CT_THREADS}" in
    2.11 -        y,*)
    2.12 -            ;;
    2.13 -        ,nptl)
    2.14 +    case "${CT_THREADS}" in
    2.15 +        nptl)
    2.16              do_core=y
    2.17              core_opts+=( "mode=static" )
    2.18              core_opts+=( "host=${CT_BUILD}" )
    2.19 @@ -116,21 +113,18 @@
    2.20      core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    2.21      core_opts+=( "lang_list=c" )
    2.22  
    2.23 -    # Do nothing for canadian-crosses, we already have a target compiler.
    2.24      # Different conditions are at stake here:
    2.25      #   - In case the threading model is NPTL, we need a shared-capable core
    2.26      #     gcc; in all other cases, we need a static-only core gcc.
    2.27      #   - In case the threading model is NPTL or win32, or gcc is 4.3 or
    2.28      #     later, we need to build libgcc
    2.29 -    case "${CT_CANADIAN},${CT_THREADS}" in
    2.30 -        y,*)
    2.31 -            ;;
    2.32 -        ,nptl)
    2.33 +    case "${CT_THREADS}" in
    2.34 +        nptl)
    2.35              do_core=y
    2.36              core_opts+=( "mode=shared" )
    2.37              core_opts+=( "build_libgcc=yes" )
    2.38              ;;
    2.39 -        ,win32)
    2.40 +        win32)
    2.41              do_core=y
    2.42              core_opts+=( "mode=static" )
    2.43              core_opts+=( "build_libgcc=yes" )
     3.1 --- a/scripts/crosstool-NG.sh.in	Mon Apr 02 22:54:30 2012 +0200
     3.2 +++ b/scripts/crosstool-NG.sh.in	Tue Jan 03 22:57:25 2012 +0100
     3.3 @@ -354,7 +354,7 @@
     3.4              build_mangle="build_"
     3.5              host_mangle="host_"
     3.6              target_mangle=""
     3.7 -            install_build_tools_for="BUILD HOST TARGET"
     3.8 +            install_build_tools_for="BUILD HOST"
     3.9              ;;
    3.10          *)  CT_Abort "No code for '${CT_TOOLCHAIN_TYPE}' toolchain type!"
    3.11              ;;
     4.1 --- a/steps.mk	Mon Apr 02 22:54:30 2012 +0200
     4.2 +++ b/steps.mk	Tue Jan 03 22:57:25 2012 +0100
     4.3 @@ -14,9 +14,19 @@
     4.4  # ----------------------------------------------------------
     4.5  # The steps list
     4.6  
     4.7 +# The _for_build steps are noop for native and cross,
     4.8 +# but are actual steps for canadian and cross-native.
     4.9  # Please keep the last line with a '\' and keep the following empy line:
    4.10  # it helps when diffing and merging.
    4.11  CT_STEPS := libc_check_config   \
    4.12 +            gmp_for_build       \
    4.13 +            mpfr_for_build      \
    4.14 +            ppl_for_build       \
    4.15 +            cloog_for_build     \
    4.16 +            mpc_for_build       \
    4.17 +            libelf_for_build    \
    4.18 +            binutils_for_build  \
    4.19 +            elf2flt_for_build   \
    4.20              gmp_for_host        \
    4.21              mpfr_for_host       \
    4.22              ppl_for_host        \
    4.23 @@ -31,6 +41,7 @@
    4.24              libc_start_files    \
    4.25              cc_core_pass_2      \
    4.26              libc                \
    4.27 +            cc_for_build        \
    4.28              cc_for_host         \
    4.29              libc_finish         \
    4.30              libelf_for_target   \
    4.31 @@ -39,6 +50,9 @@
    4.32              test_suite          \
    4.33              finish              \
    4.34  
    4.35 +# Keep an empty line above this comment, so the last
    4.36 +# back-slash terminated line works as expected.
    4.37 +
    4.38  # Make the list available to sub-processes (scripts/crosstool-NG.sh needs it)
    4.39  export CT_STEPS
    4.40