All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions
@ 2022-05-29 13:18 Romain Naour
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 02/11] configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43 Romain Naour
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Mark Corbin

Since gcc 12, default Riscv ISA spec version was bump to 20191213 [1].

This introduce a major incompatibility issue is the csr read/write
(csrr*/csrw*) instructions and fence.i instruction has separated from
the "I" extension, become two standalone extensions: Zicsr and
Zifencei; so you might get error messages like that: unrecognized
opcode "csrr" (or "fence.i").

Indeed, without Zifencei we can't build opensbi bootloader [3]:

opensbi-1.0/lib/sbi/sbi_tlb.c: Assembler messages:
opensbi-1.0/lib/sbi/sbi_tlb.c:190: Error: unrecognized opcode `fence.i', extension `zifencei' required

As a workaround, opensbi build system has been patched [4] to use
-march=rv64imafdc_zicsr_zifencei when needed.
This workaround doesn't work in Buildroot due to the local patch
0001-Makefile-Don-t-specify-mabi-or-march.patch removing -march
from CFLAGS.

Fix this issue by introducing two additional Kconfig option
enabling Zicsr and Zifencei standalone extensions for gcc >= 12
as recommanded by [2].

Select Zicsr and Zifencei for General purpose (G) architecture variant
(BR2_riscv_g) since theses extentions were implicitely enabled
previously.

[1] https://gcc.gnu.org/gcc-12/changes.html
[2] https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/aE1ZeHHCYf4
[3] https://github.com/riscv-software-src/opensbi/blob/v0.9/lib/sbi/sbi_tlb.c#L173
[4] https://github.com/riscv-software-src/opensbi/commit/5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Mark Corbin <mark@dibsco.co.uk>
---
 arch/Config.in.riscv | 21 ++++++++++++++++++++-
 arch/arch.mk.riscv   |  6 ++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/arch/Config.in.riscv b/arch/Config.in.riscv
index 288ed833eb..91feea0918 100644
--- a/arch/Config.in.riscv
+++ b/arch/Config.in.riscv
@@ -18,6 +18,12 @@ config BR2_RISCV_ISA_RVD
 config BR2_RISCV_ISA_RVC
 	bool
 
+config BR2_RISCV_ISA_RVZicsr
+	bool
+
+config BR2_RISCV_ISA_RVZifencei
+	bool
+
 choice
 	prompt "Target Architecture Variant"
 	default BR2_riscv_g
@@ -29,8 +35,11 @@ config BR2_riscv_g
 	select BR2_RISCV_ISA_RVA
 	select BR2_RISCV_ISA_RVF
 	select BR2_RISCV_ISA_RVD
+	select BR2_RISCV_ISA_RVZicsr if BR2_TOOLCHAIN_GCC_AT_LEAST_12
+	select BR2_RISCV_ISA_RVZifencei if BR2_TOOLCHAIN_GCC_AT_LEAST_12
 	help
-	  General purpose (G) is equivalent to IMAFD.
+	  General purpose (G) is equivalent to IMAFD
+	  (with Zicsr and Zifencei since gcc >= 12).
 
 config BR2_riscv_custom
 	bool "Custom architecture"
@@ -63,6 +72,16 @@ config BR2_RISCV_ISA_CUSTOM_RVD
 config BR2_RISCV_ISA_CUSTOM_RVC
 	bool "Compressed Instructions (C)"
 	select BR2_RISCV_ISA_RVC
+
+if BR2_TOOLCHAIN_GCC_AT_LEAST_12
+config BR2_RISCV_ISA_CUSTOM_RVZicsr
+	bool "Control and Status Register (CSR) Instructions"
+	select BR2_RISCV_ISA_RVZicsr
+
+config BR2_RISCV_ISA_CUSTOM_RVZifencei
+	bool "Instruction-Fetch Fence"
+	select BR2_RISCV_ISA_RVZifencei
+endif
 endif
 
 choice
diff --git a/arch/arch.mk.riscv b/arch/arch.mk.riscv
index f3bf2b3467..294a5f90a9 100644
--- a/arch/arch.mk.riscv
+++ b/arch/arch.mk.riscv
@@ -26,5 +26,11 @@ endif
 ifeq ($(BR2_RISCV_ISA_RVC),y)
 GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c
 endif
+ifeq ($(BR2_RISCV_ISA_RVZicsr),y)
+GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)_zicsr
+endif
+ifeq ($(BR2_RISCV_ISA_RVZifencei),y)
+GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)_zifencei
+endif
 
 endif
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next  02/11] configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-07-23 12:57   ` Thomas Petazzoni via buildroot
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 03/11] package/gcc: disable libsanitizer for mips64{el} w/ n32 ABI Romain Naour
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Mark Corbin

To build this defconfig with gcc 12, we need a patch from v5.15.24 [1]
fixing the build with gcc 12.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7486227fa47aa84b102be18fd9985f6e8e11e756

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Mark Corbin <mark@dibsco.co.uk>
---
The issue fixed by [1] can also be trigged with gcc 12 and binutils 2.37.
---
 configs/qemu_riscv32_virt_defconfig | 2 +-
 configs/qemu_riscv64_virt_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configs/qemu_riscv32_virt_defconfig b/configs/qemu_riscv32_virt_defconfig
index dff87ef342..faf4e1e312 100644
--- a/configs/qemu_riscv32_virt_defconfig
+++ b/configs/qemu_riscv32_virt_defconfig
@@ -19,7 +19,7 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y
 # Kernel
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.18"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.43"
 BR2_LINUX_KERNEL_DEFCONFIG="rv32"
 BR2_LINUX_KERNEL_IMAGE=y
 
diff --git a/configs/qemu_riscv64_virt_defconfig b/configs/qemu_riscv64_virt_defconfig
index d67d070185..c455680ee0 100644
--- a/configs/qemu_riscv64_virt_defconfig
+++ b/configs/qemu_riscv64_virt_defconfig
@@ -19,7 +19,7 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y
 # Kernel
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.18"
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.43"
 BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
 BR2_LINUX_KERNEL_IMAGE=y
 
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next 03/11] package/gcc: disable libsanitizer for mips64{el} w/ n32 ABI
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 02/11] configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43 Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-07-23 12:41   ` Thomas Petazzoni via buildroot
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 04/11] package/gcc: disable libsanitizer for mips{el} and gcc > 12 Romain Naour
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

libsanitizer has been enabled for mips64{el} in gcc 12 [1] but it
fail to build when n32 ABI is used:

In file included from output/mips64el-buildroot-linux-gnu/sysroot/usr/include/bits/stat.h:25,
                 from output/mips64el-buildroot-linux-gnu/sysroot/usr/include/fcntl.h:78,
                 from ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cpp:55:
output/mips64el-buildroot-linux-gnu/sysroot/usr/include/bits/struct_stat.h:190:8: error: redefinition of ‘struct stat64’
  190 | struct stat64
      |        ^~~~~~

In file included from ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cpp:49:
output/mips64el-buildroot-linux-gnu/sysroot/usr/include/asm/stat.h:52:8: note: previous definition of ‘struct stat64’
   52 | struct stat64 {
      |        ^~~~~~

Disable libsanitizer for mips64 with n32 ABI.

Note: Only glibc toolchains are affected since libsanitizer is
disabled for musl and uClibc-ng toolchains [2].

Fixes:
https://gitlab.com/kubu93/toolchains-builder/-/jobs/2510178651

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=344e6f9f2abcff9b2bb4b26b693be4a599272f43
[2] https://git.buildroot.net/buildroot/commit/?id=5f4d658d888b539de9a6247ae5b1a0999de5d4ec

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 package/gcc/gcc.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index b940327c83..e1f3935e56 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -138,6 +138,13 @@ ifeq ($(BR2_sparc)$(BR2_sparc64),y)
 HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
 endif
 
+# libsanitizer is available for mips64{el} since gcc 12 but fail to build
+# with n32 ABI due to struct stat64 definition clash due to mixing
+# kernel and user headers.
+ifeq ($(BR2_mips64)$(BR2_mips64el)$(BR2_MIPS_NABI32),yy)
+HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
+endif
+
 # The logic in libbacktrace/configure.ac to detect if __sync builtins
 # are available assumes they are as soon as target_subdir is not
 # empty, i.e when cross-compiling. However, some platforms do not have
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next 04/11] package/gcc: disable libsanitizer for mips{el} and gcc > 12
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 02/11] configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43 Romain Naour
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 03/11] package/gcc: disable libsanitizer for mips64{el} w/ n32 ABI Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 05/11] toolchain: enable libquadmath for PowerPC with VSX Romain Naour
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

Since [1], gcc contains a workaround for struct_kernel_stat_sz
definition and apply a local patch when updating libsanitizer with
upstream (llvm-project) [2].

Since gcc 12, the workaround is not enough and trigger the following
error:

In file included from ../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:21:
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:75:38: error: static assertion failed
   75 | COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct stat));
      |                ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Disable libsanitizer for now.

Note: Only glibc toolchains are affected since libsanitizer is
disabled for musl and uClibc-ng	toolchains [3].

Fixes:
https://gitlab.com/kubu93/toolchains-builder/-/jobs/2510178606

[1] http://gcc.gnu.org/ml/gcc/2018-03/msg00133.html
[2] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9f943b2446f2d0a345bbf9b4be3d3a4316372270
[3] https://git.buildroot.net/buildroot/commit/?id=5f4d658d888b539de9a6247ae5b1a0999de5d4ec

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 package/gcc/gcc.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index e1f3935e56..73440e9e35 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -145,6 +145,12 @@ ifeq ($(BR2_mips64)$(BR2_mips64el)$(BR2_MIPS_NABI32),yy)
 HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
 endif
 
+# libsanitizer bundled in gcc 12 fail to build for mips32 due to
+# mixing kernel and user struct stat.
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_12)$(BR2_mips)$(BR2_mipsel),yy)
+HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
+endif
+
 # The logic in libbacktrace/configure.ac to detect if __sync builtins
 # are available assumes they are as soon as target_subdir is not
 # empty, i.e when cross-compiling. However, some platforms do not have
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next 05/11] toolchain: enable libquadmath for PowerPC with VSX
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
                   ` (2 preceding siblings ...)
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 04/11] package/gcc: disable libsanitizer for mips{el} and gcc > 12 Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-07-23 12:57   ` Thomas Petazzoni via buildroot
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 06/11] package/gcc: add missing --enable-libquadmath-support option Romain Naour
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Cyril Bur, Cédric Le Goater

float128 is available on PowerPC with VSX [1] but it requires
libquadmath support.

[1] https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Floating-Types.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Cyril Bur <cyrilbur@gmail.com>
Cc: Cédric Le Goater <clg@kaod.org>
---
 toolchain/Config.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 73ea78624a..7e129e58d3 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -833,9 +833,11 @@ config BR2_TOOLCHAIN_HAS_ATOMIC
 # - At least, libquadmath is available on:
 #   - i*86
 #   - x86_64
+#   - PowerPC with vector scalar (VSX) instruction set
 # - When available, libquadmath requires wchar support.
 config BR2_TOOLCHAIN_HAS_LIBQUADMATH
 	bool
 	default y if BR2_i386 || BR2_x86_64
+	default y if BR2_POWERPC_CPU_HAS_VSX
 
 endmenu
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next 06/11] package/gcc: add missing --enable-libquadmath-support option
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
                   ` (3 preceding siblings ...)
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 05/11] toolchain: enable libquadmath for PowerPC with VSX Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-07-23 12:57   ` Thomas Petazzoni via buildroot
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 07/11] package/gcc: switch to https urls for archives hashes Romain Naour
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

When BR2_TOOLCHAIN_HAS_LIBQUADMATH is set, --enable-libquadmath-support
option is missing. So the float128 support is not fully enabled in gcc.

This lead to a build issue with gcc 12 on PowerPC power8 due to missing
M_2_SQRTPIq definition (provided by libquadmath.h).

../../../libgfortran/intrinsics/erfc_scaled.c: In function ‘erfc_scaled_r17’:
../../../libgfortran/intrinsics/erfc_scaled.c:143:22: error: ‘M_2_SQRTPIq’ undeclared (first use in this function); did you mean ‘M_2_SQRTPIf’?
  143 | # define _M_2_SQRTPI M_2_SQRTPIq
      |                      ^~~~~~~~~~~

This is fixed by adding --enable-libquadmath-support (like crosstool-ng
handling [1]).

Fixes:
https://gitlab.com/kubu93/toolchains-builder/-/jobs/2510178766

[1] https://github.com/crosstool-ng/crosstool-ng/blob/crosstool-ng-1.25.0/scripts/build/cc/gcc.sh#L370

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 package/gcc/gcc.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 73440e9e35..c3c1df833b 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -121,7 +121,7 @@ endif
 
 # quadmath support requires wchar
 ifeq ($(BR2_USE_WCHAR)$(BR2_TOOLCHAIN_HAS_LIBQUADMATH),yy)
-HOST_GCC_COMMON_CONF_OPTS += --enable-libquadmath
+HOST_GCC_COMMON_CONF_OPTS += --enable-libquadmath --enable-libquadmath-support
 else
 HOST_GCC_COMMON_CONF_OPTS += --disable-libquadmath --disable-libquadmath-support
 endif
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next 07/11] package/gcc: switch to https urls for archives hashes
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
                   ` (4 preceding siblings ...)
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 06/11] package/gcc: add missing --enable-libquadmath-support option Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-07-23 12:57   ` Thomas Petazzoni via buildroot
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12 Romain Naour
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

FTP urls doesn't work anymore with Firefox [1] and Google Chrome [2],
switch to https urls.

[1] https://blog.mozilla.org/addons/2020/04/13/what-to-expect-for-the-upcoming-deprecation-of-ftp-in-firefox/
[2] https://chromestatus.com/feature/6246151319715840

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 package/gcc/gcc.hash | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/gcc/gcc.hash b/package/gcc/gcc.hash
index ad8bae4a99..e364be0a06 100644
--- a/package/gcc/gcc.hash
+++ b/package/gcc/gcc.hash
@@ -1,10 +1,10 @@
-# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-8.4.0/sha512.sum
+# From https://gcc.gnu.org/pub/gcc/releases/gcc-8.4.0/sha512.sum
 sha512  6de904f552a02de33b11ef52312bb664396efd7e1ce3bbe37bfad5ef617f133095b3767b4804bc7fe78df335cb53bc83f1ac055baed40979ce4c2c3e46b70280  gcc-8.4.0.tar.xz
-#  From ftp://gcc.gnu.org/pub/gcc/releases/gcc-9.4.0/sha512.sum
+#  From https://gcc.gnu.org/pub/gcc/releases/gcc-9.4.0/sha512.sum
 sha512  dfd3500bf21784b8351a522d53463cf362ede66b0bc302edf350bb44e94418497a8b4b797b6af8ca9b2eeb746b3b115d9c3698381b989546e9151b4496415624  gcc-9.4.0.tar.xz
-# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-10.3.0/sha512.sum
+# From https://gcc.gnu.org/pub/gcc/releases/gcc-10.3.0/sha512.sum
 sha512  2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86  gcc-10.3.0.tar.xz
-# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/sha512.sum
+# From https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/sha512.sum
 sha512  f0be5ad705c73b84477128a69c047f57dd47002f375eb60e1e842e08cf2009a509e92152bca345823926d550b7395ae6d4de7db51d1ee371c2dc37313881fca7  gcc-11.3.0.tar.xz
 
 # Locally calculated (fetched from Github)
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
                   ` (5 preceding siblings ...)
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 07/11] package/gcc: switch to https urls for archives hashes Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-06-25  6:45   ` James Hilliard
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 09/11] arch: add BR2_ARCH_NEEDS_GCC_AT_LEAST_12 Romain Naour
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

https://gcc.gnu.org/gcc-12/changes.html
https://gcc.gnu.org/gcc-12/porting_to.html

Tested with toolchain-builder:
https://gitlab.com/kubu93/toolchains-builder/-/pipelines/550404957

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 package/gcc/Config.in.host | 14 ++++++++++++++
 package/gcc/gcc.hash       |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 06f83d8f87..bcf0743b23 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -62,6 +62,19 @@ config BR2_GCC_VERSION_11_X
 	depends on !BR2_archs4x_rel31
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_11
 
+config BR2_GCC_VERSION_12_X
+	bool "gcc 12.x"
+	# powerpc spe support has been deprecated since gcc 8.x.
+	# https://gcc.gnu.org/ml/gcc/2018-04/msg00102.html
+	depends on !BR2_powerpc_SPE
+	# uClibc-ng broken on sparc due to recent gcc changes
+	# that need to be reverted since gcc 8.4, 9.3 and 10.1.
+	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
+	depends on !BR2_sparc
+	# ARC HS48 rel 31 only supported by gcc arc fork.
+	depends on !BR2_archs4x_rel31
+	select BR2_TOOLCHAIN_GCC_AT_LEAST_12
+
 endchoice
 
 # libcilkrts was introduced in gcc 4.9 and removed in gcc 8.x
@@ -88,6 +101,7 @@ config BR2_GCC_VERSION
 	default "9.4.0"     if BR2_GCC_VERSION_9_X
 	default "10.3.0"    if BR2_GCC_VERSION_10_X
 	default "11.3.0"    if BR2_GCC_VERSION_11_X
+	default "12.1.0"    if BR2_GCC_VERSION_12_X
 	default "arc-2020.09-release" if BR2_GCC_VERSION_ARC
 
 config BR2_EXTRA_GCC_CONFIG_OPTIONS
diff --git a/package/gcc/gcc.hash b/package/gcc/gcc.hash
index e364be0a06..dc19c282c2 100644
--- a/package/gcc/gcc.hash
+++ b/package/gcc/gcc.hash
@@ -6,6 +6,8 @@ sha512  dfd3500bf21784b8351a522d53463cf362ede66b0bc302edf350bb44e94418497a8b4b79
 sha512  2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86  gcc-10.3.0.tar.xz
 # From https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/sha512.sum
 sha512  f0be5ad705c73b84477128a69c047f57dd47002f375eb60e1e842e08cf2009a509e92152bca345823926d550b7395ae6d4de7db51d1ee371c2dc37313881fca7  gcc-11.3.0.tar.xz
+# From https://gcc.gnu.org/pub/gcc/releases/gcc-12.1.0/sha512.sum
+sha512  2121d295292814a6761edf1fba08c5f633ebe16f52b80e7b73a91050e71e1d2ed98bf17eebad263e191879561c02b48906c53faa4c4670c486a26fc75df23900  gcc-12.1.0.tar.xz
 
 # Locally calculated (fetched from Github)
 sha512  b0853e2b1c5998044392023fa653e399e74118c46e616504ac59e1a2cf27620f94434767ce06b6cf4ca3dfb57f81d6eda92752befaf095ea5e564a9181b4659c  gcc-arc-2020.09-release.tar.gz
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next 09/11] arch: add BR2_ARCH_NEEDS_GCC_AT_LEAST_12
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
                   ` (6 preceding siblings ...)
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12 Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 10/11] package/gcc: switch to gcc 11.x as the default Romain Naour
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

This new symbol will be used by architectures introduced with gcc 12.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 arch/Config.in             | 4 ++++
 package/gcc/Config.in.host | 1 +
 2 files changed, 5 insertions(+)

diff --git a/arch/Config.in b/arch/Config.in
index 49e16fce38..966ceaa397 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -321,6 +321,10 @@ config BR2_ARCH_NEEDS_GCC_AT_LEAST_11
 	bool
 	select BR2_ARCH_NEEDS_GCC_AT_LEAST_10
 
+config BR2_ARCH_NEEDS_GCC_AT_LEAST_12
+	bool
+	select BR2_ARCH_NEEDS_GCC_AT_LEAST_11
+
 # The following string values are defined by the individual
 # Config.in.$ARCH files
 config BR2_ARCH
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index bcf0743b23..afaa4d2191 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -51,6 +51,7 @@ config BR2_GCC_VERSION_10_X
 
 config BR2_GCC_VERSION_11_X
 	bool "gcc 11.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_12
 	# powerpc spe support has been deprecated since gcc 8.x.
 	# https://gcc.gnu.org/ml/gcc/2018-04/msg00102.html
 	depends on !BR2_powerpc_SPE
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next 10/11] package/gcc: switch to gcc 11.x as the default
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
                   ` (7 preceding siblings ...)
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 09/11] arch: add BR2_ARCH_NEEDS_GCC_AT_LEAST_12 Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 11/11] package/gcc: remove gcc 9.x Romain Naour
  2022-07-23 12:39 ` [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Thomas Petazzoni via buildroot
  10 siblings, 0 replies; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

Even if gcc 10.x is still maintained for some time, switch to gcc 11.x
since it has been released since 2021-04-27 and gcc 12.x is available
since "2022-05-10".

We have been having toolchains in the autobuilders with gcc 11.x since
mid-June 2021, so the vast majority of the problems should have
already been solved.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 package/gcc/Config.in.host | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index afaa4d2191..10061dbc9d 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -4,7 +4,7 @@ choice
 	prompt "GCC compiler Version"
 	default BR2_GCC_VERSION_ARC if BR2_arc
 	default BR2_GCC_VERSION_POWERPC_SPE if BR2_powerpc_SPE
-	default BR2_GCC_VERSION_10_X
+	default BR2_GCC_VERSION_11_X
 	help
 	  Select the version of gcc you wish to use.
 
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH for-next  11/11] package/gcc: remove gcc 9.x
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
                   ` (8 preceding siblings ...)
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 10/11] package/gcc: switch to gcc 11.x as the default Romain Naour
@ 2022-05-29 13:18 ` Romain Naour
  2022-07-23 12:39 ` [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Thomas Petazzoni via buildroot
  10 siblings, 0 replies; 21+ messages in thread
From: Romain Naour @ 2022-05-29 13:18 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

gcc 12.1 is around, gcc 11.3 is the default version, so drop
9.5 in order to reduce the gcc choice.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 Config.in.legacy                              |   9 +
 ...-issue-with-set_got-clobbering-LR-r9.patch | 105 ------
 ...TRANT-for-OpenRISC-when-pthread-is-p.patch |  31 --
 ...get-92095-internal-error-with-O1-mcp.patch | 325 ------------------
 ...-mcmodel-option-to-handle-large-GOTs.patch | 201 -----------
 ...-cmodel-large-when-building-crtstuff.patch |  60 ----
 package/gcc/Config.in.host                    |  15 -
 package/gcc/gcc.hash                          |   2 -
 8 files changed, 9 insertions(+), 739 deletions(-)
 delete mode 100644 package/gcc/9.4.0/0001-or1k-Fix-issue-with-set_got-clobbering-LR-r9.patch
 delete mode 100644 package/gcc/9.4.0/0002-gcc-define-_REENTRANT-for-OpenRISC-when-pthread-is-p.patch
 delete mode 100644 package/gcc/9.4.0/0003-Revert-re-PR-target-92095-internal-error-with-O1-mcp.patch
 delete mode 100644 package/gcc/9.4.0/0004-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
 delete mode 100644 package/gcc/9.4.0/0005-or1k-Use-cmodel-large-when-building-crtstuff.patch

diff --git a/Config.in.legacy b/Config.in.legacy
index 3d5df3abbb..39def0d853 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -144,6 +144,15 @@ endif
 
 ###############################################################################
 
+comment "Legacy options removed in 2022.08"
+
+config BR2_GCC_VERSION_9_X
+	bool "gcc 9.x support removed"
+	select BR2_LEGACY
+	help
+	  Support for gcc version 9.x has been removed. The current
+	  default version (11.x or later) has been selected instead.
+
 comment "Legacy options removed in 2022.05"
 
 config BR2_KERNEL_HEADERS_5_16
diff --git a/package/gcc/9.4.0/0001-or1k-Fix-issue-with-set_got-clobbering-LR-r9.patch b/package/gcc/9.4.0/0001-or1k-Fix-issue-with-set_got-clobbering-LR-r9.patch
deleted file mode 100644
index 185e16c179..0000000000
--- a/package/gcc/9.4.0/0001-or1k-Fix-issue-with-set_got-clobbering-LR-r9.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-From 014db5e5febec94e35c13ce89ee6b389328873a1 Mon Sep 17 00:00:00 2001
-From: shorne <shorne@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Sat, 31 Aug 2019 06:00:56 +0000
-Subject: [PATCH] or1k: Fix issue with set_got clobbering LR (r9)
-
-When compiling glibc we found that the GOT register was being allocated
-r9 when the instruction was still set_got_tmp.  That is a problem
-because r9 is the Link Register (LR) in OpenRISC which is used/clobbered
-in set_got.  We cannot use r9 as the GOT register.  Also, we cannot
-simply say set_got_tmp clobbers r9 as this is the reason for having the
-temporary set_got_tmp.
-
-Fix by using a register class constraint that does not allow r9 during
-register allocation.
-
-gcc/ChangeLog:
-
-        * config/or1k/constraints.md (t): New constraint.
-        * config/or1k/or1k.h (GOT_REGS): New register class.
-        * config/or1k/or1k.md (set_got_tmp, set_got): Use t contraint.
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@275242 138bc75d-0d04-0410-961f-82ee72b054a4
-(cherry picked from commit 5b9471ffca25d39635680516ba2ff85295480fc3)
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
----
- gcc/config/or1k/constraints.md | 4 ++++
- gcc/config/or1k/or1k.h         | 3 +++
- gcc/config/or1k/or1k.md        | 4 ++--
- 3 files changed, 9 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/config/or1k/constraints.md b/gcc/config/or1k/constraints.md
-index 93da8c058c6..a16b749008f 100644
---- a/gcc/config/or1k/constraints.md
-+++ b/gcc/config/or1k/constraints.md
-@@ -24,6 +24,7 @@
- 
- ; We use:
- ;  c - sibcall registers
-+;  t - got address registers (excludes LR (r9) which is clobbered by set_got)
- ;  I - constant signed 16-bit
- ;  K - constant unsigned 16-bit
- ;  M - constant signed 16-bit shifted left 16-bits (l.movhi)
-@@ -32,6 +33,9 @@
- (define_register_constraint "c" "SIBCALL_REGS"
-   "Registers which can hold a sibling call address")
- 
-+(define_register_constraint "t" "GOT_REGS"
-+  "Registers which can be used to store the Global Offset Table (GOT) address.")
-+
- ;; Immediates
- (define_constraint "I"
-   "A signed 16-bit immediate in the range -32768 to 32767."
-diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h
-index 6dda230f217..feee702d89c 100644
---- a/gcc/config/or1k/or1k.h
-+++ b/gcc/config/or1k/or1k.h
-@@ -189,6 +189,7 @@ enum reg_class
- {
-   NO_REGS,
-   SIBCALL_REGS,
-+  GOT_REGS,
-   GENERAL_REGS,
-   FLAG_REGS,
-   ALL_REGS,
-@@ -200,6 +201,7 @@ enum reg_class
- #define REG_CLASS_NAMES {	\
-   "NO_REGS", 			\
-   "SIBCALL_REGS",		\
-+  "GOT_REGS",			\
-   "GENERAL_REGS",		\
-   "FLAG_REGS",			\
-   "ALL_REGS" }
-@@ -212,6 +214,7 @@ enum reg_class
- #define REG_CLASS_CONTENTS      \
- { { 0x00000000, 0x00000000 },	\
-   { SIBCALL_REGS_MASK,   0 },	\
-+  { 0xfffffdff, 0x00000000 },	\
-   { 0xffffffff, 0x00000003 },	\
-   { 0x00000000, 0x00000004 },	\
-   { 0xffffffff, 0x00000007 }	\
-diff --git a/gcc/config/or1k/or1k.md b/gcc/config/or1k/or1k.md
-index 2dad51cd46b..88f3f02630f 100644
---- a/gcc/config/or1k/or1k.md
-+++ b/gcc/config/or1k/or1k.md
-@@ -595,7 +595,7 @@
- ;; set_got pattern below.  This works because the set_got_tmp insn is the
- ;; first insn in the stream and that it isn't moved during RA.
- (define_insn "set_got_tmp"
--  [(set (match_operand:SI 0 "register_operand" "=r")
-+  [(set (match_operand:SI 0 "register_operand" "=t")
- 	(unspec_volatile:SI [(const_int 0)] UNSPECV_SET_GOT))]
-   ""
- {
-@@ -604,7 +604,7 @@
- 
- ;; The insn to initialize the GOT.
- (define_insn "set_got"
--  [(set (match_operand:SI 0 "register_operand" "=r")
-+  [(set (match_operand:SI 0 "register_operand" "=t")
- 	(unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
-    (clobber (reg:SI LR_REGNUM))]
-   ""
--- 
-2.31.1
-
diff --git a/package/gcc/9.4.0/0002-gcc-define-_REENTRANT-for-OpenRISC-when-pthread-is-p.patch b/package/gcc/9.4.0/0002-gcc-define-_REENTRANT-for-OpenRISC-when-pthread-is-p.patch
deleted file mode 100644
index 5ac03d7c0c..0000000000
--- a/package/gcc/9.4.0/0002-gcc-define-_REENTRANT-for-OpenRISC-when-pthread-is-p.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From f80e9941739fb3973b61fc6a5abddef5ad2faf73 Mon Sep 17 00:00:00 2001
-From: Bernd Kuhls <bernd.kuhls@t-online.de>
-Date: Fri, 27 Mar 2020 21:23:53 +0100
-Subject: [PATCH] gcc: define _REENTRANT for OpenRISC when -pthread is passed
-
-The detection of pthread support fails on OpenRISC unless _REENTRANT
-is defined. Added the CPP_SPEC definition to correct this.
-
-Patch sent upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94372
-
-Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
----
- gcc/config/or1k/linux.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/gcc/config/or1k/linux.h b/gcc/config/or1k/linux.h
-index cbdc781418f..36303af892c 100644
---- a/gcc/config/or1k/linux.h
-+++ b/gcc/config/or1k/linux.h
-@@ -32,6 +32,8 @@
- #undef MUSL_DYNAMIC_LINKER
- #define MUSL_DYNAMIC_LINKER  "/lib/ld-musl-or1k.so.1"
- 
-+#define CPP_SPEC "%{pthread:-D_REENTRANT}"
-+
- #undef LINK_SPEC
- #define LINK_SPEC "%{h*}			\
-    %{static:-Bstatic}				\
--- 
-2.31.1
-
diff --git a/package/gcc/9.4.0/0003-Revert-re-PR-target-92095-internal-error-with-O1-mcp.patch b/package/gcc/9.4.0/0003-Revert-re-PR-target-92095-internal-error-with-O1-mcp.patch
deleted file mode 100644
index 0c69de93be..0000000000
--- a/package/gcc/9.4.0/0003-Revert-re-PR-target-92095-internal-error-with-O1-mcp.patch
+++ /dev/null
@@ -1,325 +0,0 @@
-From 1107ecc3e8af31adc7bbd4e08c0614836bd1cebd Mon Sep 17 00:00:00 2001
-From: Romain Naour <romain.naour@gmail.com>
-Date: Wed, 20 Jan 2021 23:22:16 +0100
-Subject: [PATCH] Revert "re PR target/92095 (internal error with -O1
- -mcpu=niagara2 -fPIE)"
-
-This reverts commit 6bf2990842388101897b6f465524cbc295ee8cf9.
-
-Building the Buildroot defconfig qemu_sparc_ss10_defconfig using
-gcc 8.4, 9.3 and 10 produce a broken rootfs that trigger illegal
-instruction messages.
-
-gcc 8.3, 9.2 are the latest working gcc version.
-git bisect between gcc 8.4 and 8.4 allowed to identify
-the commit that introcuce the regression.
-
-Reverting this patch allowed to produce a working rootfs.
-
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
-Cc: Eric Botcazou <ebotcazou@gcc.gnu.org>
----
- gcc/config/sparc/sparc-protos.h               |   1 -
- gcc/config/sparc/sparc.c                      | 121 +++++++-----------
- gcc/config/sparc/sparc.md                     |   5 +-
- .../gcc.c-torture/compile/20191108-1.c        |  14 --
- gcc/testsuite/gcc.target/sparc/overflow-3.c   |   2 +-
- gcc/testsuite/gcc.target/sparc/overflow-4.c   |   2 +-
- gcc/testsuite/gcc.target/sparc/overflow-5.c   |   2 +-
- 7 files changed, 53 insertions(+), 94 deletions(-)
- delete mode 100644 gcc/testsuite/gcc.c-torture/compile/20191108-1.c
-
-diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
-index f1c120c4860..f4b6f00a7b1 100644
---- a/gcc/config/sparc/sparc-protos.h
-+++ b/gcc/config/sparc/sparc-protos.h
-@@ -69,7 +69,6 @@ extern void sparc_split_reg_mem (rtx, rtx, machine_mode);
- extern void sparc_split_mem_reg (rtx, rtx, machine_mode);
- extern int sparc_split_reg_reg_legitimate (rtx, rtx);
- extern void sparc_split_reg_reg (rtx, rtx, machine_mode);
--extern const char *output_load_pcrel_sym (rtx *);
- extern const char *output_ubranch (rtx, rtx_insn *);
- extern const char *output_cbranch (rtx, rtx, int, int, int, rtx_insn *);
- extern const char *output_return (rtx_insn *);
-diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
-index 0553dc501e6..516dcf96d7b 100644
---- a/gcc/config/sparc/sparc.c
-+++ b/gcc/config/sparc/sparc.c
-@@ -4170,6 +4170,13 @@ eligible_for_sibcall_delay (rtx_insn *trial)
- static bool
- sparc_cannot_force_const_mem (machine_mode mode, rtx x)
- {
-+  /* After IRA has run in PIC mode, it is too late to put anything into the
-+     constant pool if the PIC register hasn't already been initialized.  */
-+  if ((lra_in_progress || reload_in_progress)
-+      && flag_pic
-+      && !crtl->uses_pic_offset_table)
-+    return true;
-+
-   switch (GET_CODE (x))
-     {
-     case CONST_INT:
-@@ -4205,11 +4212,9 @@ sparc_cannot_force_const_mem (machine_mode mode, rtx x)
- }
- \f
- /* Global Offset Table support.  */
--static GTY(()) rtx got_symbol_rtx = NULL_RTX;
--static GTY(()) rtx got_register_rtx = NULL_RTX;
- static GTY(()) rtx got_helper_rtx = NULL_RTX;
--
--static GTY(()) bool got_helper_needed = false;
-+static GTY(()) rtx got_register_rtx = NULL_RTX;
-+static GTY(()) rtx got_symbol_rtx = NULL_RTX;
- 
- /* Return the SYMBOL_REF for the Global Offset Table.  */
- 
-@@ -4222,6 +4227,27 @@ sparc_got (void)
-   return got_symbol_rtx;
- }
- 
-+#ifdef HAVE_GAS_HIDDEN
-+# define USE_HIDDEN_LINKONCE 1
-+#else
-+# define USE_HIDDEN_LINKONCE 0
-+#endif
-+
-+static void
-+get_pc_thunk_name (char name[32], unsigned int regno)
-+{
-+  const char *reg_name = reg_names[regno];
-+
-+  /* Skip the leading '%' as that cannot be used in a
-+     symbol name.  */
-+  reg_name += 1;
-+
-+  if (USE_HIDDEN_LINKONCE)
-+    sprintf (name, "__sparc_get_pc_thunk.%s", reg_name);
-+  else
-+    ASM_GENERATE_INTERNAL_LABEL (name, "LADDPC", regno);
-+}
-+
- /* Wrapper around the load_pcrel_sym{si,di} patterns.  */
- 
- static rtx
-@@ -4241,78 +4267,30 @@ gen_load_pcrel_sym (rtx op0, rtx op1, rtx op2)
-   return insn;
- }
- 
--/* Output the load_pcrel_sym{si,di} patterns.  */
--
--const char *
--output_load_pcrel_sym (rtx *operands)
--{
--  if (flag_delayed_branch)
--    {
--      output_asm_insn ("sethi\t%%hi(%a1-4), %0", operands);
--      output_asm_insn ("call\t%a2", operands);
--      output_asm_insn (" add\t%0, %%lo(%a1+4), %0", operands);
--    }
--  else
--    {
--      output_asm_insn ("sethi\t%%hi(%a1-8), %0", operands);
--      output_asm_insn ("add\t%0, %%lo(%a1-4), %0", operands);
--      output_asm_insn ("call\t%a2", operands);
--      output_asm_insn (" nop", NULL);
--    }
--
--  if (operands[2] == got_helper_rtx)
--    got_helper_needed = true;
--
--  return "";
--}
--
--#ifdef HAVE_GAS_HIDDEN
--# define USE_HIDDEN_LINKONCE 1
--#else
--# define USE_HIDDEN_LINKONCE 0
--#endif
--
- /* Emit code to load the GOT register.  */
- 
- void
- load_got_register (void)
- {
--  rtx insn;
-+  if (!got_register_rtx)
-+    got_register_rtx = gen_rtx_REG (Pmode, GLOBAL_OFFSET_TABLE_REGNUM);
- 
-   if (TARGET_VXWORKS_RTP)
--    {
--      if (!got_register_rtx)
--	got_register_rtx = pic_offset_table_rtx;
--
--      insn = gen_vxworks_load_got ();
--    }
-+    emit_insn (gen_vxworks_load_got ());
-   else
-     {
--      if (!got_register_rtx)
--	got_register_rtx = gen_rtx_REG (Pmode, GLOBAL_OFFSET_TABLE_REGNUM);
--
-       /* The GOT symbol is subject to a PC-relative relocation so we need a
- 	 helper function to add the PC value and thus get the final value.  */
-       if (!got_helper_rtx)
- 	{
- 	  char name[32];
--
--	  /* Skip the leading '%' as that cannot be used in a symbol name.  */
--	  if (USE_HIDDEN_LINKONCE)
--	    sprintf (name, "__sparc_get_pc_thunk.%s",
--		     reg_names[REGNO (got_register_rtx)] + 1);
--	  else
--	    ASM_GENERATE_INTERNAL_LABEL (name, "LADDPC",
--					 REGNO (got_register_rtx));
--
-+	  get_pc_thunk_name (name, GLOBAL_OFFSET_TABLE_REGNUM);
- 	  got_helper_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
- 	}
- 
--      insn
--	= gen_load_pcrel_sym (got_register_rtx, sparc_got (), got_helper_rtx);
-+      emit_insn (gen_load_pcrel_sym (got_register_rtx, sparc_got (),
-+				     got_helper_rtx));
-     }
--
--  emit_insn (insn);
- }
- 
- /* Ensure that we are not using patterns that are not OK with PIC.  */
-@@ -5477,7 +5455,7 @@ save_local_or_in_reg_p (unsigned int regno, int leaf_function)
-     return true;
- 
-   /* GOT register (%l7) if needed.  */
--  if (got_register_rtx && regno == REGNO (got_register_rtx))
-+  if (regno == GLOBAL_OFFSET_TABLE_REGNUM && got_register_rtx)
-     return true;
- 
-   /* If the function accesses prior frames, the frame pointer and the return
-@@ -12520,9 +12498,10 @@ static void
- sparc_file_end (void)
- {
-   /* If we need to emit the special GOT helper function, do so now.  */
--  if (got_helper_needed)
-+  if (got_helper_rtx)
-     {
-       const char *name = XSTR (got_helper_rtx, 0);
-+      const char *reg_name = reg_names[GLOBAL_OFFSET_TABLE_REGNUM];
- #ifdef DWARF2_UNWIND_INFO
-       bool do_cfi;
- #endif
-@@ -12559,22 +12538,17 @@ sparc_file_end (void)
- #ifdef DWARF2_UNWIND_INFO
-       do_cfi = dwarf2out_do_cfi_asm ();
-       if (do_cfi)
--	output_asm_insn (".cfi_startproc", NULL);
-+	fprintf (asm_out_file, "\t.cfi_startproc\n");
- #endif
-       if (flag_delayed_branch)
--	{
--	  output_asm_insn ("jmp\t%%o7+8", NULL);
--	  output_asm_insn (" add\t%%o7, %0, %0", &got_register_rtx);
--	}
-+	fprintf (asm_out_file, "\tjmp\t%%o7+8\n\t add\t%%o7, %s, %s\n",
-+		 reg_name, reg_name);
-       else
--	{
--	  output_asm_insn ("add\t%%o7, %0, %0", &got_register_rtx);
--	  output_asm_insn ("jmp\t%%o7+8", NULL);
--	  output_asm_insn (" nop", NULL);
--	}
-+	fprintf (asm_out_file, "\tadd\t%%o7, %s, %s\n\tjmp\t%%o7+8\n\t nop\n",
-+		 reg_name, reg_name);
- #ifdef DWARF2_UNWIND_INFO
-       if (do_cfi)
--	output_asm_insn (".cfi_endproc", NULL);
-+	fprintf (asm_out_file, "\t.cfi_endproc\n");
- #endif
-     }
- 
-@@ -13080,10 +13054,7 @@ sparc_init_pic_reg (void)
-   edge entry_edge;
-   rtx_insn *seq;
- 
--  /* In PIC mode, we need to always initialize the PIC register if optimization
--     is enabled, because we are called from IRA and LRA may later force things
--     to the constant pool for optimization purposes.  */
--  if (!flag_pic || (!crtl->uses_pic_offset_table && !optimize))
-+  if (!crtl->uses_pic_offset_table)
-     return;
- 
-   start_sequence ();
-diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
-index d9ef79c13cc..6dbd054f1c7 100644
---- a/gcc/config/sparc/sparc.md
-+++ b/gcc/config/sparc/sparc.md
-@@ -1601,7 +1601,10 @@
-    (clobber (reg:P O7_REG))]
-   "REGNO (operands[0]) == INTVAL (operands[3])"
- {
--  return output_load_pcrel_sym (operands);
-+  if (flag_delayed_branch)
-+    return "sethi\t%%hi(%a1-4), %0\n\tcall\t%a2\n\t add\t%0, %%lo(%a1+4), %0";
-+  else
-+    return "sethi\t%%hi(%a1-8), %0\n\tadd\t%0, %%lo(%a1-4), %0\n\tcall\t%a2\n\t nop";
- }
-   [(set (attr "type") (const_string "multi"))
-    (set (attr "length")
-diff --git a/gcc/testsuite/gcc.c-torture/compile/20191108-1.c b/gcc/testsuite/gcc.c-torture/compile/20191108-1.c
-deleted file mode 100644
-index 7929751bb06..00000000000
---- a/gcc/testsuite/gcc.c-torture/compile/20191108-1.c
-+++ /dev/null
-@@ -1,14 +0,0 @@
--/* PR target/92095 */
--/* Testcase by Sergei Trofimovich <slyfox@inbox.ru> */
--
--typedef union {
--  double a;
--  int b[2];
--} c;
--
--double d(int e)
--{
--  c f;
--  (&f)->b[0] = 15728640;
--  return e ? -(&f)->a : (&f)->a;
--}
-diff --git a/gcc/testsuite/gcc.target/sparc/overflow-3.c b/gcc/testsuite/gcc.target/sparc/overflow-3.c
-index 52d6ab2b688..86dddfb09e6 100644
---- a/gcc/testsuite/gcc.target/sparc/overflow-3.c
-+++ b/gcc/testsuite/gcc.target/sparc/overflow-3.c
-@@ -1,6 +1,6 @@
- /* { dg-do compile } */
- /* { dg-require-effective-target lp64 } */
--/* { dg-options "-O -fno-pie" } */
-+/* { dg-options "-O" } */
- 
- #include <stdbool.h>
- #include <stdint.h>
-diff --git a/gcc/testsuite/gcc.target/sparc/overflow-4.c b/gcc/testsuite/gcc.target/sparc/overflow-4.c
-index c6121b958c3..019feee335c 100644
---- a/gcc/testsuite/gcc.target/sparc/overflow-4.c
-+++ b/gcc/testsuite/gcc.target/sparc/overflow-4.c
-@@ -1,6 +1,6 @@
- /* { dg-do compile } */
- /* { dg-require-effective-target lp64 } */
--/* { dg-options "-O -fno-pie -mno-vis3 -mno-vis4" } */
-+/* { dg-options "-O -mno-vis3 -mno-vis4" } */
- 
- #include <stdbool.h>
- #include <stdint.h>
-diff --git a/gcc/testsuite/gcc.target/sparc/overflow-5.c b/gcc/testsuite/gcc.target/sparc/overflow-5.c
-index f00283f6e7b..67d4ac38095 100644
---- a/gcc/testsuite/gcc.target/sparc/overflow-5.c
-+++ b/gcc/testsuite/gcc.target/sparc/overflow-5.c
-@@ -1,6 +1,6 @@
- /* { dg-do compile } */
- /* { dg-require-effective-target lp64 } */
--/* { dg-options "-O -fno-pie -mvis3" } */
-+/* { dg-options "-O -mvis3" } */
- 
- #include <stdbool.h>
- #include <stdint.h>
--- 
-2.31.1
-
diff --git a/package/gcc/9.4.0/0004-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch b/package/gcc/9.4.0/0004-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
deleted file mode 100644
index 894411f394..0000000000
--- a/package/gcc/9.4.0/0004-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
+++ /dev/null
@@ -1,201 +0,0 @@
-From 90b202b59fa2bdb68314a23471b32d3e16602bc8 Mon Sep 17 00:00:00 2001
-From: Stafford Horne <shorne@gmail.com>
-Date: Sun, 2 May 2021 06:11:44 +0900
-Subject: [PATCH] or1k: Add mcmodel option to handle large GOTs
-
-When building libgeos we get an error with:
-
-    linux-uclibc/9.3.0/crtbeginS.o: in function `__do_global_dtors_aux':
-    crtstuff.c:(.text+0x118): relocation truncated to fit: R_OR1K_GOT16 against symbol `__cxa_finalize' defined in .text section in
-    /home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/or1k-buildroot-linux-uclibc/sysroot/lib/libc.so.
-
-This is caused by GOT code having a limit of 64k.  In OpenRISC this
-looks to be the only relocation code pattern to be limited to 64k.
-
-This patch allows specifying a new option -mcmodel=large which can be
-used to generate 2 more instructions to construct 32-bit addresses for
-up to 4G GOTs.
-
-gcc/ChangeLog:
-
-	PR 99783
-	* config/or1k/or1k-opts.h: New file.
-	* config/or1k/or1k.c (or1k_legitimize_address_1, print_reloc):
-	Support generating gotha relocations if -mcmodel=large is
-	specified.
-	* config/or1k/or1k.h (TARGET_CMODEL_SMALL, TARGET_CMODEL_LARGE):
-	New macros.
-	* config/or1k/or1k.opt (mcmodel=): New option.
-	* doc/invoke.text (OpenRISC Options): Document mcmodel.
-
-Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
----
- gcc/config/or1k/or1k-opts.h | 30 ++++++++++++++++++++++++++++++
- gcc/config/or1k/or1k.c      | 11 +++++++++--
- gcc/config/or1k/or1k.h      |  7 +++++++
- gcc/config/or1k/or1k.opt    | 19 +++++++++++++++++++
- gcc/doc/invoke.texi         | 13 ++++++++++++-
- 5 files changed, 77 insertions(+), 3 deletions(-)
- create mode 100644 gcc/config/or1k/or1k-opts.h
-
-diff --git a/gcc/config/or1k/or1k-opts.h b/gcc/config/or1k/or1k-opts.h
-new file mode 100644
-index 00000000000..f791b894fdd
---- /dev/null
-+++ b/gcc/config/or1k/or1k-opts.h
-@@ -0,0 +1,30 @@
-+/* Definitions for option handling for OpenRISC.
-+   Copyright (C) 2021 Free Software Foundation, Inc.
-+   Contributed by Stafford Horne.
-+
-+   This file is part of GCC.
-+
-+   GCC is free software; you can redistribute it and/or modify it
-+   under the terms of the GNU General Public License as published
-+   by the Free Software Foundation; either version 3, or (at your
-+   option) any later version.
-+
-+   GCC is distributed in the hope that it will be useful, but WITHOUT
-+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-+   License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with GCC; see the file COPYING3.  If not see
-+   <http://www.gnu.org/licenses/>.  */
-+
-+#ifndef GCC_OR1K_OPTS_H
-+#define GCC_OR1K_OPTS_H
-+
-+/* The OpenRISC code generation models available.  */
-+enum or1k_cmodel_type {
-+  CMODEL_SMALL,
-+  CMODEL_LARGE
-+};
-+
-+#endif /* GCC_OR1K_OPTS_H */
-diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c
-index fc10fcfabde..df67d72b139 100644
---- a/gcc/config/or1k/or1k.c
-+++ b/gcc/config/or1k/or1k.c
-@@ -750,7 +750,14 @@ or1k_legitimize_address_1 (rtx x, rtx scratch)
- 	    {
- 	      base = gen_sym_unspec (base, UNSPEC_GOT);
- 	      crtl->uses_pic_offset_table = 1;
--	      t2 = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, base);
-+	      if (TARGET_CMODEL_LARGE)
-+		{
-+	          emit_insn (gen_rtx_SET (t1, gen_rtx_HIGH (Pmode, base)));
-+	          emit_insn (gen_add3_insn (t1, t1, pic_offset_table_rtx));
-+	          t2 = gen_rtx_LO_SUM (Pmode, t1, base);
-+		}
-+	      else
-+	        t2 = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, base);
- 	      t2 = gen_const_mem (Pmode, t2);
- 	      emit_insn (gen_rtx_SET (t1, t2));
- 	      base = t1;
-@@ -1097,7 +1104,7 @@ print_reloc (FILE *stream, rtx x, HOST_WIDE_INT add, reloc_kind kind)
-      no special markup.  */
-   static const char * const relocs[RKIND_MAX][RTYPE_MAX] = {
-     { "lo", "got", "gotofflo", "tpofflo", "gottpofflo", "tlsgdlo" },
--    { "ha", NULL,  "gotoffha", "tpoffha", "gottpoffha", "tlsgdhi" },
-+    { "ha", "gotha", "gotoffha", "tpoffha", "gottpoffha", "tlsgdhi" },
-   };
-   reloc_type type = RTYPE_DIRECT;
- 
-diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h
-index feee702d89c..dbaf0d0fe4c 100644
---- a/gcc/config/or1k/or1k.h
-+++ b/gcc/config/or1k/or1k.h
-@@ -21,6 +21,8 @@
- #ifndef GCC_OR1K_H
- #define GCC_OR1K_H
- 
-+#include "config/or1k/or1k-opts.h"
-+
- /* Names to predefine in the preprocessor for this target machine.  */
- #define TARGET_CPU_CPP_BUILTINS()		\
-   do						\
-@@ -35,6 +37,11 @@
-     }						\
-   while (0)
- 
-+#define TARGET_CMODEL_SMALL \
-+  (or1k_code_model == CMODEL_SMALL)
-+#define TARGET_CMODEL_LARGE \
-+  (or1k_code_model == CMODEL_LARGE)
-+
- /* Storage layout.  */
- 
- #define DEFAULT_SIGNED_CHAR 1
-diff --git a/gcc/config/or1k/or1k.opt b/gcc/config/or1k/or1k.opt
-index 7bdbd842dd4..116524c3441 100644
---- a/gcc/config/or1k/or1k.opt
-+++ b/gcc/config/or1k/or1k.opt
-@@ -23,6 +23,9 @@
- 
- ; Please try to keep this file in ASCII collating order.
- 
-+HeaderInclude
-+config/or1k/or1k-opts.h
-+
- mhard-div
- Target RejectNegative InverseMask(SOFT_DIV)
- Use hardware divide instructions, use -msoft-div for emulation.
-@@ -31,6 +34,22 @@ mhard-mul
- Target RejectNegative InverseMask(SOFT_MUL).
- Use hardware multiply instructions, use -msoft-mul for emulation.
- 
-+mcmodel=
-+Target RejectNegative Joined Enum(or1k_cmodel_type) Var(or1k_code_model) Init(CMODEL_SMALL)
-+Specify the code model used for accessing memory addresses.  Specifying large
-+enables generating binaries with large global offset tables.  By default the
-+value is small.
-+
-+Enum
-+Name(or1k_cmodel_type) Type(enum or1k_cmodel_type)
-+Known code model types (for use with the -mcmodel= option):
-+
-+EnumValue
-+Enum(or1k_cmodel_type) String(small) Value(CMODEL_SMALL)
-+
-+EnumValue
-+Enum(or1k_cmodel_type) String(large) Value(CMODEL_LARGE)
-+
- mcmov
- Target RejectNegative Mask(CMOV)
- Allows generation of binaries which use the l.cmov instruction.  If your target
-diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index 7b5f6e03d9f..683c64417af 100644
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -1032,7 +1032,9 @@ Objective-C and Objective-C++ Dialects}.
- @emph{OpenRISC Options}
- @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
- -msoft-mul  -msoft-div @gol
---mcmov  -mror  -msext  -msfimm  -mshftimm}
-+-mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm @gol
-+-mcmodel=@var{code-model}}
-+
- 
- @emph{PDP-11 Options}
- @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
-@@ -27462,6 +27464,15 @@ MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
- SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
- instruction set extensions.)
- 
-+@item -mcmodel=small
-+@opindex mcmodel=small
-+Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
-+the default model.
-+
-+@item -mcmodel=large
-+@opindex mcmodel=large
-+Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
-+
- 
- @item btver1
- CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
--- 
-2.31.1
-
diff --git a/package/gcc/9.4.0/0005-or1k-Use-cmodel-large-when-building-crtstuff.patch b/package/gcc/9.4.0/0005-or1k-Use-cmodel-large-when-building-crtstuff.patch
deleted file mode 100644
index 69d143349a..0000000000
--- a/package/gcc/9.4.0/0005-or1k-Use-cmodel-large-when-building-crtstuff.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From d64a757040fe36b0d9dc65d24107c656f66bc8e5 Mon Sep 17 00:00:00 2001
-From: Stafford Horne <shorne@gmail.com>
-Date: Sun, 2 May 2021 06:11:45 +0900
-Subject: [PATCH] or1k: Use cmodel=large when building crtstuff
-
-When linking gcc runtime objects into large binaries the link may fail
-with the below errors.  This will happen even if we are building with
--mcmodel=large.
-
-    /home/shorne/work/openrisc/output/host/lib/gcc/or1k-buildroot-linux-uclibc/10.3.0/crtbeginS.o: in function `deregister_tm_clones':
-    crtstuff.c:(.text+0x3c): relocation truncated to fit: R_OR1K_GOT16 against undefined symbol `_ITM_deregisterTMCloneTable'
-    /home/shorne/work/openrisc/output/host/lib/gcc/or1k-buildroot-linux-uclibc/10.3.0/crtbeginS.o: in function `register_tm_clones':
-    crtstuff.c:(.text+0xc0): relocation truncated to fit: R_OR1K_GOT16 against undefined symbol `_ITM_registerTMCloneTable'
-
-This patch builds the gcc crtstuff binaries always with the
--mcmodel=large option to ensure they can be linked into large binaries.
-
-libgcc/ChangeLog:
-
-	PR 99783
-	* config.host (or1k-*, tmake_file): Add or1k/t-crtstuff.
-	* config/or1k/t-crtstuff: New file.
-
-Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
----
- libgcc/config.host            | 4 ++--
- libgcc/config/or1k/t-crtstuff | 2 ++
- 2 files changed, 4 insertions(+), 2 deletions(-)
- create mode 100644 libgcc/config/or1k/t-crtstuff
-
-diff --git a/libgcc/config.host b/libgcc/config.host
-index bdbf77a3e62..bfb45a90630 100644
---- a/libgcc/config.host
-+++ b/libgcc/config.host
-@@ -1061,12 +1061,12 @@ nios2-*-*)
- 	extra_parts="$extra_parts crti.o crtn.o"
- 	;;
- or1k-*-linux*)
--	tmake_file="$tmake_file or1k/t-or1k"
-+	tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff"
- 	tmake_file="$tmake_file t-softfp-sfdf t-softfp"
- 	md_unwind_header=or1k/linux-unwind.h
- 	;;
- or1k-*-*)
--	tmake_file="$tmake_file or1k/t-or1k"
-+	tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff"
- 	tmake_file="$tmake_file t-softfp-sfdf t-softfp"
- 	;;
- pdp11-*-*)
-diff --git a/libgcc/config/or1k/t-crtstuff b/libgcc/config/or1k/t-crtstuff
-new file mode 100644
-index 00000000000..dcae7f3498e
---- /dev/null
-+++ b/libgcc/config/or1k/t-crtstuff
-@@ -0,0 +1,2 @@
-+# Compile crtbeginS.o and crtendS.o with -mcmodel=large
-+CRTSTUFF_T_CFLAGS_S += -mcmodel=large
--- 
-2.31.1
-
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 10061dbc9d..18e4a483df 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -21,20 +21,6 @@ config BR2_GCC_VERSION_POWERPC_SPE
 	depends on BR2_powerpc_SPE
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_8
 
-config BR2_GCC_VERSION_9_X
-	bool "gcc 9.x"
-	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_10
-	# powerpc spe support has been deprecated since gcc 8.x.
-	# https://gcc.gnu.org/ml/gcc/2018-04/msg00102.html
-	depends on !BR2_powerpc_SPE
-	# C-SKY sk610 needs abiv1, which is not supported in
-	# upstream gcc. C-SKY gcc upstream support not tested
-	# with upstream binutils and glibc.
-	depends on !BR2_csky
-	# ARC HS48 rel 31 only supported by gcc arc fork.
-	depends on !BR2_archs4x_rel31
-	select BR2_TOOLCHAIN_GCC_AT_LEAST_9
-
 config BR2_GCC_VERSION_10_X
 	bool "gcc 10.x"
 	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_11
@@ -99,7 +85,6 @@ config BR2_GCC_SUPPORTS_DLANG
 config BR2_GCC_VERSION
 	string
 	default "8.4.0"     if BR2_GCC_VERSION_POWERPC_SPE
-	default "9.4.0"     if BR2_GCC_VERSION_9_X
 	default "10.3.0"    if BR2_GCC_VERSION_10_X
 	default "11.3.0"    if BR2_GCC_VERSION_11_X
 	default "12.1.0"    if BR2_GCC_VERSION_12_X
diff --git a/package/gcc/gcc.hash b/package/gcc/gcc.hash
index dc19c282c2..b1cfb1c9cf 100644
--- a/package/gcc/gcc.hash
+++ b/package/gcc/gcc.hash
@@ -1,7 +1,5 @@
 # From https://gcc.gnu.org/pub/gcc/releases/gcc-8.4.0/sha512.sum
 sha512  6de904f552a02de33b11ef52312bb664396efd7e1ce3bbe37bfad5ef617f133095b3767b4804bc7fe78df335cb53bc83f1ac055baed40979ce4c2c3e46b70280  gcc-8.4.0.tar.xz
-#  From https://gcc.gnu.org/pub/gcc/releases/gcc-9.4.0/sha512.sum
-sha512  dfd3500bf21784b8351a522d53463cf362ede66b0bc302edf350bb44e94418497a8b4b797b6af8ca9b2eeb746b3b115d9c3698381b989546e9151b4496415624  gcc-9.4.0.tar.xz
 # From https://gcc.gnu.org/pub/gcc/releases/gcc-10.3.0/sha512.sum
 sha512  2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86  gcc-10.3.0.tar.xz
 # From https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/sha512.sum
-- 
2.35.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12 Romain Naour
@ 2022-06-25  6:45   ` James Hilliard
  2022-07-16 11:31     ` Romain Naour
  0 siblings, 1 reply; 21+ messages in thread
From: James Hilliard @ 2022-06-25  6:45 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Sun, May 29, 2022 at 7:20 AM Romain Naour <romain.naour@gmail.com> wrote:
>
> https://gcc.gnu.org/gcc-12/changes.html
> https://gcc.gnu.org/gcc-12/porting_to.html
>
> Tested with toolchain-builder:
> https://gitlab.com/kubu93/toolchains-builder/-/pipelines/550404957
>
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
Tested-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>  package/gcc/Config.in.host | 14 ++++++++++++++
>  package/gcc/gcc.hash       |  2 ++
>  2 files changed, 16 insertions(+)
>
> diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
> index 06f83d8f87..bcf0743b23 100644
> --- a/package/gcc/Config.in.host
> +++ b/package/gcc/Config.in.host
> @@ -62,6 +62,19 @@ config BR2_GCC_VERSION_11_X
>         depends on !BR2_archs4x_rel31
>         select BR2_TOOLCHAIN_GCC_AT_LEAST_11
>
> +config BR2_GCC_VERSION_12_X
> +       bool "gcc 12.x"
> +       # powerpc spe support has been deprecated since gcc 8.x.
> +       # https://gcc.gnu.org/ml/gcc/2018-04/msg00102.html
> +       depends on !BR2_powerpc_SPE
> +       # uClibc-ng broken on sparc due to recent gcc changes
> +       # that need to be reverted since gcc 8.4, 9.3 and 10.1.
> +       # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
> +       depends on !BR2_sparc
> +       # ARC HS48 rel 31 only supported by gcc arc fork.
> +       depends on !BR2_archs4x_rel31
> +       select BR2_TOOLCHAIN_GCC_AT_LEAST_12
> +
>  endchoice
>
>  # libcilkrts was introduced in gcc 4.9 and removed in gcc 8.x
> @@ -88,6 +101,7 @@ config BR2_GCC_VERSION
>         default "9.4.0"     if BR2_GCC_VERSION_9_X
>         default "10.3.0"    if BR2_GCC_VERSION_10_X
>         default "11.3.0"    if BR2_GCC_VERSION_11_X
> +       default "12.1.0"    if BR2_GCC_VERSION_12_X
>         default "arc-2020.09-release" if BR2_GCC_VERSION_ARC
>
>  config BR2_EXTRA_GCC_CONFIG_OPTIONS
> diff --git a/package/gcc/gcc.hash b/package/gcc/gcc.hash
> index e364be0a06..dc19c282c2 100644
> --- a/package/gcc/gcc.hash
> +++ b/package/gcc/gcc.hash
> @@ -6,6 +6,8 @@ sha512  dfd3500bf21784b8351a522d53463cf362ede66b0bc302edf350bb44e94418497a8b4b79
>  sha512  2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86  gcc-10.3.0.tar.xz
>  # From https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/sha512.sum
>  sha512  f0be5ad705c73b84477128a69c047f57dd47002f375eb60e1e842e08cf2009a509e92152bca345823926d550b7395ae6d4de7db51d1ee371c2dc37313881fca7  gcc-11.3.0.tar.xz
> +# From https://gcc.gnu.org/pub/gcc/releases/gcc-12.1.0/sha512.sum
> +sha512  2121d295292814a6761edf1fba08c5f633ebe16f52b80e7b73a91050e71e1d2ed98bf17eebad263e191879561c02b48906c53faa4c4670c486a26fc75df23900  gcc-12.1.0.tar.xz
>
>  # Locally calculated (fetched from Github)
>  sha512  b0853e2b1c5998044392023fa653e399e74118c46e616504ac59e1a2cf27620f94434767ce06b6cf4ca3dfb57f81d6eda92752befaf095ea5e564a9181b4659c  gcc-arc-2020.09-release.tar.gz
> --
> 2.35.3
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12
  2022-06-25  6:45   ` James Hilliard
@ 2022-07-16 11:31     ` Romain Naour
  0 siblings, 0 replies; 21+ messages in thread
From: Romain Naour @ 2022-07-16 11:31 UTC (permalink / raw)
  To: James Hilliard; +Cc: buildroot

Hello James,

Le 25/06/2022 à 08:45, James Hilliard a écrit :
> On Sun, May 29, 2022 at 7:20 AM Romain Naour <romain.naour@gmail.com> wrote:
>>
>> https://gcc.gnu.org/gcc-12/changes.html
>> https://gcc.gnu.org/gcc-12/porting_to.html
>>
>> Tested with toolchain-builder:
>> https://gitlab.com/kubu93/toolchains-builder/-/pipelines/550404957
>>
>> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Tested-by: James Hilliard <james.hilliard1@gmail.com>

Thanks for testing but previous patches in this series seems to be holding back
maintainers from merging gcc 12. If you have some time it would be nice if you
can review them.

Best regards,
Romain

>> ---
>>  package/gcc/Config.in.host | 14 ++++++++++++++
>>  package/gcc/gcc.hash       |  2 ++
>>  2 files changed, 16 insertions(+)
>>
>> diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
>> index 06f83d8f87..bcf0743b23 100644
>> --- a/package/gcc/Config.in.host
>> +++ b/package/gcc/Config.in.host
>> @@ -62,6 +62,19 @@ config BR2_GCC_VERSION_11_X
>>         depends on !BR2_archs4x_rel31
>>         select BR2_TOOLCHAIN_GCC_AT_LEAST_11
>>
>> +config BR2_GCC_VERSION_12_X
>> +       bool "gcc 12.x"
>> +       # powerpc spe support has been deprecated since gcc 8.x.
>> +       # https://gcc.gnu.org/ml/gcc/2018-04/msg00102.html
>> +       depends on !BR2_powerpc_SPE
>> +       # uClibc-ng broken on sparc due to recent gcc changes
>> +       # that need to be reverted since gcc 8.4, 9.3 and 10.1.
>> +       # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
>> +       depends on !BR2_sparc
>> +       # ARC HS48 rel 31 only supported by gcc arc fork.
>> +       depends on !BR2_archs4x_rel31
>> +       select BR2_TOOLCHAIN_GCC_AT_LEAST_12
>> +
>>  endchoice
>>
>>  # libcilkrts was introduced in gcc 4.9 and removed in gcc 8.x
>> @@ -88,6 +101,7 @@ config BR2_GCC_VERSION
>>         default "9.4.0"     if BR2_GCC_VERSION_9_X
>>         default "10.3.0"    if BR2_GCC_VERSION_10_X
>>         default "11.3.0"    if BR2_GCC_VERSION_11_X
>> +       default "12.1.0"    if BR2_GCC_VERSION_12_X
>>         default "arc-2020.09-release" if BR2_GCC_VERSION_ARC
>>
>>  config BR2_EXTRA_GCC_CONFIG_OPTIONS
>> diff --git a/package/gcc/gcc.hash b/package/gcc/gcc.hash
>> index e364be0a06..dc19c282c2 100644
>> --- a/package/gcc/gcc.hash
>> +++ b/package/gcc/gcc.hash
>> @@ -6,6 +6,8 @@ sha512  dfd3500bf21784b8351a522d53463cf362ede66b0bc302edf350bb44e94418497a8b4b79
>>  sha512  2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86  gcc-10.3.0.tar.xz
>>  # From https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/sha512.sum
>>  sha512  f0be5ad705c73b84477128a69c047f57dd47002f375eb60e1e842e08cf2009a509e92152bca345823926d550b7395ae6d4de7db51d1ee371c2dc37313881fca7  gcc-11.3.0.tar.xz
>> +# From https://gcc.gnu.org/pub/gcc/releases/gcc-12.1.0/sha512.sum
>> +sha512  2121d295292814a6761edf1fba08c5f633ebe16f52b80e7b73a91050e71e1d2ed98bf17eebad263e191879561c02b48906c53faa4c4670c486a26fc75df23900  gcc-12.1.0.tar.xz
>>
>>  # Locally calculated (fetched from Github)
>>  sha512  b0853e2b1c5998044392023fa653e399e74118c46e616504ac59e1a2cf27620f94434767ce06b6cf4ca3dfb57f81d6eda92752befaf095ea5e564a9181b4659c  gcc-arc-2020.09-release.tar.gz
>> --
>> 2.35.3
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions
  2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
                   ` (9 preceding siblings ...)
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 11/11] package/gcc: remove gcc 9.x Romain Naour
@ 2022-07-23 12:39 ` Thomas Petazzoni via buildroot
  2022-07-23 13:00   ` Romain Naour
  10 siblings, 1 reply; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-23 12:39 UTC (permalink / raw)
  To: Romain Naour; +Cc: Mark Corbin, buildroot

Hello Romain,

On Sun, 29 May 2022 15:18:01 +0200
Romain Naour <romain.naour@gmail.com> wrote:

> Since gcc 12, default Riscv ISA spec version was bump to 20191213 [1].
> 
> This introduce a major incompatibility issue is the csr read/write
> (csrr*/csrw*) instructions and fence.i instruction has separated from
> the "I" extension, become two standalone extensions: Zicsr and
> Zifencei; so you might get error messages like that: unrecognized
> opcode "csrr" (or "fence.i").
> 
> Indeed, without Zifencei we can't build opensbi bootloader [3]:
> 
> opensbi-1.0/lib/sbi/sbi_tlb.c: Assembler messages:
> opensbi-1.0/lib/sbi/sbi_tlb.c:190: Error: unrecognized opcode `fence.i', extension `zifencei' required
> 
> As a workaround, opensbi build system has been patched [4] to use
> -march=rv64imafdc_zicsr_zifencei when needed.
> This workaround doesn't work in Buildroot due to the local patch
> 0001-Makefile-Don-t-specify-mabi-or-march.patch removing -march
> from CFLAGS.
> 
> Fix this issue by introducing two additional Kconfig option
> enabling Zicsr and Zifencei standalone extensions for gcc >= 12
> as recommanded by [2].
> 
> Select Zicsr and Zifencei for General purpose (G) architecture variant
> (BR2_riscv_g) since theses extentions were implicitely enabled
> previously.
> 
> [1] https://gcc.gnu.org/gcc-12/changes.html
> [2] https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/aE1ZeHHCYf4
> [3] https://github.com/riscv-software-src/opensbi/blob/v0.9/lib/sbi/sbi_tlb.c#L173
> [4] https://github.com/riscv-software-src/opensbi/commit/5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Mark Corbin <mark@dibsco.co.uk>

Thanks for the patch and explanation, but I'm wondering if this isn't
perhaps too complicated.


> +	select BR2_RISCV_ISA_RVZicsr if BR2_TOOLCHAIN_GCC_AT_LEAST_12
> +	select BR2_RISCV_ISA_RVZifencei if BR2_TOOLCHAIN_GCC_AT_LEAST_12

[...]

>  	help
> -	  General purpose (G) is equivalent to IMAFD.
> +	  General purpose (G) is equivalent to IMAFD
> +	  (with Zicsr and Zifencei since gcc >= 12).
>  
>  config BR2_riscv_custom
>  	bool "Custom architecture"
> @@ -63,6 +72,16 @@ config BR2_RISCV_ISA_CUSTOM_RVD
>  config BR2_RISCV_ISA_CUSTOM_RVC
>  	bool "Compressed Instructions (C)"
>  	select BR2_RISCV_ISA_RVC
> +
> +if BR2_TOOLCHAIN_GCC_AT_LEAST_12

The problem with this is that options in arch/ now depend on the gcc
version that is selected, which is something we have tried to avoid.

Do a git grep GCC_AT_LEAST in arch/, you will see that we only use
"select BR2_ARCH_NEEDS_GCC_AT_LEAST_xyz", i.e the choice of the
architecture/variant/ABI is what drives the available gcc versions.

And here you are doing exactly the opposite: it's the selected gcc
version that drives the architecture/variant/ABI options that are
available.

At this point, I don't really see the need from a Buildroot perspective
to separate icsr and ifencei from the base BR2_RISCV_ISA_RVI
instruction set.

So what I would do is exactly what OpenSBI has done in
https://github.com/riscv-software-src/opensbi/commit/5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c:
when gcc >= 12 is used, we simply use -march with a _zicsr_zifencei
suffix, and that's it.

I.e something like this:

diff --git a/arch/arch.mk.riscv b/arch/arch.mk.riscv
index f3bf2b3467..d77f88dd70 100644
--- a/arch/arch.mk.riscv
+++ b/arch/arch.mk.riscv
@@ -27,4 +27,8 @@ ifeq ($(BR2_RISCV_ISA_RVC),y)
 GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c
 endif
 
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_12),y)
+GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)_zicsr_zifencei
+endif
+
 endif

I don't think we will see RISC-V cores running Linux that support the
base I instruction, but not the csr and fence extensions... as even
OpenSBI assumes the RISC-V core supports them!

What do you think?

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 03/11] package/gcc: disable libsanitizer for mips64{el} w/ n32 ABI
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 03/11] package/gcc: disable libsanitizer for mips64{el} w/ n32 ABI Romain Naour
@ 2022-07-23 12:41   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-23 12:41 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Sun, 29 May 2022 15:18:03 +0200
Romain Naour <romain.naour@gmail.com> wrote:

> libsanitizer has been enabled for mips64{el} in gcc 12 [1] but it
> fail to build when n32 ABI is used:
> 
> In file included from output/mips64el-buildroot-linux-gnu/sysroot/usr/include/bits/stat.h:25,
>                  from output/mips64el-buildroot-linux-gnu/sysroot/usr/include/fcntl.h:78,
>                  from ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cpp:55:
> output/mips64el-buildroot-linux-gnu/sysroot/usr/include/bits/struct_stat.h:190:8: error: redefinition of ‘struct stat64’
>   190 | struct stat64
>       |        ^~~~~~
> 
> In file included from ../../../../libsanitizer/sanitizer_common/sanitizer_linux.cpp:49:
> output/mips64el-buildroot-linux-gnu/sysroot/usr/include/asm/stat.h:52:8: note: previous definition of ‘struct stat64’
>    52 | struct stat64 {
>       |        ^~~~~~
> 
> Disable libsanitizer for mips64 with n32 ABI.
> 
> Note: Only glibc toolchains are affected since libsanitizer is
> disabled for musl and uClibc-ng toolchains [2].
> 
> Fixes:
> https://gitlab.com/kubu93/toolchains-builder/-/jobs/2510178651
> 
> [1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=344e6f9f2abcff9b2bb4b26b693be4a599272f43
> [2] https://git.buildroot.net/buildroot/commit/?id=5f4d658d888b539de9a6247ae5b1a0999de5d4ec

Has this issue been reported to upstream gcc?

>  package/gcc/gcc.mk | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
> index b940327c83..e1f3935e56 100644
> --- a/package/gcc/gcc.mk
> +++ b/package/gcc/gcc.mk
> @@ -138,6 +138,13 @@ ifeq ($(BR2_sparc)$(BR2_sparc64),y)
>  HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
>  endif
>  
> +# libsanitizer is available for mips64{el} since gcc 12 but fail to build
> +# with n32 ABI due to struct stat64 definition clash due to mixing
> +# kernel and user headers.
> +ifeq ($(BR2_mips64)$(BR2_mips64el)$(BR2_MIPS_NABI32),yy)

Minor nit, perhaps:

ifeq ($(BR2_mips64)$(BR2_mips64el):$(BR2_MIPS_NABI32),y:y)

so it's absolutely clear how this works.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next  02/11] configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 02/11] configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43 Romain Naour
@ 2022-07-23 12:57   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-23 12:57 UTC (permalink / raw)
  To: Romain Naour; +Cc: Mark Corbin, buildroot

On Sun, 29 May 2022 15:18:02 +0200
Romain Naour <romain.naour@gmail.com> wrote:

> To build this defconfig with gcc 12, we need a patch from v5.15.24 [1]
> fixing the build with gcc 12.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7486227fa47aa84b102be18fd9985f6e8e11e756
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Mark Corbin <mark@dibsco.co.uk>
> ---
> The issue fixed by [1] can also be trigged with gcc 12 and binutils 2.37.
> ---
>  configs/qemu_riscv32_virt_defconfig | 2 +-
>  configs/qemu_riscv64_virt_defconfig | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 05/11] toolchain: enable libquadmath for PowerPC with VSX
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 05/11] toolchain: enable libquadmath for PowerPC with VSX Romain Naour
@ 2022-07-23 12:57   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-23 12:57 UTC (permalink / raw)
  To: Romain Naour; +Cc: Cédric Le Goater, Cyril Bur, buildroot

On Sun, 29 May 2022 15:18:05 +0200
Romain Naour <romain.naour@gmail.com> wrote:

> float128 is available on PowerPC with VSX [1] but it requires
> libquadmath support.
> 
> [1] https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Floating-Types.html
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Cyril Bur <cyrilbur@gmail.com>
> Cc: Cédric Le Goater <clg@kaod.org>
> ---
>  toolchain/Config.in | 2 ++
>  1 file changed, 2 insertions(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 06/11] package/gcc: add missing --enable-libquadmath-support option
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 06/11] package/gcc: add missing --enable-libquadmath-support option Romain Naour
@ 2022-07-23 12:57   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-23 12:57 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Sun, 29 May 2022 15:18:06 +0200
Romain Naour <romain.naour@gmail.com> wrote:

> When BR2_TOOLCHAIN_HAS_LIBQUADMATH is set, --enable-libquadmath-support
> option is missing. So the float128 support is not fully enabled in gcc.
> 
> This lead to a build issue with gcc 12 on PowerPC power8 due to missing
> M_2_SQRTPIq definition (provided by libquadmath.h).
> 
> ../../../libgfortran/intrinsics/erfc_scaled.c: In function ‘erfc_scaled_r17’:
> ../../../libgfortran/intrinsics/erfc_scaled.c:143:22: error: ‘M_2_SQRTPIq’ undeclared (first use in this function); did you mean ‘M_2_SQRTPIf’?
>   143 | # define _M_2_SQRTPI M_2_SQRTPIq
>       |                      ^~~~~~~~~~~
> 
> This is fixed by adding --enable-libquadmath-support (like crosstool-ng
> handling [1]).
> 
> Fixes:
> https://gitlab.com/kubu93/toolchains-builder/-/jobs/2510178766
> 
> [1] https://github.com/crosstool-ng/crosstool-ng/blob/crosstool-ng-1.25.0/scripts/build/cc/gcc.sh#L370
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> ---
>  package/gcc/gcc.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 07/11] package/gcc: switch to https urls for archives hashes
  2022-05-29 13:18 ` [Buildroot] [PATCH for-next 07/11] package/gcc: switch to https urls for archives hashes Romain Naour
@ 2022-07-23 12:57   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-23 12:57 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Sun, 29 May 2022 15:18:07 +0200
Romain Naour <romain.naour@gmail.com> wrote:

> FTP urls doesn't work anymore with Firefox [1] and Google Chrome [2],
> switch to https urls.
> 
> [1] https://blog.mozilla.org/addons/2020/04/13/what-to-expect-for-the-upcoming-deprecation-of-ftp-in-firefox/
> [2] https://chromestatus.com/feature/6246151319715840
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> ---
>  package/gcc/gcc.hash | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions
  2022-07-23 12:39 ` [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Thomas Petazzoni via buildroot
@ 2022-07-23 13:00   ` Romain Naour
  2022-07-23 13:25     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 21+ messages in thread
From: Romain Naour @ 2022-07-23 13:00 UTC (permalink / raw)
  To: Thomas Petazzoni, Romain Naour; +Cc: Mark Corbin, buildroot

Hello Thomas,

Le 23/07/2022 à 14:39, Thomas Petazzoni via buildroot a écrit :
> Hello Romain,
> 
> On Sun, 29 May 2022 15:18:01 +0200
> Romain Naour <romain.naour@gmail.com> wrote:
> 
>> Since gcc 12, default Riscv ISA spec version was bump to 20191213 [1].
>>
>> This introduce a major incompatibility issue is the csr read/write
>> (csrr*/csrw*) instructions and fence.i instruction has separated from
>> the "I" extension, become two standalone extensions: Zicsr and
>> Zifencei; so you might get error messages like that: unrecognized
>> opcode "csrr" (or "fence.i").
>>
>> Indeed, without Zifencei we can't build opensbi bootloader [3]:
>>
>> opensbi-1.0/lib/sbi/sbi_tlb.c: Assembler messages:
>> opensbi-1.0/lib/sbi/sbi_tlb.c:190: Error: unrecognized opcode `fence.i', extension `zifencei' required
>>
>> As a workaround, opensbi build system has been patched [4] to use
>> -march=rv64imafdc_zicsr_zifencei when needed.
>> This workaround doesn't work in Buildroot due to the local patch
>> 0001-Makefile-Don-t-specify-mabi-or-march.patch removing -march
>> from CFLAGS.
>>
>> Fix this issue by introducing two additional Kconfig option
>> enabling Zicsr and Zifencei standalone extensions for gcc >= 12
>> as recommanded by [2].
>>
>> Select Zicsr and Zifencei for General purpose (G) architecture variant
>> (BR2_riscv_g) since theses extentions were implicitely enabled
>> previously.
>>
>> [1] https://gcc.gnu.org/gcc-12/changes.html
>> [2] https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/aE1ZeHHCYf4
>> [3] https://github.com/riscv-software-src/opensbi/blob/v0.9/lib/sbi/sbi_tlb.c#L173
>> [4] https://github.com/riscv-software-src/opensbi/commit/5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c
>>
>> Signed-off-by: Romain Naour <romain.naour@gmail.com>
>> Cc: Mark Corbin <mark@dibsco.co.uk>
> 
> Thanks for the patch and explanation, but I'm wondering if this isn't
> perhaps too complicated.
> 
> 
>> +	select BR2_RISCV_ISA_RVZicsr if BR2_TOOLCHAIN_GCC_AT_LEAST_12
>> +	select BR2_RISCV_ISA_RVZifencei if BR2_TOOLCHAIN_GCC_AT_LEAST_12
> 
> [...]
> 
>>  	help
>> -	  General purpose (G) is equivalent to IMAFD.
>> +	  General purpose (G) is equivalent to IMAFD
>> +	  (with Zicsr and Zifencei since gcc >= 12).
>>  
>>  config BR2_riscv_custom
>>  	bool "Custom architecture"
>> @@ -63,6 +72,16 @@ config BR2_RISCV_ISA_CUSTOM_RVD
>>  config BR2_RISCV_ISA_CUSTOM_RVC
>>  	bool "Compressed Instructions (C)"
>>  	select BR2_RISCV_ISA_RVC
>> +
>> +if BR2_TOOLCHAIN_GCC_AT_LEAST_12
> 
> The problem with this is that options in arch/ now depend on the gcc
> version that is selected, which is something we have tried to avoid.
> 
> Do a git grep GCC_AT_LEAST in arch/, you will see that we only use
> "select BR2_ARCH_NEEDS_GCC_AT_LEAST_xyz", i.e the choice of the
> architecture/variant/ABI is what drives the available gcc versions.
> 
> And here you are doing exactly the opposite: it's the selected gcc
> version that drives the architecture/variant/ABI options that are
> available.
> 
> At this point, I don't really see the need from a Buildroot perspective
> to separate icsr and ifencei from the base BR2_RISCV_ISA_RVI
> instruction set.
> 
> So what I would do is exactly what OpenSBI has done in
> https://github.com/riscv-software-src/opensbi/commit/5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c:
> when gcc >= 12 is used, we simply use -march with a _zicsr_zifencei
> suffix, and that's it.
> 
> I.e something like this:
> 
> diff --git a/arch/arch.mk.riscv b/arch/arch.mk.riscv
> index f3bf2b3467..d77f88dd70 100644
> --- a/arch/arch.mk.riscv
> +++ b/arch/arch.mk.riscv
> @@ -27,4 +27,8 @@ ifeq ($(BR2_RISCV_ISA_RVC),y)
>  GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c
>  endif
>  
> +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_12),y)
> +GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)_zicsr_zifencei
> +endif
> +
>  endif
> 
> I don't think we will see RISC-V cores running Linux that support the
> base I instruction, but not the csr and fence extensions... as even
> OpenSBI assumes the RISC-V core supports them!
> 
> What do you think?

Thanks for the review!

I'm not familiar with the riscv instruction set, so I was not sure if we should
support the possibility to disable Zicsr and Zifencei standalone extensions with
gcc 12. AFIU, they are unconditionally enabled in previous gcc releases.

Additionally we have received two patches to add "vector operations extension"

http://patchwork.ozlabs.org/project/buildroot/patch/20220704085552.3499243-2-abel@x-silicon.com/

http://patchwork.ozlabs.org/project/buildroot/patch/20220627135359.2232222-1-fhunleth@troodon-software.com/

But this requires gcc-12

http://patchwork.ozlabs.org/project/buildroot/patch/20220627135359.2232222-1-fhunleth@troodon-software.com/#2933736

Do you think "Vector Instructions (V)" deserve an option ? (I would say yes).

Best regards,
Romain


> 
> Thomas

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions
  2022-07-23 13:00   ` Romain Naour
@ 2022-07-23 13:25     ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-23 13:25 UTC (permalink / raw)
  To: Romain Naour; +Cc: Romain Naour, Mark Corbin, buildroot

Hello,

On Sat, 23 Jul 2022 15:00:40 +0200
Romain Naour <romain.naour@smile.fr> wrote:

> I'm not familiar with the riscv instruction set, so I was not sure if we should
> support the possibility to disable Zicsr and Zifencei standalone extensions with
> gcc 12. AFIU, they are unconditionally enabled in previous gcc releases.

Correct, which is why I think they will always be present in
Linux-capable RISC-V cores. The reason I believe they were split from
the I part of the ISA is because I is the base part of the ISA, and
some people wanted to make RISC-V designs without those instructions,
but not RISC-V designs targeting Linux.

So for now, I think we should simply make the assumption that all
RISC-V cores will have those instructions.

If that turns out to be wrong in the future, we can always revisit that.

> Additionally we have received two patches to add "vector operations extension"
> 
> http://patchwork.ozlabs.org/project/buildroot/patch/20220704085552.3499243-2-abel@x-silicon.com/
> 
> http://patchwork.ozlabs.org/project/buildroot/patch/20220627135359.2232222-1-fhunleth@troodon-software.com/
> 
> But this requires gcc-12
> 
> http://patchwork.ozlabs.org/project/buildroot/patch/20220627135359.2232222-1-fhunleth@troodon-software.com/#2933736
> 
> Do you think "Vector Instructions (V)" deserve an option ? (I would say yes).

Yes, V definitely needs an option, as there will clearly be
Linux-capable RISC-V cores that do not implement the V extension.

The option for the V extension will have to select
BR2_ARCH_NEEDS_GCC_AT_LEAST_12.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-07-23 13:25 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-29 13:18 [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Romain Naour
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 02/11] configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43 Romain Naour
2022-07-23 12:57   ` Thomas Petazzoni via buildroot
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 03/11] package/gcc: disable libsanitizer for mips64{el} w/ n32 ABI Romain Naour
2022-07-23 12:41   ` Thomas Petazzoni via buildroot
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 04/11] package/gcc: disable libsanitizer for mips{el} and gcc > 12 Romain Naour
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 05/11] toolchain: enable libquadmath for PowerPC with VSX Romain Naour
2022-07-23 12:57   ` Thomas Petazzoni via buildroot
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 06/11] package/gcc: add missing --enable-libquadmath-support option Romain Naour
2022-07-23 12:57   ` Thomas Petazzoni via buildroot
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 07/11] package/gcc: switch to https urls for archives hashes Romain Naour
2022-07-23 12:57   ` Thomas Petazzoni via buildroot
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12 Romain Naour
2022-06-25  6:45   ` James Hilliard
2022-07-16 11:31     ` Romain Naour
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 09/11] arch: add BR2_ARCH_NEEDS_GCC_AT_LEAST_12 Romain Naour
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 10/11] package/gcc: switch to gcc 11.x as the default Romain Naour
2022-05-29 13:18 ` [Buildroot] [PATCH for-next 11/11] package/gcc: remove gcc 9.x Romain Naour
2022-07-23 12:39 ` [Buildroot] [PATCH for-next 01/11] arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions Thomas Petazzoni via buildroot
2022-07-23 13:00   ` Romain Naour
2022-07-23 13:25     ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.