Migrate all supported architectures to use the architecture-specific framework.

This commit is contained in:
Yann E. MORIN" 2007-09-14 21:17:59 +00:00
parent c0f4b573f8
commit 60b0bb1bab
8 changed files with 117 additions and 55 deletions

@ -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.
}

@ -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.
}

@ -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.
}

@ -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.
}

@ -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.
}

@ -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 |
--------------*

@ -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}\""

@ -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;;
esac
case "${CT_TARGET_VENDOR}" in
"") CT_TARGET="${CT_TARGET}-unknown";;
*) CT_TARGET="${CT_TARGET}-${CT_TARGET_VENDOR}";;
esac
case "${CT_KERNEL}" in
linux*) CT_TARGET="${CT_TARGET}-linux";;
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
# Set defaults for the system part of the tuple. Can be overriden
# by architecture-specific values.
case "${CT_LIBC}" in
glibc) CT_TARGET="${CT_TARGET}-gnu";;
uClibc) CT_TARGET="${CT_TARGET}-uclibc";;
glibc) CT_TARGET_SYS=gnu;;
uClibc) CT_TARGET_SYS=uclibc;;
esac
CT_TARGET=`CT_DoConfigSub "${CT_TARGET}"`
# Call the architecture specific settings
CT_DoArchValues
case "${CT_KERNEL}" in
linux*) CT_TARGET_KERNEL=linux;;
esac
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"