# HG changeset patch # User "Yann E. MORIN" # Date 1189804679 0 # Node ID f00eb97ff64957dbe7ad1f00ae9b3ff85300d44d # Parent 9fc09fd403e7edc7fb9af74860db45cfbe583740 Migrate all supported architectures to use the architecture-specific framework. diff -r 9fc09fd403e7 -r f00eb97ff649 arch/arm/functions --- a/arch/arm/functions Fri Sep 14 21:13:04 2007 +0000 +++ b/arch/arm/functions Fri Sep 14 21:17:59 2007 +0000 @@ -0,0 +1,10 @@ +# Compute ARM-specific values + +CT_DoArchValues() { + # The architecture part of the tuple: + CT_TARGET_ARCH="${CT_ARCH}${target_endian_eb}" + + # The system part of the tuple default values is OK. + + # The endianness option default value is OK. +} diff -r 9fc09fd403e7 -r f00eb97ff649 arch/ia64/functions --- a/arch/ia64/functions Fri Sep 14 21:13:04 2007 +0000 +++ b/arch/ia64/functions Fri Sep 14 21:17:59 2007 +0000 @@ -0,0 +1,10 @@ +# Compute IA-64-specific values + +CT_DoArchValues() { + # The architecture part of the tuple: + CT_TARGET_ARCH="${CT_ARCH}" + + # The system part of the tuple default value is OK. + + # The endianness option default value is OK. +} diff -r 9fc09fd403e7 -r f00eb97ff649 arch/mips/functions --- a/arch/mips/functions Fri Sep 14 21:13:04 2007 +0000 +++ b/arch/mips/functions Fri Sep 14 21:17:59 2007 +0000 @@ -0,0 +1,10 @@ +# Compute IA-64-specific values + +CT_DoArchValues() { + # The architecture part of the tuple: + CT_TARGET_ARCH="${CT_ARCH}${target_endian_el}" + + # The system part of the tuple default value is OK. + + # The endianness option default value is OK. +} diff -r 9fc09fd403e7 -r f00eb97ff649 arch/x86/functions --- a/arch/x86/functions Fri Sep 14 21:13:04 2007 +0000 +++ b/arch/x86/functions Fri Sep 14 21:17:59 2007 +0000 @@ -0,0 +1,23 @@ +# Compute x86-specific values + +# This one really need a little love! :-( + +CT_DoArchValues() { + # The architecture part of the tuple: + arch="${CT_ARCH_ARCH}" + [ -z "${arch}" ] && arch="${CT_ARCH_TUNE}" + case "${arch}" in + nocona|athlon*64|k8|athlon-fx|opteron) + CT_DoError "Architecture is x86 (32-bit) but selected processor is \"${arch}\" (64-bit)";; + "") CT_TARGET_ARCH=i386;; + i386|i486|i586|i686) CT_TARGET_ARCH="${arch}";; + winchip*) CT_TARGET_ARCH=i486;; + pentium|pentium-mmx|c3*) CT_TARGET_ARCH=i586;; + pentiumpro|pentium*|athlon*) CT_TARGET_ARCH=i686;; + *) CT_TARGET_ARCH=i586;; + esac + + # The system part of the tuple default value is OK. + + # The endianness option default value is OK. +} diff -r 9fc09fd403e7 -r f00eb97ff649 arch/x86_64/functions --- a/arch/x86_64/functions Fri Sep 14 21:13:04 2007 +0000 +++ b/arch/x86_64/functions Fri Sep 14 21:17:59 2007 +0000 @@ -0,0 +1,10 @@ +# Compute x86_64-specific values + +CT_DoArchValues() { + # The architecture part of the tuple: + CT_TARGET_ARCH="${CT_ARCH}" + + # The system part of the tuple default value is OK. + + # The endianness option default value is OK. +} diff -r 9fc09fd403e7 -r f00eb97ff649 docs/overview.txt --- a/docs/overview.txt Fri Sep 14 21:13:04 2007 +0000 +++ b/docs/overview.txt Fri Sep 14 21:17:59 2007 +0000 @@ -485,23 +485,42 @@ follow the API defined below. Eg.: arch/arm/functions The "functions" file API: - > the function "CT_DoBuildTargetTuple" + > the function "CT_DoArchValues" + parameters: none + environment: - all variables from the ".config" file, - the two variables "target_endian_eb" and "target_endian_el" which are - the endiannes suffixes + the endianness suffixes + return value: 0 upon success, !0 upon failure + provides: - - the target tuple stored in the variable CT_TARGET_ARCH - - > the environment variable CT_ARCH_ENDIAN_OPT - + contains: - - the value of the CFLAGS values for selecting the endiannes (eg.: -ml - for a Super-H little endian, -mbig-endian for an ARM big endian). - - empty if the architecture can not set the endianness (eg x86 and - x86_64). - + - the environment variable CT_TARGET_ARCH + - mandatory + - contains: + the architecture part of the target tuple. + Eg.: "armeb" for big endian ARM + "i386" for an i386 + + provides: + - the environment variable CT_TARGET_ARCH + - optional + - contain: + the sytem part of the target tuple. + Eg.: "gnu" for glibc on most architectures + "gnueabi" for glibc on an ARM EABI + - defaults to: + - for glibc-based toolchain: "gnu" + - for uClibc-based toolchain: "uclibc" + + provides: + - the environment variable CT_ARCH_ENDIAN_OPT + - optional + - contains: + the compiler option to set the endianness. + Eg.: "-ml" for a Super-H little endian + "-mbig-endian" for an ARM big endian + /empty/ for x86 and x86_64 + - defaults to: + - for bi-endian big endian architectures: "-mbig-endian" + - for bi-endian little endian architectures: "-mlittle-endian" + - for single-endian architectures: /empty/ Build scripts | --------------* diff -r 9fc09fd403e7 -r f00eb97ff649 scripts/build/libc_glibc.sh --- a/scripts/build/libc_glibc.sh Fri Sep 14 21:13:04 2007 +0000 +++ b/scripts/build/libc_glibc.sh Fri Sep 14 21:17:59 2007 +0000 @@ -230,14 +230,7 @@ else extra_cc_args="${CT_CFLAGS_FOR_HOST}" fi - case "${CT_LIBC_EXTRA_CC_ARGS}" in - *-mbig-endian*) ;; - *-mlittle-endian*) ;; - *) case "${CT_ARCH_BE},${CT_ARCH_LE}" in - y,) extra_cc_args="${extra_cc_args} -mbig-endian";; - ,y) extra_cc_args="${extra_cc_args} -mlittle-endian";; - esac;; - esac + extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}" cross_cc=`CT_Which "${CT_TARGET}-gcc"` CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\"" @@ -340,10 +333,7 @@ else extra_cc_args="${CT_CFLAGS_FOR_HOST}" fi - case "${CT_ARCH_BE},${CT_ARCH_LE}" in - y,) extra_cc_args="${extra_cc_args} -mbig-endian";; - ,y) extra_cc_args="${extra_cc_args} -mlittle-endian";; - esac + extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}" cross_cc=`CT_Which "${CT_TARGET}-gcc"` CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\"" diff -r 9fc09fd403e7 -r f00eb97ff649 scripts/functions --- a/scripts/functions Fri Sep 14 21:13:04 2007 +0000 +++ b/scripts/functions Fri Sep 14 21:17:59 2007 +0000 @@ -487,42 +487,32 @@ # tuple. It is needed both by the normal build sequence, as well as the # sample saving sequence. CT_DoBuildTargetTuple() { + # Set the endianness suffix, and the default endianness gcc option case "${CT_ARCH_BE},${CT_ARCH_LE}" in - y,) target_endian_eb=eb; target_endian_el=;; - ,y) target_endian_eb=; target_endian_el=el;; + y,) target_endian_eb=eb + target_endian_el= + CT_ARCH_ENDIAN_OPT="-mbig-endian" + ;; + ,y) target_endian_eb= + target_endian_el=el + CT_ARCH_ENDIAN_OPT="-mlittle-endian" + ;; esac - case "${CT_ARCH}" in - arm) CT_TARGET="${CT_ARCH}${target_endian_eb}";; - ia64) CT_TARGET="${CT_ARCH}";; - mips) CT_TARGET="${CT_ARCH}${target_endian_el}";; - x86*) # Much love for this one :-( - arch="${CT_ARCH_ARCH}" - [ -z "${arch}" ] && arch="${CT_ARCH_TUNE}" - case "${CT_ARCH}" in - x86_64) CT_TARGET=x86_64;; - *) case "${arch}" in - "") CT_TARGET=i386;; - i386|i486|i586|i686) CT_TARGET="${arch}";; - winchip*) CT_TARGET=i486;; - pentium|pentium-mmx|c3*) CT_TARGET=i586;; - nocona|athlon*64|k8|athlon-fx|opteron) CT_TARGET=x86_64;; - pentiumpro|pentium*|athlon*) CT_TARGET=i686;; - *) CT_TARGET=i586;; - esac;; - esac;; + + # Set defaults for the system part of the tuple. Can be overriden + # by architecture-specific values. + case "${CT_LIBC}" in + glibc) CT_TARGET_SYS=gnu;; + uClibc) CT_TARGET_SYS=uclibc;; esac - case "${CT_TARGET_VENDOR}" in - "") CT_TARGET="${CT_TARGET}-unknown";; - *) CT_TARGET="${CT_TARGET}-${CT_TARGET_VENDOR}";; + + # Call the architecture specific settings + CT_DoArchValues + + case "${CT_KERNEL}" in + linux*) CT_TARGET_KERNEL=linux;; esac - case "${CT_KERNEL}" in - linux*) CT_TARGET="${CT_TARGET}-linux";; - esac - case "${CT_LIBC}" in - glibc) CT_TARGET="${CT_TARGET}-gnu";; - uClibc) CT_TARGET="${CT_TARGET}-uclibc";; - esac - CT_TARGET=`CT_DoConfigSub "${CT_TARGET}"` + CT_TARGET=`CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}-${CT_TARGET_SYS}"` } # This function does pause the build until the user strikes "Return"