mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-02-20 09:06:19 +00:00
Super-H multilib toolchain fixes
1. On SuperH, configuring GCC with explicit variant of the CPU (like "sh4") limits the default set of multilibs to just that CPU and requires --with-multilib-list to change. Allow for "unspecified" variant, so that we can defer to GCC to determine the list. 2. Support toolchains with both endiannesses at the same time. 3. Add a SuperH/newlib sample 4. Add more flags processing for uClibc Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
1da3cc59df
commit
413f5f6100
@ -5,7 +5,7 @@
|
||||
## select ARCH_DEFAULT_32
|
||||
## select ARCH_SUPPORTS_BOTH_MMU
|
||||
## select ARCH_DEFAULT_HAS_MMU
|
||||
## select ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
## select ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
## select ARCH_DEFAULT_LE
|
||||
## select ARCH_SUPPORTS_WITH_ARCH
|
||||
## select ARCH_SUPPORTS_WITH_CPU
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
## depends on EXPERIMENTAL
|
||||
##
|
||||
## select ARCH_SUPPORT_ARCH
|
||||
## select ARCH_SUPPORTS_WITH_CPU
|
||||
## select ARCH_FLOAT_SW
|
||||
## select ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
## select ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
## select ARCH_DEFAULT_BE
|
||||
## select ARCH_SUPPORTS_BOTH_MMU
|
||||
## select ARCH_DEFAULT_HAS_MMU
|
||||
|
@ -4,7 +4,7 @@
|
||||
## select ARCH_SUPPORTS_64
|
||||
## select ARCH_DEFAULT_32
|
||||
## select ARCH_USE_MMU
|
||||
## select ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
## select ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
## select ARCH_DEFAULT_BE
|
||||
## select ARCH_SUPPORTS_WITH_ARCH
|
||||
## select ARCH_SUPPORTS_WITH_TUNE
|
||||
|
@ -3,7 +3,7 @@
|
||||
## select ARCH_SUPPORTS_32
|
||||
## select ARCH_SUPPORTS_64
|
||||
## select ARCH_DEFAULT_32
|
||||
## select ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
## select ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
## select ARCH_DEFAULT_BE
|
||||
## select ARCH_USE_MMU
|
||||
## select ARCH_SUPPORTS_WITH_ABI
|
||||
|
@ -3,9 +3,11 @@
|
||||
## select ARCH_SUPPORTS_32
|
||||
## select ARCH_DEFAULT_32
|
||||
## select ARCH_USE_MMU
|
||||
## select ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
## select ARCH_DEFAULT_LE
|
||||
## select ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
## select ARCH_DEFAULT_LE_BE
|
||||
## select ARCH_REQUIRES_MULTILIB
|
||||
## select ARCH_SUPPORTS_WITH_ENDIAN
|
||||
## select ARCH_SUPPORTS_WITH_CPU
|
||||
##
|
||||
## help The Super-H architecture, as defined by:
|
||||
## help http://www.renesas.com/fmwk.jsp?cnt=superh_family_landing.jsp&fp=/products/mpumcu/superh_family/
|
||||
@ -14,10 +16,41 @@ choice
|
||||
bool
|
||||
prompt "Variant"
|
||||
|
||||
# GCC supports both endiannesses even if a specific CPU is selected (so long
|
||||
# as that CPU can be both BE/LE), but the binutils (or specifically, ld)
|
||||
# configures for both endiannesses only if sh-*-linux target is selected.
|
||||
config ARCH_SH_SH
|
||||
bool
|
||||
prompt "unspecified"
|
||||
select ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
help
|
||||
If left unspecified, GCC will determine the set of multilibs to compile automatically
|
||||
based on selected endianness, FPU mode and OS.
|
||||
|
||||
config ARCH_SH_SH1
|
||||
bool
|
||||
prompt "sh1"
|
||||
|
||||
config ARCH_SH_SH2
|
||||
bool
|
||||
prompt "sh2"
|
||||
|
||||
config ARCH_SH_SH2E
|
||||
bool
|
||||
prompt "sh2e"
|
||||
|
||||
config ARCH_SH_SH2A
|
||||
bool
|
||||
prompt "sh2a"
|
||||
|
||||
config ARCH_SH_SH3
|
||||
bool
|
||||
prompt "sh3"
|
||||
|
||||
config ARCH_SH_SH3E
|
||||
bool
|
||||
prompt "sh3e"
|
||||
|
||||
config ARCH_SH_SH4
|
||||
bool
|
||||
prompt "sh4"
|
||||
@ -30,6 +63,12 @@ endchoice
|
||||
|
||||
config ARCH_SH_VARIANT
|
||||
string
|
||||
default "sh" if ARCH_SH_SH
|
||||
default "sh1" if ARCH_SH_SH1
|
||||
default "sh2" if ARCH_SH_SH2
|
||||
default "sh2e" if ARCH_SH_SH2E
|
||||
default "sh2a" if ARCH_SH_SH2A
|
||||
default "sh3" if ARCH_SH_SH3
|
||||
default "sh3e" if ARCH_SH_SH3E
|
||||
default "sh4" if ARCH_SH_SH4
|
||||
default "sh4a" if ARCH_SH_SH4A
|
||||
|
@ -1,7 +1,7 @@
|
||||
# xtensa specific configuration file
|
||||
|
||||
## select ARCH_SUPPORTS_32
|
||||
## select ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
## select ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
## select ARCH_DEFAULT_LE
|
||||
## select ARCH_SUPPORTS_BOTH_MMU
|
||||
## select ARCH_DEFAULT_HAS_MMU
|
||||
|
@ -93,8 +93,16 @@ config ARCH_USE_MMU
|
||||
have one (eg. ARM Cortex-A8).
|
||||
|
||||
#--------------------------------------
|
||||
config ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
bool
|
||||
help
|
||||
Architecture allows to select endianness at the time the toolchain is built.
|
||||
|
||||
config ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
bool
|
||||
select ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
help
|
||||
Toolchain supports both big/little endian.
|
||||
|
||||
config ARCH_DEFAULT_BE
|
||||
bool
|
||||
@ -102,12 +110,22 @@ config ARCH_DEFAULT_BE
|
||||
config ARCH_DEFAULT_LE
|
||||
bool
|
||||
|
||||
config ARCH_DEFAULT_BE_LE
|
||||
bool
|
||||
depends on ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
|
||||
config ARCH_DEFAULT_LE_BE
|
||||
bool
|
||||
depends on ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
|
||||
choice
|
||||
bool
|
||||
prompt "Endianness:"
|
||||
depends on ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
default ARCH_BE if ARCH_DEFAULT_BE
|
||||
default ARCH_LE if ARCH_DEFAULT_LE
|
||||
default ARCH_BE_LE if ARCH_DEFAULT_BE_LE
|
||||
default ARCH_LE_BE if ARCH_DEFAULT_LE_BE
|
||||
|
||||
config ARCH_BE
|
||||
bool
|
||||
@ -117,13 +135,23 @@ config ARCH_LE
|
||||
bool
|
||||
prompt "Little endian"
|
||||
|
||||
config ARCH_BE_LE
|
||||
bool
|
||||
prompt "Both, default big endian"
|
||||
|
||||
config ARCH_LE_BE
|
||||
bool
|
||||
prompt "Both, default little endian"
|
||||
|
||||
endchoice
|
||||
|
||||
config ARCH_ENDIAN
|
||||
string
|
||||
depends on ARCH_SUPPORTS_BOTH_ENDIAN
|
||||
default "big" if ARCH_BE
|
||||
default "little" if ARCH_LE
|
||||
depends on ARCH_SUPPORTS_EITHER_ENDIAN
|
||||
default "big" if ARCH_BE
|
||||
default "little" if ARCH_LE
|
||||
default "big,little" if ARCH_BE_LE
|
||||
default "little,big" if ARCH_LE_BE
|
||||
|
||||
#--------------------------------------
|
||||
config ARCH_SUPPORTS_8
|
||||
@ -208,6 +236,9 @@ config ARCH_SUPPORTS_WITH_FLOAT
|
||||
config ARCH_SUPPORTS_WITH_FPU
|
||||
bool
|
||||
|
||||
config ARCH_SUPPORTS_WITH_ENDIAN
|
||||
bool
|
||||
|
||||
config ARCH_SUPPORTS_SOFTFP
|
||||
bool
|
||||
|
||||
@ -396,7 +427,6 @@ config TARGET_LDFLAGS
|
||||
|
||||
config ARCH_FLOAT
|
||||
string
|
||||
default "" if ! ARCH_SUPPORTS_WITH_FLOAT
|
||||
default "auto" if ARCH_FLOAT_AUTO
|
||||
default "hard" if ARCH_FLOAT_HW
|
||||
default "soft" if ARCH_FLOAT_SW
|
||||
|
4
samples/sh-unknown-elf/crosstool.config
Normal file
4
samples/sh-unknown-elf/crosstool.config
Normal file
@ -0,0 +1,4 @@
|
||||
CT_ARCH_SH=y
|
||||
CT_BINUTILS_PLUGINS=y
|
||||
CT_CC_LANG_CXX=y
|
||||
CT_GETTEXT=y
|
3
samples/sh-unknown-elf/reported.by
Normal file
3
samples/sh-unknown-elf/reported.by
Normal file
@ -0,0 +1,3 @@
|
||||
reporter_name="Alexey Neyman"
|
||||
reporter_url=""
|
||||
reporter_comment="Sample SuperH/baremetal configuration with all default multilibs."
|
@ -3,21 +3,6 @@
|
||||
CT_DoArchTupleValues () {
|
||||
# The architecture part of the tuple:
|
||||
CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX:-${target_endian_el}}"
|
||||
|
||||
# gcc ./configure flags
|
||||
CT_ARCH_WITH_ARCH=
|
||||
CT_ARCH_WITH_ABI=
|
||||
CT_ARCH_WITH_CPU=
|
||||
CT_ARCH_WITH_TUNE=
|
||||
CT_ARCH_WITH_FPU=
|
||||
CT_ARCH_WITH_FLOAT=
|
||||
|
||||
# CFLAGS
|
||||
case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
|
||||
y,) CT_ARCH_FLOAT_CFLAG="-mhard-float" ;;
|
||||
,y) CT_ARCH_FLOAT_CFLAG="-msoft-float" ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
CT_DoArchUClibcConfig() {
|
||||
|
@ -4,36 +4,29 @@ CT_DoArchTupleValues () {
|
||||
# The architecture part of the tuple:
|
||||
CT_TARGET_ARCH="${CT_ARCH_SH_VARIANT}${CT_ARCH_SUFFIX:-${target_endian_eb}}"
|
||||
|
||||
# gcc ./configure flags
|
||||
CT_ARCH_WITH_ARCH=
|
||||
CT_ARCH_WITH_ABI=
|
||||
CT_ARCH_WITH_CPU=
|
||||
CT_ARCH_WITH_TUNE=
|
||||
CT_ARCH_WITH_FPU=
|
||||
CT_ARCH_WITH_FLOAT=
|
||||
|
||||
# Endianness stuff
|
||||
# Endianness stuff (uses non-standard CFLAGS). If both are compiled, let the
|
||||
# compiler's default or multilib iterator be used.
|
||||
case "${CT_ARCH_ENDIAN}" in
|
||||
big) CT_ARCH_ENDIAN_CFLAG=-mb;;
|
||||
little) CT_ARCH_ENDIAN_CFLAG=-ml;;
|
||||
esac
|
||||
|
||||
# CFLAGS
|
||||
# Instead of -m{soft,hard}-float, uses CPU type
|
||||
CT_ARCH_FLOAT_CFLAG=
|
||||
case "${CT_ARCH_SH_VARIANT}" in
|
||||
sh3) CT_ARCH_ARCH_CFLAG=-m3;;
|
||||
sh4*)
|
||||
# softfp is not possible for SuperH, no need to test for it.
|
||||
case "${CT_ARCH_FLOAT}" in
|
||||
hard)
|
||||
CT_ARCH_ARCH_CFLAG="-m4${CT_ARCH_SH_VARIANT##sh?}"
|
||||
CT_ARCH_ARCH_CFLAG="-m4${CT_ARCH_SH_VARIANT##sh4}"
|
||||
;;
|
||||
soft)
|
||||
CT_ARCH_ARCH_CFLAG="-m4${CT_ARCH_SH_VARIANT##sh?}-nofpu"
|
||||
CT_ARCH_ARCH_CFLAG="-m4${CT_ARCH_SH_VARIANT##sh4}-nofpu"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
CT_ARCH_FLOAT_CFLAG=
|
||||
}
|
||||
|
||||
CT_DoArchMultilibList() {
|
||||
@ -81,6 +74,36 @@ CT_DoArchUClibcCflags() {
|
||||
|
||||
for f in ${cflags}; do
|
||||
case "${f}" in
|
||||
-ml)
|
||||
CT_KconfigDisableOption "ARCH_BIG_ENDIAN" "${dst}"
|
||||
CT_KconfigDisableOption "ARCH_WANTS_BIG_ENDIAN" "${dst}"
|
||||
CT_KconfigEnableOption "ARCH_LITTLE_ENDIAN" "${dst}"
|
||||
CT_KconfigEnableOption "ARCH_WANTS_LITTLE_ENDIAN" "${dst}"
|
||||
;;
|
||||
-mb)
|
||||
CT_KconfigEnableOption "ARCH_BIG_ENDIAN" "${dst}"
|
||||
CT_KconfigEnableOption "ARCH_WANTS_BIG_ENDIAN" "${dst}"
|
||||
CT_KconfigDisableOption "ARCH_LITTLE_ENDIAN" "${dst}"
|
||||
CT_KconfigDisableOption "ARCH_WANTS_LITTLE_ENDIAN" "${dst}"
|
||||
;;
|
||||
-m2|-m2a|-m2a-nofpu|-m3|-m4|-m4-nofpu|-m4a|-m4a-nofpu)
|
||||
CT_KconfigDisableOption "CONFIG_SH2" "${cfg}"
|
||||
CT_KconfigDisableOption "CONFIG_SH2A" "${cfg}"
|
||||
CT_KconfigDisableOption "CONFIG_SH3" "${cfg}"
|
||||
CT_KconfigDisableOption "CONFIG_SH4" "${cfg}"
|
||||
CT_KconfigDisableOption "CONFIG_SH4A" "${cfg}"
|
||||
CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${cfg}"
|
||||
case "${f}" in
|
||||
-m2)
|
||||
CT_KconfigEnableOption "CONFIG_SH2" "${cfg}"
|
||||
;;
|
||||
-m2a)
|
||||
CT_KconfigEnableOption "CONFIG_SH2A" "${cfg}"
|
||||
CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${cfg}"
|
||||
;;
|
||||
-m2a-nofpu)
|
||||
CT_KconfigEnableOption "CONFIG_SH2A" "${cfg}"
|
||||
;;
|
||||
-m3)
|
||||
CT_KconfigEnableOption "CONFIG_SH3" "${cfg}"
|
||||
;;
|
||||
@ -90,7 +113,6 @@ CT_DoArchUClibcCflags() {
|
||||
;;
|
||||
-m4-nofpu)
|
||||
CT_KconfigEnableOption "CONFIG_SH4" "${cfg}"
|
||||
CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${cfg}"
|
||||
;;
|
||||
-m4a)
|
||||
CT_KconfigEnableOption "CONFIG_SH4A" "${cfg}"
|
||||
@ -98,8 +120,9 @@ CT_DoArchUClibcCflags() {
|
||||
;;
|
||||
-m4a-nofpu)
|
||||
CT_KconfigEnableOption "CONFIG_SH4A" "${cfg}"
|
||||
CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${cfg}"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ do_gcc_core_backend() {
|
||||
CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include"
|
||||
fi
|
||||
|
||||
for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
|
||||
for tmp in ARCH ABI CPU TUNE FPU FLOAT ENDIAN; do
|
||||
eval tmp="\${CT_ARCH_WITH_${tmp}}"
|
||||
if [ -n "${tmp}" ]; then
|
||||
extra_config+=("${tmp}")
|
||||
|
@ -224,13 +224,13 @@ manage_uClibc_config() {
|
||||
CT_DoExecLog ALL cp "${src}" "${dst}"
|
||||
|
||||
case "${CT_ARCH_ENDIAN}" in
|
||||
big)
|
||||
big|big,little)
|
||||
CT_KconfigDisableOption "ARCH_LITTLE_ENDIAN" "${dst}"
|
||||
CT_KconfigDisableOption "ARCH_WANTS_LITTLE_ENDIAN" "${dst}"
|
||||
CT_KconfigEnableOption "ARCH_BIG_ENDIAN" "${dst}"
|
||||
CT_KconfigEnableOption "ARCH_WANTS_BIG_ENDIAN" "${dst}"
|
||||
;;
|
||||
little)
|
||||
little|little,big)
|
||||
CT_KconfigDisableOption "ARCH_BIG_ENDIAN" "${dst}"
|
||||
CT_KconfigDisableOption "ARCH_WANTS_BIG_ENDIAN" "${dst}"
|
||||
CT_KconfigEnableOption "ARCH_LITTLE_ENDIAN" "${dst}"
|
||||
|
@ -851,23 +851,33 @@ CT_EnvModify() {
|
||||
# sample saving sequence.
|
||||
CT_DoBuildTargetTuple() {
|
||||
# Set the endianness suffix, and the default endianness gcc option
|
||||
target_endian_eb=
|
||||
target_endian_be=
|
||||
target_endian_el=
|
||||
target_endian_le=
|
||||
case "${CT_ARCH_ENDIAN}" in
|
||||
big)
|
||||
target_endian_eb=eb
|
||||
target_endian_be=be
|
||||
target_endian_el=
|
||||
target_endian_le=
|
||||
CT_ARCH_ENDIAN_CFLAG="-mbig-endian"
|
||||
CT_ARCH_ENDIAN_LDFLAG="-Wl,-EB"
|
||||
;;
|
||||
little)
|
||||
target_endian_eb=
|
||||
target_endian_be=
|
||||
target_endian_el=el
|
||||
target_endian_le=le
|
||||
CT_ARCH_ENDIAN_CFLAG="-mlittle-endian"
|
||||
CT_ARCH_ENDIAN_LDFLAG="-Wl,-EL"
|
||||
;;
|
||||
# big,little and little,big do not need to pass the flags;
|
||||
# gcc is expected to be configured for that as default.
|
||||
big,little)
|
||||
target_endian_eb=eb
|
||||
target_endian_be=be
|
||||
;;
|
||||
little,big)
|
||||
target_endian_el=el
|
||||
target_endian_le=le
|
||||
;;
|
||||
esac
|
||||
|
||||
# Set the bitness suffix
|
||||
@ -902,7 +912,7 @@ CT_DoBuildTargetTuple() {
|
||||
|
||||
# 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
|
||||
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}"; }
|
||||
@ -924,6 +934,10 @@ CT_DoBuildTargetTuple() {
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${CT_ARCH_SUPPORTS_WITH_ENDIAN}" = "y" ]; then
|
||||
CT_ARCH_WITH_ENDIAN="--with-endian=${CT_ARCH_ENDIAN}"
|
||||
fi
|
||||
|
||||
# Build the default kernel tuple part
|
||||
CT_TARGET_KERNEL="${CT_KERNEL}"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user