arch: add support for mips32r6 and mips64r6 variants
authorVicente Olivert Riera <Vincent.Riera@imgtec.com>
Mon, 12 Oct 2015 10:08:06 +0000 (11:08 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 12 Oct 2015 19:33:56 +0000 (21:33 +0200)
- Add support for mips32r6 and mips64r6 target architecture variants
- Disable unsupported gcc versions
- Disable unsupported binutils versions
- Disable unsupported external toolchains
- Disable unsuported C libraries
- Add a hook in order to make glibc compile for MIPS R6.

[Thomas: slightly tweak the glibc hack explanation, to make it
hopefully clearer.]

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
arch/Config.in.mips
package/binutils/Config.in.host
package/gcc/Config.in.host
package/glibc/glibc.mk
toolchain/toolchain-buildroot/Config.in
toolchain/toolchain-external/Config.in

index 297977a6c015d01c6a2df4c7b8d6d281503ddd4a..1e5d24de6ea00989dfffaba61cf6b875f7cc8cbf 100644 (file)
@@ -6,8 +6,8 @@ choice
        help
          Specific CPU variant to use
 
-         64bit cabable: 64, 64r2
-         non-64bit capable: 32, 32r2
+         64bit cabable: 64, 64r2, 64r6
+         non-64bit capable: 32, 32r2, 32r6
 
 config BR2_mips_32
        bool "mips 32"
@@ -15,12 +15,18 @@ config BR2_mips_32
 config BR2_mips_32r2
        bool "mips 32r2"
        depends on !BR2_ARCH_IS_64
+config BR2_mips_32r6
+       bool "mips 32r6"
+       depends on !BR2_ARCH_IS_64
 config BR2_mips_64
        bool "mips 64"
        depends on BR2_ARCH_IS_64
 config BR2_mips_64r2
        bool "mips 64r2"
        depends on BR2_ARCH_IS_64
+config BR2_mips_64r6
+       bool "mips 64r6"
+       depends on BR2_ARCH_IS_64
 endchoice
 
 
@@ -67,8 +73,10 @@ config BR2_ARCH_HAS_ATOMICS
 config BR2_GCC_TARGET_ARCH
        default "mips32"        if BR2_mips_32
        default "mips32r2"      if BR2_mips_32r2
+       default "mips32r6"      if BR2_mips_32r6
        default "mips64"        if BR2_mips_64
        default "mips64r2"      if BR2_mips_64r2
+       default "mips64r6"      if BR2_mips_64r6
 
 config BR2_MIPS_OABI32
        bool
index 40619ab811fb7a3a984a38d2e08b10371d27d523..f6aac5cc6b9dc50efc41b960cd22025f475c5e63 100644 (file)
@@ -10,11 +10,15 @@ choice
        config BR2_BINUTILS_VERSION_2_23_X
                depends on !BR2_aarch64 && !BR2_microblaze && \
                           !BR2_powerpc64le && !BR2_nios2
+               # Unsupported for MIPS R6
+               depends on !BR2_mips_32r6 && !BR2_mips_64r6
                bool "binutils 2.23.2"
 
        config BR2_BINUTILS_VERSION_2_24_X
                # supported, but broken on Nios-II and powerpc64le
                depends on !BR2_nios2 && !BR2_powerpc64le
+               # Unsupported for MIPS R6
+               depends on !BR2_mips_32r6 && !BR2_mips_64r6
                bool "binutils 2.24"
 
        config BR2_BINUTILS_VERSION_2_25_X
index baa795607007592983b332273e76cba17797715b..78eb50bb9ac59a9534a8ed2f93f1c113a0dd7f5a 100644 (file)
@@ -31,6 +31,8 @@ choice
                depends on !BR2_x86_corei7 && !BR2_x86_jaguar && !BR2_x86_steamroller
                # ARM EABIhf support appeared in gcc 4.6
                depends on !BR2_ARM_EABIHF
+               # Unsupported for MIPS R6
+               depends on !BR2_mips_32r6 && !BR2_mips_64r6
                # musl patches only for gcc 4.7+
                depends on !BR2_TOOLCHAIN_BUILDROOT_MUSL
                select BR2_GCC_NEEDS_MPC
@@ -50,6 +52,8 @@ choice
                depends on !BR2_sparc_leon3
                # Broken or unsupported x86 cores
                depends on !BR2_x86_jaguar && !BR2_x86_steamroller
+               # Unsupported for MIPS R6
+               depends on !BR2_mips_32r6 && !BR2_mips_64r6
                select BR2_GCC_NEEDS_MPC
                select BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
 
@@ -64,6 +68,8 @@ choice
                depends on !BR2_powerpc_power8
                # gcc-4.8.x + binutils-2.25 is broken for MIPS
                depends on !((BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el) && BR2_BINUTILS_VERSION_2_25_X)
+               # Unsupported for MIPS R6
+               depends on !BR2_mips_32r6 && !BR2_mips_64r6
                select BR2_GCC_NEEDS_MPC
                select BR2_GCC_SUPPORTS_GRAPHITE
                select BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
@@ -80,6 +86,8 @@ choice
                bool "gcc 4.9.x"
                # Broken or unsupported architectures
                depends on !BR2_arc
+               # Unsupported for MIPS R6
+               depends on !BR2_mips_32r6 && !BR2_mips_64r6
                # PR60102 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60102
                select BR2_GCC_NEEDS_MPC
                select BR2_GCC_SUPPORTS_GRAPHITE
index cbfbf32063ec38ed106bc7eb0c22328453a26a7b..e60575f62bd6ae4d4a781c2adb78112a8094608a 100644 (file)
@@ -121,4 +121,34 @@ define GLIBC_INSTALL_TARGET_CMDS
        done
 endef
 
+# MIPS R6 requires to have NaN2008 support which is currently not
+# supported by the Linux kernel. In order to prevent building the
+# glibc against kernels not having NaN2008 support on platforms that
+# requires it, glibc currently checks for an (inexisting) 10.0.0
+# kernel headers version.
+#
+# Since in practice the kernel support for NaN2008 is not really
+# required for things to work properly, we adjust the glibc check to
+# make it believe that NaN2008 support was added in the kernel
+# starting from version 4.0.0.
+#
+# In general the compatibility issues introduced by mis-matched NaN
+# encodings will not cause a problem as signalling NaNs are rarely used
+# in average code. For MIPS R6 there isn't actually any compatibility
+# issue as the hardware is always NaN2008 and software is always
+# NaN2008. The problem only comes from when older MIPS code is linked in
+# via a DSO and multiple NaN encodings are introduced. Since Buildroot
+# is intended to have all code built from source then this scenario is
+# highly unlikely. The failure mode, if it ever occurs, would be either
+# that a signalling NaN fails to raise an invalid operation exception or
+# (more likely) an ordinary NaN raises an invalid operation exception.
+ifeq ($(BR2_mips_32r6)$(BR2_mips_64r6),y)
+define GLIBC_FIX_MIPS_R6
+       $(SED) 's#10.0.0#4.0.0#' \
+               $(@D)/sysdeps/unix/sysv/linux/mips/configure \
+               $(@D)/sysdeps/unix/sysv/linux/mips/configure.ac
+endef
+GLIBC_POST_EXTRACT_HOOKS += GLIBC_FIX_MIPS_R6
+endif
+
 $(eval $(autotools-package))
index 56c01c8e5954af0a51b1e3339304f211cb05c34c..d3f685f4aa772c27cb8438cd38d18cdbf864c6fc 100644 (file)
@@ -34,6 +34,8 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
                   BR2_mips    || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
                   BR2_powerpc || BR2_sh2a   || BR2_sh4    || BR2_sh4eb    || \
                   BR2_sparc   || BR2_xtensa || BR2_x86_64
+       # Unsupported for MIPS R6
+       depends on !BR2_mips_32r6 && !BR2_mips_64r6
        help
          This option selects uClibc as the C library for the
          cross-compilation toolchain.
@@ -90,6 +92,8 @@ config BR2_TOOLCHAIN_BUILDROOT_MUSL
                BR2_microblaze || BR2_mips || BR2_mipsel || BR2_powerpc || \
                BR2_sh || BR2_x86_64
        depends on !BR2_powerpc_SPE # not supported, build breaks
+       # Unsupported for MIPS R6
+       depends on !BR2_mips_32r6 && !BR2_mips_64r6
        select BR2_TOOLCHAIN_USES_MUSL
        help
          This option selects musl as the C library for the
index 1bf97b8beee1bd9c3a1d79e172139806516bd28e..18eb7844bc797f1d90c8f8f5e667af6e15342efd 100644 (file)
@@ -196,6 +196,8 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201505
        depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
        depends on !BR2_MIPS_NABI32
        depends on !BR2_STATIC_LIBS
+       # Unsupported for MIPS R6
+       depends on !BR2_mips_32r6 && !BR2_mips_64r6
        select BR2_TOOLCHAIN_EXTERNAL_GLIBC
        select BR2_TOOLCHAIN_HAS_NATIVE_RPC
        select BR2_INSTALL_LIBSTDCPP
@@ -282,6 +284,8 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201411
        depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
        depends on !BR2_MIPS_NABI32
        depends on !BR2_STATIC_LIBS
+       # Unsupported for MIPS R6
+       depends on !BR2_mips_32r6 && !BR2_mips_64r6
        select BR2_TOOLCHAIN_EXTERNAL_GLIBC
        select BR2_TOOLCHAIN_HAS_NATIVE_RPC
        select BR2_INSTALL_LIBSTDCPP
@@ -368,6 +372,8 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201405
        depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
        depends on !BR2_MIPS_NABI32
        depends on !BR2_STATIC_LIBS
+       # Unsupported for MIPS R6
+       depends on !BR2_mips_32r6 && !BR2_mips_64r6
        select BR2_TOOLCHAIN_EXTERNAL_GLIBC
        select BR2_TOOLCHAIN_HAS_NATIVE_RPC
        select BR2_INSTALL_LIBSTDCPP
@@ -824,6 +830,8 @@ config BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS
                (BR2_i386 && !BR2_x86_i386) || BR2_microblazebe || BR2_mips || \
                BR2_mipsel || (BR2_powerpc && BR2_powerpc_CLASSIC) || BR2_x86_64
        depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+       # Unsupported for MIPS R6
+       depends on !BR2_mips_32r6 && !BR2_mips_64r6
        select BR2_TOOLCHAIN_EXTERNAL_MUSL
        select BR2_INSTALL_LIBSTDCPP
        select BR2_HOSTARCH_NEEDS_IA32_LIBS