Migrate all supported architectures to use the architecture-specific framework.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Sep 14 21:17:59 2007 +0000 (2007-09-14)
changeset 383f00eb97ff649
parent 382 9fc09fd403e7
child 384 5b30e5c8e25c
Migrate all supported architectures to use the architecture-specific framework.
arch/arm/functions
arch/ia64/functions
arch/mips/functions
arch/x86/functions
arch/x86_64/functions
docs/overview.txt
scripts/build/libc_glibc.sh
scripts/functions
     1.1 --- a/arch/arm/functions	Fri Sep 14 21:13:04 2007 +0000
     1.2 +++ b/arch/arm/functions	Fri Sep 14 21:17:59 2007 +0000
     1.3 @@ -0,0 +1,10 @@
     1.4 +# Compute ARM-specific values
     1.5 +
     1.6 +CT_DoArchValues() {
     1.7 +    # The architecture part of the tuple:
     1.8 +    CT_TARGET_ARCH="${CT_ARCH}${target_endian_eb}"
     1.9 +
    1.10 +    # The system part of the tuple default values is OK.
    1.11 +
    1.12 +    # The endianness option default value is OK.
    1.13 +}
     2.1 --- a/arch/ia64/functions	Fri Sep 14 21:13:04 2007 +0000
     2.2 +++ b/arch/ia64/functions	Fri Sep 14 21:17:59 2007 +0000
     2.3 @@ -0,0 +1,10 @@
     2.4 +# Compute IA-64-specific values
     2.5 +
     2.6 +CT_DoArchValues() {
     2.7 +    # The architecture part of the tuple:
     2.8 +    CT_TARGET_ARCH="${CT_ARCH}"
     2.9 +
    2.10 +    # The system part of the tuple default value is OK.
    2.11 +
    2.12 +    # The endianness option default value is OK.
    2.13 +}
     3.1 --- a/arch/mips/functions	Fri Sep 14 21:13:04 2007 +0000
     3.2 +++ b/arch/mips/functions	Fri Sep 14 21:17:59 2007 +0000
     3.3 @@ -0,0 +1,10 @@
     3.4 +# Compute IA-64-specific values
     3.5 +
     3.6 +CT_DoArchValues() {
     3.7 +    # The architecture part of the tuple:
     3.8 +    CT_TARGET_ARCH="${CT_ARCH}${target_endian_el}"
     3.9 +
    3.10 +    # The system part of the tuple default value is OK.
    3.11 +
    3.12 +    # The endianness option default value is OK.
    3.13 +}
     4.1 --- a/arch/x86/functions	Fri Sep 14 21:13:04 2007 +0000
     4.2 +++ b/arch/x86/functions	Fri Sep 14 21:17:59 2007 +0000
     4.3 @@ -0,0 +1,23 @@
     4.4 +# Compute x86-specific values
     4.5 +
     4.6 +# This one really need a little love! :-(
     4.7 +
     4.8 +CT_DoArchValues() {
     4.9 +    # The architecture part of the tuple:
    4.10 +    arch="${CT_ARCH_ARCH}"
    4.11 +    [ -z "${arch}" ] && arch="${CT_ARCH_TUNE}"
    4.12 +    case "${arch}" in
    4.13 +        nocona|athlon*64|k8|athlon-fx|opteron)
    4.14 +            CT_DoError "Architecture is x86 (32-bit) but selected processor is \"${arch}\" (64-bit)";;
    4.15 +        "")                           CT_TARGET_ARCH=i386;;
    4.16 +        i386|i486|i586|i686)          CT_TARGET_ARCH="${arch}";;
    4.17 +        winchip*)                     CT_TARGET_ARCH=i486;;
    4.18 +        pentium|pentium-mmx|c3*)      CT_TARGET_ARCH=i586;;
    4.19 +        pentiumpro|pentium*|athlon*)  CT_TARGET_ARCH=i686;;
    4.20 +        *)                            CT_TARGET_ARCH=i586;;
    4.21 +    esac
    4.22 +
    4.23 +    # The system part of the tuple default value is OK.
    4.24 +
    4.25 +    # The endianness option default value is OK.
    4.26 +}
     5.1 --- a/arch/x86_64/functions	Fri Sep 14 21:13:04 2007 +0000
     5.2 +++ b/arch/x86_64/functions	Fri Sep 14 21:17:59 2007 +0000
     5.3 @@ -0,0 +1,10 @@
     5.4 +# Compute x86_64-specific values
     5.5 +
     5.6 +CT_DoArchValues() {
     5.7 +    # The architecture part of the tuple:
     5.8 +    CT_TARGET_ARCH="${CT_ARCH}"
     5.9 +
    5.10 +    # The system part of the tuple default value is OK.
    5.11 +
    5.12 +    # The endianness option default value is OK.
    5.13 +}
     6.1 --- a/docs/overview.txt	Fri Sep 14 21:13:04 2007 +0000
     6.2 +++ b/docs/overview.txt	Fri Sep 14 21:17:59 2007 +0000
     6.3 @@ -485,23 +485,42 @@
     6.4       follow the API defined below. Eg.: arch/arm/functions
     6.5  
     6.6  The "functions" file API:
     6.7 - > the function "CT_DoBuildTargetTuple"
     6.8 + > the function "CT_DoArchValues"
     6.9     + parameters: none
    6.10     + environment:
    6.11        - all variables from the ".config" file,
    6.12        - the two variables "target_endian_eb" and "target_endian_el" which are
    6.13 -        the endiannes suffixes
    6.14 +        the endianness suffixes
    6.15     + return value: 0 upon success, !0 upon failure
    6.16     + provides:
    6.17 -     - the target tuple stored in the variable CT_TARGET_ARCH
    6.18 -
    6.19 - > the environment variable CT_ARCH_ENDIAN_OPT
    6.20 -   + contains:
    6.21 -     - the value of the CFLAGS values for selecting the endiannes (eg.: -ml
    6.22 -       for a Super-H little endian, -mbig-endian for an ARM big endian).
    6.23 -     - empty if the architecture can not set the endianness (eg x86 and
    6.24 -       x86_64).
    6.25 -
    6.26 +     - the environment variable CT_TARGET_ARCH
    6.27 +     - mandatory
    6.28 +     - contains:
    6.29 +       the architecture part of the target tuple.
    6.30 +       Eg.: "armeb" for big endian ARM
    6.31 +            "i386" for an i386
    6.32 +   + provides:
    6.33 +     - the environment variable CT_TARGET_ARCH
    6.34 +     - optional
    6.35 +     - contain:
    6.36 +       the sytem part of the target tuple.
    6.37 +       Eg.: "gnu" for glibc on most architectures
    6.38 +            "gnueabi" for glibc on an ARM EABI
    6.39 +     - defaults to:
    6.40 +       - for glibc-based toolchain: "gnu"
    6.41 +       - for uClibc-based toolchain: "uclibc"
    6.42 +   + provides:
    6.43 +     - the environment variable CT_ARCH_ENDIAN_OPT
    6.44 +     - optional
    6.45 +     - contains:
    6.46 +       the compiler option to set the endianness.
    6.47 +       Eg.: "-ml" for a Super-H little endian
    6.48 +            "-mbig-endian" for an ARM big endian
    6.49 +            /empty/ for x86 and x86_64
    6.50 +     - defaults to:
    6.51 +       - for bi-endian big endian architectures: "-mbig-endian"
    6.52 +       - for bi-endian little endian architectures: "-mlittle-endian"
    6.53 +       - for single-endian architectures: /empty/
    6.54  
    6.55  Build scripts |
    6.56  --------------*
     7.1 --- a/scripts/build/libc_glibc.sh	Fri Sep 14 21:13:04 2007 +0000
     7.2 +++ b/scripts/build/libc_glibc.sh	Fri Sep 14 21:17:59 2007 +0000
     7.3 @@ -230,14 +230,7 @@
     7.4      else
     7.5          extra_cc_args="${CT_CFLAGS_FOR_HOST}"
     7.6      fi
     7.7 -    case "${CT_LIBC_EXTRA_CC_ARGS}" in
     7.8 -        *-mbig-endian*) ;;
     7.9 -        *-mlittle-endian*) ;;
    7.10 -        *)  case "${CT_ARCH_BE},${CT_ARCH_LE}" in
    7.11 -                y,) extra_cc_args="${extra_cc_args} -mbig-endian";;
    7.12 -                ,y) extra_cc_args="${extra_cc_args} -mlittle-endian";;
    7.13 -            esac;;
    7.14 -    esac
    7.15 +    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
    7.16  
    7.17      cross_cc=`CT_Which "${CT_TARGET}-gcc"`
    7.18      CT_DoLog DEBUG "Using gcc for target    : \"${cross_cc}\""
    7.19 @@ -340,10 +333,7 @@
    7.20      else
    7.21          extra_cc_args="${CT_CFLAGS_FOR_HOST}"
    7.22      fi
    7.23 -    case "${CT_ARCH_BE},${CT_ARCH_LE}" in
    7.24 -        y,) extra_cc_args="${extra_cc_args} -mbig-endian";;
    7.25 -        ,y) extra_cc_args="${extra_cc_args} -mlittle-endian";;
    7.26 -    esac
    7.27 +    extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
    7.28  
    7.29      cross_cc=`CT_Which "${CT_TARGET}-gcc"`
    7.30      CT_DoLog DEBUG "Using gcc for target    : \"${cross_cc}\""
     8.1 --- a/scripts/functions	Fri Sep 14 21:13:04 2007 +0000
     8.2 +++ b/scripts/functions	Fri Sep 14 21:17:59 2007 +0000
     8.3 @@ -487,42 +487,32 @@
     8.4  # tuple. It is needed both by the normal build sequence, as well as the
     8.5  # sample saving sequence.
     8.6  CT_DoBuildTargetTuple() {
     8.7 +    # Set the endianness suffix, and the default endianness gcc option
     8.8      case "${CT_ARCH_BE},${CT_ARCH_LE}" in
     8.9 -        y,) target_endian_eb=eb; target_endian_el=;;
    8.10 -        ,y) target_endian_eb=; target_endian_el=el;;
    8.11 +        y,) target_endian_eb=eb
    8.12 +            target_endian_el=
    8.13 +            CT_ARCH_ENDIAN_OPT="-mbig-endian"
    8.14 +            ;;
    8.15 +        ,y) target_endian_eb=
    8.16 +            target_endian_el=el
    8.17 +            CT_ARCH_ENDIAN_OPT="-mlittle-endian"
    8.18 +            ;;
    8.19      esac
    8.20 -    case "${CT_ARCH}" in
    8.21 -        arm)  CT_TARGET="${CT_ARCH}${target_endian_eb}";;
    8.22 -        ia64) CT_TARGET="${CT_ARCH}";;
    8.23 -        mips) CT_TARGET="${CT_ARCH}${target_endian_el}";;
    8.24 -        x86*) # Much love for this one :-(
    8.25 -              arch="${CT_ARCH_ARCH}"
    8.26 -              [ -z "${arch}" ] && arch="${CT_ARCH_TUNE}"
    8.27 -              case "${CT_ARCH}" in
    8.28 -                  x86_64)  CT_TARGET=x86_64;;
    8.29 -              	  *)  case "${arch}" in
    8.30 -                          "")                                       CT_TARGET=i386;;
    8.31 -                          i386|i486|i586|i686)                      CT_TARGET="${arch}";;
    8.32 -                          winchip*)                                 CT_TARGET=i486;;
    8.33 -                          pentium|pentium-mmx|c3*)                  CT_TARGET=i586;;
    8.34 -                          nocona|athlon*64|k8|athlon-fx|opteron)    CT_TARGET=x86_64;;
    8.35 -                          pentiumpro|pentium*|athlon*)              CT_TARGET=i686;;
    8.36 -                          *)                                        CT_TARGET=i586;;
    8.37 -                      esac;;
    8.38 -              esac;;
    8.39 +
    8.40 +    # Set defaults for the system part of the tuple. Can be overriden
    8.41 +    # by architecture-specific values.
    8.42 +    case "${CT_LIBC}" in
    8.43 +        glibc)  CT_TARGET_SYS=gnu;;
    8.44 +        uClibc) CT_TARGET_SYS=uclibc;;
    8.45      esac
    8.46 -    case "${CT_TARGET_VENDOR}" in
    8.47 -        "") CT_TARGET="${CT_TARGET}-unknown";;
    8.48 -        *)  CT_TARGET="${CT_TARGET}-${CT_TARGET_VENDOR}";;
    8.49 +
    8.50 +    # Call the architecture specific settings
    8.51 +    CT_DoArchValues
    8.52 +
    8.53 +    case "${CT_KERNEL}" in
    8.54 +        linux*)  CT_TARGET_KERNEL=linux;;
    8.55      esac
    8.56 -    case "${CT_KERNEL}" in
    8.57 -        linux*)  CT_TARGET="${CT_TARGET}-linux";;
    8.58 -    esac
    8.59 -    case "${CT_LIBC}" in
    8.60 -        glibc)  CT_TARGET="${CT_TARGET}-gnu";;
    8.61 -        uClibc) CT_TARGET="${CT_TARGET}-uclibc";;
    8.62 -    esac
    8.63 -    CT_TARGET=`CT_DoConfigSub "${CT_TARGET}"`
    8.64 +    CT_TARGET=`CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}-${CT_TARGET_SYS}"`
    8.65  }
    8.66  
    8.67  # This function does pause the build until the user strikes "Return"