From 60b0bb1bab1dca165c5d93c55f02b5da27719274 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Fri, 14 Sep 2007 21:17:59 +0000 Subject: Migrate all supported architectures to use the architecture-specific framework. diff --git a/arch/arm/functions b/arch/arm/functions index e69de29..ada2836 100644 --- a/arch/arm/functions +++ b/arch/arm/functions @@ -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 --git a/arch/ia64/functions b/arch/ia64/functions index e69de29..45a3d5b 100644 --- a/arch/ia64/functions +++ b/arch/ia64/functions @@ -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 --git a/arch/mips/functions b/arch/mips/functions index e69de29..e8bf09f 100644 --- a/arch/mips/functions +++ b/arch/mips/functions @@ -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 --git a/arch/x86/functions b/arch/x86/functions index e69de29..039c079 100644 --- a/arch/x86/functions +++ b/arch/x86/functions @@ -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 --git a/arch/x86_64/functions b/arch/x86_64/functions index e69de29..68610d8 100644 --- a/arch/x86_64/functions +++ b/arch/x86_64/functions @@ -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 --git a/docs/overview.txt b/docs/overview.txt index 34cb756..ced069b 100644 --- a/docs/overview.txt +++ b/docs/overview.txt @@ -485,23 +485,42 @@ An architecture is defined by: 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 --git a/scripts/build/libc_glibc.sh b/scripts/build/libc_glibc.sh index 37d0861..0fcb438 100644 --- a/scripts/build/libc_glibc.sh +++ b/scripts/build/libc_glibc.sh @@ -230,14 +230,7 @@ do_libc_start_files() { 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 @@ do_libc() { 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 --git a/scripts/functions b/scripts/functions index c6692a3..e5a338a 100644 --- a/scripts/functions +++ b/scripts/functions @@ -487,42 +487,32 @@ CT_DoConfigSub() { # 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;; - 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;; + 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_TARGET_VENDOR}" in - "") CT_TARGET="${CT_TARGET}-unknown";; - *) CT_TARGET="${CT_TARGET}-${CT_TARGET_VENDOR}";; + + # 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 + + # Call the architecture specific settings + CT_DoArchValues + 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";; + linux*) CT_TARGET_KERNEL=linux;; 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" -- cgit v0.10.2-6-g49f6