From d978290f39196e7c2c72a154f32681386b4e27b8 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Wed, 26 Feb 2020 08:49:59 -0800 Subject: Set --with-cpu-{32,64} for multilib builds GLIBC 2.31 needs --with-cpu=ultrasparc for both 32/64-bits now, and --with-cpu only sets the CPU model for the "primary" bitness. Signed-off-by: Alexey Neyman diff --git a/config/arch/powerpc.in b/config/arch/powerpc.in index 40d88b9..83f0f77 100644 --- a/config/arch/powerpc.in +++ b/config/arch/powerpc.in @@ -11,6 +11,7 @@ ## select ARCH_SUPPORTS_WITH_CPU ## select ARCH_SUPPORTS_WITH_TUNE ## select ARCH_SUPPORTS_WITH_FLOAT +## select ARCH_SUPPORTS_WITH_32_64 ## ## help The PowerPC architecture, as defined by: ## help http://www.ibm.com/developerworks/eserver/articles/archguide.html diff --git a/config/arch/sparc.in b/config/arch/sparc.in index 1b4abcc..fe46eaa 100644 --- a/config/arch/sparc.in +++ b/config/arch/sparc.in @@ -10,6 +10,7 @@ ## select ARCH_SUPPORTS_WITH_CPU ## select ARCH_SUPPORTS_WITH_TUNE ## select ARCH_SUPPORTS_WITH_FLOAT +## select ARCH_SUPPORTS_WITH_32_64 if GCC_6_or_later ## ## help The SUN SPARC architecture, as defined by: ## help 32 bit: http://www.sparc.org/standards/V8.pdf diff --git a/config/arch/x86.in b/config/arch/x86.in index ab89ccd..ec16655 100644 --- a/config/arch/x86.in +++ b/config/arch/x86.in @@ -8,6 +8,7 @@ ## select ARCH_SUPPORTS_WITH_ARCH ## select ARCH_SUPPORTS_WITH_CPU ## select ARCH_SUPPORTS_WITH_TUNE +## select ARCH_SUPPORTS_WITH_32_64 ## ## help The x86 architecture, as defined by: ## help 32-bit (ia32) : http://www.intel.com/ diff --git a/config/target.in b/config/target.in index 8549c5b..995457a 100644 --- a/config/target.in +++ b/config/target.in @@ -236,6 +236,11 @@ config ARCH_64 endchoice +# Whether this architecture supports passing --with-{cpu,arch,tune}-{32,64}= +# to GCC configure. +config ARCH_SUPPORTS_WITH_32_64 + bool + #-------------------------------------- comment "Target optimisations" diff --git a/scripts/build/arch/sparc.sh b/scripts/build/arch/sparc.sh index 7433c4d..484687d 100644 --- a/scripts/build/arch/sparc.sh +++ b/scripts/build/arch/sparc.sh @@ -14,6 +14,10 @@ CT_DoArchTupleValues() { if [ "${CT_KERNEL}" = "linux" -a "${CT_ARCH_64}" = "y" -a -z "${CT_ARCH_CPU}" ]; then CT_DoLog WARN "Setting CPU to UltraSPARC-I for sparc64-linux. Set CT_ARCH_CPU if a different CPU is desired." CT_ARCH_WITH_CPU="--with-cpu=ultrasparc" + if [ -n "${CT_ARCH_SUPPORTS_WITH_32_64}" -a -n "${CT_MULTILIB}" ]; then + CT_ARCH_WITH_CPU_32="--with-cpu-32=ultrasparc" + CT_ARCH_WITH_CPU_64="--with-cpu-64=ultrasparc" + fi fi } diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 60f259d..3d4db35 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -351,7 +351,7 @@ do_gcc_core_backend() { ;; esac - for tmp in ARCH ABI CPU TUNE FPU FLOAT ENDIAN; do + for tmp in ARCH ABI CPU CPU_32 CPU_64 TUNE FPU FLOAT ENDIAN; do eval tmp="\${CT_ARCH_WITH_${tmp}}" if [ -n "${tmp}" ]; then extra_config+=("${tmp}") @@ -905,7 +905,7 @@ do_gcc_backend() { # Enable selected languages extra_config+=("--enable-languages=${lang_list}") - for tmp in ARCH ABI CPU TUNE FPU FLOAT; do + for tmp in ARCH ARCH_32 ARCH_64 ABI CPU CPU_32 CPU_64 TUNE TUNE_32 TUNE_64 FPU FLOAT; do eval tmp="\${CT_ARCH_WITH_${tmp}}" if [ -n "${tmp}" ]; then extra_config+=("${tmp}") diff --git a/scripts/functions b/scripts/functions index 1b3b7dc..2227de7 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1040,7 +1040,8 @@ CT_GetFile() # TBD these should not be needed if config.sub/guess is a package # Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR. # Those from CT_TOP_DIR, if they exist, will be be more recent than those from CT_LIB_DIR. -CT_DoConfigGuess() { +CT_DoConfigGuess() +{ if [ -r "${CT_TOP_DIR}/scripts/config.guess" ]; then "${CT_CONFIG_SHELL}" "${CT_TOP_DIR}/scripts/config.guess" else @@ -1048,7 +1049,8 @@ CT_DoConfigGuess() { fi } -CT_DoConfigSub() { +CT_DoConfigSub() +{ if [ -r "${CT_TOP_DIR}/scripts/config.sub" ]; then "${CT_CONFIG_SHELL}" "${CT_TOP_DIR}/scripts/config.sub" "$@" else @@ -1060,7 +1062,8 @@ CT_DoConfigSub() { # environment for the next step(s). When this is needed, it can do so by # invoking this function. # Usage: CT_EnvModify [export] VAR VALUE -CT_EnvModify() { +CT_EnvModify() +{ local e if [ "$1" = "export" ]; then shift @@ -1075,7 +1078,10 @@ CT_EnvModify() { # In fact this function takes the environment variables to build the target # tuple. It is needed both by the normal build sequence, as well as the # sample saving sequence. -CT_DoBuildTargetTuple() { +CT_DoBuildTargetTuple() +{ + local tmp + # Set the endianness suffix, and the default endianness gcc option target_endian_eb= target_endian_be= @@ -1137,13 +1143,29 @@ CT_DoBuildTargetTuple() { esac # 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 CT_ARCH_FLOAT_CFLAG - unset 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_ARCH_WITH_ENDIAN - [ "${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="-mtune=${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}"; } + for tmp in ARCH ABI CPU TUNE FPU FLOAT ENDIAN; do + eval "unset CT_ARCH_${tmp}_CFLAG CT_ARCH_WITH_${tmp} CT_ARCH_WITH_${tmp}_32 CT_ARCH_WITH_${tmp}_64" + done + + [ -n "${CT_ARCH_ABI}" ] && { CT_ARCH_ABI_CFLAG="-mabi=${CT_ARCH_ABI}"; CT_ARCH_WITH_ABI="--with-abi=${CT_ARCH_ABI}"; } + [ -n "${CT_ARCH_FPU}" ] && { CT_ARCH_FPU_CFLAG="-mfpu=${CT_ARCH_FPU}"; CT_ARCH_WITH_FPU="--with-fpu=${CT_ARCH_FPU}"; } + + # The options below have distinct variants for multilib-enabled toolchain. + # At this time, we just always have them equal to the "main" setting; it + # seems that most example configurations are built for a specific CPU. + # If there's demand for it, we can turn them into separate knobs in + # Kconfig later. + for tmp in ARCH CPU TUNE; do + eval "val=\${CT_ARCH_${tmp}}" + if [ -n "${val}" ]; then + eval "CT_ARCH_${tmp}_CFLAG=-m${tmp,,}=${val}" + eval "CT_ARCH_WITH_${tmp}=--with-${tmp,,}=${val}" + if [ -n "${CT_ARCH_SUPPORTS_WITH_32_64}" -a -n "${CT_MULTILIB}" ]; then + eval "CT_ARCH_WITH_${tmp}_32=--with-${tmp,,}-32=${val}" + eval "CT_ARCH_WITH_${tmp}_64=--with-${tmp,,}-64=${val}" + fi + fi + done case "${CT_ARCH_FLOAT}" in hard) -- cgit v0.10.2-6-g49f6