Further improve the architecture-specific framework.

Apply this framework into building of glibc and gcc.

(Whoo! 500th commit! Yeah!)
This commit is contained in:
Yann E. MORIN" 2007-09-15 21:44:18 +00:00
parent 8ed77399de
commit 3f09a4d4c6
5 changed files with 77 additions and 64 deletions

View File

@ -493,24 +493,15 @@ The "functions" file API:
the endianness suffixes
+ return value: 0 upon success, !0 upon failure
+ provides:
- the environment variable CT_KERNEL_ARCH
- optional
- contains:
the architecture name as understandable by the Linux kernel build
system.
Eg.: "arm" for an ARM
"powerpc" for a PowerPC
"i386" for an x86
+ provides:
- the environment variable CT_TARGET_ARCH
- mandatory
- the environment variable CT_TARGET_ARCH
- contains:
the architecture part of the target tuple.
Eg.: "armeb" for big endian ARM
"i386" for an i386
+ provides:
- the environment variable CT_TARGET_SYS
- optional
- the environment variable CT_TARGET_SYS
- contain:
the sytem part of the target tuple.
Eg.: "gnu" for glibc on most architectures
@ -519,17 +510,53 @@ The "functions" file API:
- for glibc-based toolchain: "gnu"
- for uClibc-based toolchain: "uclibc"
+ provides:
- the environment variable CT_ARCH_ENDIAN_OPT
- optional
- the environment variable CT_KERNEL_ARCH
- 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
the architecture name as understandable by the Linux kernel build
system.
Eg.: "arm" for an ARM
"powerpc" for a PowerPC
"i386" for an x86
- defaults to:
- for bi-endian big endian architectures: "-mbig-endian"
- for bi-endian little endian architectures: "-mlittle-endian"
- for single-endian architectures: /empty/
${CT_ARCH}
+ provides:
- optional
- the environment variables to configure the cross-gcc
- CT_ARCH_WITH_ARCH
- CT_ARCH_WITH_ABI
- CT_ARCH_WITH_CPU
- CT_ARCH_WITH_TUNE
- CT_ARCH_WITH_FPU
- CT_ARCH_WITH_FLOAT
- contain (defaults):
- CT_ARCH_WITH_ARCH : the gcc ./configure switch to select architecture level ( "--with-arch=${CT_ARCH_ARCH}" )
- CT_ARCH_WITH_ABI : the gcc ./configure switch to select ABI level ( "--with-abi=${CT_ARCH_ARCH}" )
- CT_ARCH_WITH_CPU : the gcc ./configure switch to select CPU instruction set ( "--with-cpu=${CT_ARCH_ARCH}" )
- CT_ARCH_WITH_TUNE : the gcc ./configure switch to select scheduling ( "--with-tune=${CT_ARCH_ARCH}" )
- CT_ARCH_WITH_FPU : the gcc ./configure switch to select FPU type ( "--with-fpu=${CT_ARCH_ARCH}" )
- CT_ARCH_WITH_FLOAT : the gcc ./configure switch to select floating point arithmetics ( "--with-float=soft" or /empty/ )
+ provides:
- optional
- the environment variables to pass to the cross-gcc to build target binaries
- CT_ARCH_ARCH_CFLAG
- CT_ARCH_ABI_CFLAG
- CT_ARCH_CPU_CFLAG
- CT_ARCH_TUNE_CFLAG
- CT_ARCH_FPU_CFLAG
- CT_ARCH_FLOAT_CFLAG
- CT_ARCH_ENDIAN_CFLAG
- contain (defaults):
- CT_ARCH_ARCH_CFLAG : the gcc switch to select architecture level ( "-march=${CT_ARCH_ARCH}" )
- CT_ARCH_ABI_CFLAG : the gcc switch to select ABI level ( "-mabi=${CT_ARCH_AABI}" )
- CT_ARCH_CPU_CFLAG : the gcc switch to select CPU instruction set ( "-mcpu=${CT_ARCH_CPU}" )
- CT_ARCH_TUNE_CFLAG : the gcc switch to select scheduling ( "-mtune=${CT_ARCH_TUNE}" )
- CT_ARCH_FPU_CFLAG : the gcc switch to select FPU type ( "-mfpu=${CT_ARCH_FPU}" )
- CT_ARCH_FLOAT_CFLAG : the gcc switch to choose floating point arithmetics ( "-msoft-float" or /empty/ )
- CT_ARCH_ENDIAN_CFLAG : the gcc switch to choose big or little endian ( "-mbig-endian" or "-mlittle-endian" )
- default to:
see above.
Build scripts |
--------------*

View File

@ -65,13 +65,7 @@ do_cc_core_static() {
CT_DoLog EXTRA "Configuring static core C compiler"
extra_config=""
[ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft"
[ -n "${CT_ARCH_ABI}" ] && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}"
[ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
[ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
[ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
[ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
extra_config="${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}"
[ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
@ -123,13 +117,7 @@ do_cc_core_shared() {
CT_DoLog EXTRA "Configuring shared core C compiler"
extra_config=""
[ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft"
[ -n "${CT_ARCH_ABI}" ] && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}"
[ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
[ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
[ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
[ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
extra_config="${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}"
[ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
@ -228,18 +216,8 @@ do_cc() {
lang_opt=`echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;'`
extra_config="--enable-languages=${lang_opt}"
[ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft"
extra_config="${extra_config} ${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}"
[ "${CT_SHARED_LIBS}" = "y" ] || extra_config="${extra_config} --disable-shared"
[ -n "${CT_ARCH_ABI}" ] && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}"
[ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
[ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
[ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
[ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
if [ "${CT_TARGET_MULTILIB}" = "y" ]; then
extra_config="${extra_config} --enable-multilib"
else
extra_config="${extra_config} --disable-multilib"
fi
[ "${CT_CC_CXA_ATEXIT}" == "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
@ -268,7 +246,6 @@ do_cc() {
make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog ALL
fi
# Idea from <cort.dougan at gmail.com>:
# Fix lib/lib64 confusion for GCC 3.3.3 on PowerPC64 and x86_64.
# GCC 3.4.0 and up don't suffer from this confusion, and don't need this

View File

@ -155,7 +155,7 @@ do_libc_headers() {
case "${CT_THREADS}" in
nptl)
# NOTE: for some archs, the pathes are different, but they are not
# supported by ct-ng right now. See original crosstool when they are.
# supported by crosstool-NG right now. See original crosstool when they are.
pthread_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/${CT_THREADS}/sysdeps/pthread/pthread.h"
pthreadtypes_h="${CT_SRC_DIR}/${CT_LIBC_FILE}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
if [ ! -f "${pthreadtypes_h}" ]; then
@ -206,13 +206,9 @@ do_libc_start_files() {
y) extra_config="${extra_config} --enable-shared";;
*) extra_config="${extra_config} --disable-shared";;
esac
case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
*--with-fp*) ;;
*--without-fp*) ;;
*) case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
y,) extra_config="${extra_config} --with-fp";;
,y) extra_config="${extra_config} --without-fp";;
esac;;
esac
# Obviously, we want threads, as we come here only for NPTL
extra_config="${extra_config} --with-__thread"
@ -238,8 +234,9 @@ do_libc_start_files() {
CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\""
CT_DoLog DEBUG "Extra CC args passed : \"${extra_cc_args}\""
# sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2
# note: this is awkward, doesn't work well if you need more than one line in configparms
# Super-H really needs to set configparms as of gcc-3.4/glibc-2.3.2
# note: this is awkward, doesn't work well if you need more than one
# line in configparms
echo ${CT_LIBC_GLIBC_CONFIGPARMS} > configparms
echo "libc_cv_forced_unwind=yes" > config.cache

View File

@ -301,13 +301,6 @@ if [ -z "${CT_RESTART}" ]; then
fi |CT_DoLog DEBUG
done
# Build up the TARGET_CFLAGS from user-provided options
# Override with user-specified CFLAGS
[ -n "${CT_ARCH_CPU}" ] && CT_TARGET_CFLAGS="-mcpu=${CT_ARCH_CPU} ${CT_TARGET_CFLAGS}"
[ -n "${CT_ARCH_TUNE}" ] && CT_TARGET_CFLAGS="-mtune=${CT_ARCH_TUNE} ${CT_TARGET_CFLAGS}"
[ -n "${CT_ARCH_ARCH}" ] && CT_TARGET_CFLAGS="-march=${CT_ARCH_ARCH} ${CT_TARGET_CFLAGS}"
[ -n "${CT_ARCH_FPU}" ] && CT_TARGET_CFLAGS="-mfpu=${CT_ARCH_FPU} ${CT_TARGET_CFLAGS}"
# Help gcc
CT_CFLAGS_FOR_HOST=
[ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST="${CT_CFLAGS_FOR_HOST} -pipe"

View File

@ -491,11 +491,11 @@ CT_DoBuildTargetTuple() {
case "${CT_ARCH_BE},${CT_ARCH_LE}" in
y,) target_endian_eb=eb
target_endian_el=
CT_ARCH_ENDIAN_OPT="-mbig-endian"
CT_ARCH_ENDIAN_CFLAG="-mbig-endian"
;;
,y) target_endian_eb=
target_endian_el=el
CT_ARCH_ENDIAN_OPT="-mlittle-endian"
CT_ARCH_ENDIAN_CFLAG="-mlittle-endian"
;;
esac
@ -509,13 +509,32 @@ CT_DoBuildTargetTuple() {
# Transform the ARCH into a kernel-understandable ARCH
CT_KERNEL_ARCH="${CT_ARCH}"
# Set the default values for ARCH, ABI, CPU, TUNE, FPU and FLOAT
unset CT_ARCH_ARCH_CFLAG CT_ARCH_ABI_CFLAG CT_ARCH_CPU_CFLAG CT_ARCH_TUNE_CFLAG CT_ARCH_FPU_CFLAG
unset CT_ARCH_WITH_ARCH CT_ARCH_WITH_ABI CT_ARCH_WITH_CPU CT_ARCH_WITH_TUNE CT_ARCH_WITH_FPU
[ "${CT_ARCH_ARCH}" ] && { CT_ARCH_ARCH_CFLAG="-march=${CT_ARCH_ARCH}"; CT_ARCH_WITH_ARCH="--with-arch=${CT_ARCH_ARCH}"; }
[ "${CT_ARCH_ABI}" ] && { CT_ARCH_ABI_CFLAG="-mabi=${CT_ARCH_ABI}"; CT_ARCH_WITH_ABI="--with-abi=${CT_ARCH_ABI}"; }
[ "${CT_ARCH_CPU}" ] && { CT_ARCH_CPU_CFLAG="-mcpu=${CT_ARCH_CPU}"; CT_ARCH_WITH_CPU="--with-cpu=${CT_ARCH_CPU}"; }
[ "${CT_ARCH_TUNE}" ] && { CT_ARCH_TUNE_CFLAG="-march=${CT_ARCH_TUNE}"; CT_ARCH_WITH_TUNE="--with-tune=${CT_ARCH_TUNE}"; }
[ "${CT_ARCH_FPU}" ] && { CT_ARCH_FPU_CFLAG="-mfpu=${CT_ARCH_FPU}"; CT_ARCH_WITH_FPU="--with-fpu=${CT_ARCH_FPU}"; }
[ "${CT_ARCH_FLOAT_SW}" ] && { CT_ARCH_FPU_CFLAG="-msoft-float"; CT_ARCH_WITH_FLOAT="--with-float=soft"; }
# Call the architecture specific settings
CT_DoArchValues
# Finish the target tuple construction
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}"`
# Prepare the target CFLAGS
CT_TARGET_CFLAGS="${CT_TARGET_CFLAGS} ${CT_ARCH_ARCH_CFLAGS}"
CT_TARGET_CFLAGS="${CT_TARGET_CFLAGS} ${CT_ARCH_ABI_CFLAGS}"
CT_TARGET_CFLAGS="${CT_TARGET_CFLAGS} ${CT_ARCH_CPU_CFLAGS}"
CT_TARGET_CFLAGS="${CT_TARGET_CFLAGS} ${CT_ARCH_TUNE_CFLAGS}"
CT_TARGET_CFLAGS="${CT_TARGET_CFLAGS} ${CT_ARCH_FPU_CFLAGS}"
CT_TARGET_CFLAGS="${CT_TARGET_CFLAGS} ${CT_ARCH_FLOAT_CFLAGS}"
}
# This function does pause the build until the user strikes "Return"