Skip to contentSkip to conversation

arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions

PATCH Applied Romain Naour 4 participants 21 messages May 29, 2022 – Jul 23, 2022 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/11 arch/Config.in.riscv: add Zicsr and Zifencei standalone extensions

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

---
 arch/Config.in.riscv | 21 ++++++++++++++++++++-
 arch/arch.mk.riscv   |  6 ++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
arch/Config.in.riscv +20 -1
index 288ed833eb..91feea0918 100644
@@ -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
arch/arch.mk.riscv +6 -0
index f3bf2b3467..294a5f90a9 100644
@@ -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
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/11 configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43

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

---
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(-)
configs/qemu_riscv32_virt_defconfig +1 -1
index dff87ef342..faf4e1e312 100644
@@ -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
 
configs/qemu_riscv64_virt_defconfig +1 -1
index d67d070185..c455680ee0 100644
@@ -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
 
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH for-next 02/11] configs/qemu_riscv{32, 64}_virt: kernel bump version to 5.15.43

Quoted 5 lines · On Sun, 29 May 2022 15:18:02 +0200 Romain Naour <[email protected]> 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

Quoted 8 lines

---
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

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

PATCH 3/11 package/gcc: disable libsanitizer for mips64{el} w/ n32 ABI

In reply to 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

---
 package/gcc/gcc.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/gcc/gcc.mk +7 -0
index b940327c83..e1f3935e56 100644
@@ -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
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH for-next 03/11] package/gcc: disable libsanitizer for mips64{el} w/ n32 ABI

Quoted 17 lines · On Sun, 29 May 2022 15:18:03 +0200 Romain Naour <[email protected]> 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.

Quoted 8 lines

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?

Quoted 8 lines
 package/gcc/gcc.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/gcc/gcc.mk +0 -0
index b940327c83..e1f3935e56 100644

package/gcc/gcc.mk ifeq ($(BR2_sparc)$(BR2_sparc64),y) · line 144

Quoted 7 lines
package/gcc/gcc.mk +4 -0
@@ -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

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH 4/11 package/gcc: disable libsanitizer for mips{el} and gcc > 12

In reply to 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

---
 package/gcc/gcc.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/gcc/gcc.mk +6 -0
index e1f3935e56..73440e9e35 100644
@@ -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
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

PATCH 5/11 toolchain: enable libquadmath for PowerPC with VSX

In reply to Romain Naour

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

Cc Cyril Bur <[email protected]>
Cc Cédric Le Goater <[email protected]>
---
 toolchain/Config.in | 2 ++
 1 file changed, 2 insertions(+)
toolchain/Config.in +2 -0
index 73ea78624a..7e129e58d3 100644
@@ -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
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Re: [Buildroot] [PATCH for-next 05/11] toolchain: enable libquadmath for PowerPC with VSX

Quoted 11 lines · On Sun, 29 May 2022 15:18:05 +0200 Romain Naour <[email protected]> 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

Cc Cyril Bur <[email protected]>
Cc Cédric Le Goater <[email protected]>
---
 toolchain/Config.in | 2 ++
 1 file changed, 2 insertions(+)

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

PATCH 6/11 package/gcc: add missing --enable-libquadmath-support option

In reply to 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

---
 package/gcc/gcc.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/gcc/gcc.mk +1 -1
index 73440e9e35..c3c1df833b 100644
@@ -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
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

Re: [Buildroot] [PATCH for-next 06/11] package/gcc: add missing --enable-libquadmath-support option

Quoted 17 lines · On Sun, 29 May 2022 15:18:06 +0200 Romain Naour <[email protected]> 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

Quoted 6 lines

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

---
 package/gcc/gcc.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

PATCH 7/11 package/gcc: switch to https urls for archives hashes

In reply to 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

---
 package/gcc/gcc.hash | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
package/gcc/gcc.hash +4 -4
index ad8bae4a99..e364be0a06 100644
@@ -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)
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#11 lore raw

Re: [Buildroot] [PATCH for-next 07/11] package/gcc: switch to https urls for archives hashes

Quoted 10 lines · On Sun, 29 May 2022 15:18:07 +0200 Romain Naour <[email protected]> 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

---
 package/gcc/gcc.hash | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#12 lore raw

PATCH 8/11 package/gcc: add support for gcc 12

In reply to 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

---
 package/gcc/Config.in.host | 14 ++++++++++++++
 package/gcc/gcc.hash       |  2 ++
 2 files changed, 16 insertions(+)
package/gcc/Config.in.host +14 -0
index 06f83d8f87..bcf0743b23 100644
@@ -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
package/gcc/gcc.hash +2 -0
index e364be0a06..dc19c282c2 100644
@@ -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
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Tested-by on v1 8/11
#13 lore raw

Re: [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12

Quoted 8 lines · 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

Quoted 53 lines
---
 package/gcc/Config.in.host | 14 ++++++++++++++
 package/gcc/gcc.hash       |  2 ++
 2 files changed, 16 insertions(+)
package/gcc/Config.in.host +14 -0
index 06f83d8f87..bcf0743b23 100644
@@ -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
package/gcc/gcc.hash +2 -1
index e364be0a06..dc19c282c2 100644
@@ -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

Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#14 lore raw

Re: [Buildroot] [PATCH for-next 08/11] package/gcc: add support for gcc 12

Hello James,

Le 25/06/2022 à 08:45, James Hilliard a écrit :

Quoted 10 lines · Romain Naour
Quoted 8 lines

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

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

Quoted 53 lines
Quoted 53 lines
---
 package/gcc/Config.in.host | 14 ++++++++++++++
 package/gcc/gcc.hash       |  2 ++
 2 files changed, 16 insertions(+)
package/gcc/Config.in.host +14 -0
index 06f83d8f87..bcf0743b23 100644
@@ -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
package/gcc/gcc.hash +2 -1
index e364be0a06..dc19c282c2 100644
@@ -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

Quoted 4 lines
Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#15 lore raw

PATCH 9/11 arch: add BR2_ARCH_NEEDS_GCC_AT_LEAST_12

In reply to Romain Naour

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

---
 arch/Config.in             | 4 ++++
 package/gcc/Config.in.host | 1 +
 2 files changed, 5 insertions(+)
arch/Config.in +4 -0
index 49e16fce38..966ceaa397 100644
@@ -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
package/gcc/Config.in.host +1 -0
index bcf0743b23..afaa4d2191 100644
@@ -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
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#16 lore raw

PATCH 10/11 package/gcc: switch to gcc 11.x as the default

In reply to 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.

---
 package/gcc/Config.in.host | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/gcc/Config.in.host +1 -1
index afaa4d2191..10061dbc9d 100644
@@ -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.
 
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#17 lore raw

PATCH 11/11 package/gcc: remove gcc 9.x

In reply to 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.

---
 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
Config.in.legacy +9 -0
index 3d5df3abbb..39def0d853 100644
@@ -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
package/gcc/9.4.0/0001-or1k-Fix-issue-with-set_got-clobbering-LR-r9.patch deleted +0 -105

105 lines not on this page · raw message

package/gcc/9.4.0/0002-gcc-define-_REENTRANT-for-OpenRISC-when-pthread-is-p.patch deleted +0 -31
deleted file mode 100644
index 5ac03d7c0c..0000000000
@@ -1,31 +0,0 @@
-From f80e9941739fb3973b61fc6a5abddef5ad2faf73 Mon Sep 17 00:00:00 2001
-From: Bernd Kuhls <[email protected]>
-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 <[email protected]>
----
- 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
-
package/gcc/9.4.0/0003-Revert-re-PR-target-92095-internal-error-with-O1-mcp.patch deleted +0 -325

325 lines not on this page · raw message

package/gcc/9.4.0/0004-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch deleted +0 -201

201 lines not on this page · raw message

package/gcc/9.4.0/0005-or1k-Use-cmodel-large-when-building-crtstuff.patch deleted +0 -60

60 lines not on this page · raw message

package/gcc/Config.in.host +0 -15
index 10061dbc9d..18e4a483df 100644
@@ -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
package/gcc/gcc.hash +0 -2
index dc19c282c2..b1cfb1c9cf 100644
@@ -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
Signature · 6 lines
2.35.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#18 lore raw
In reply to Romain Naour

Hello Romain,

Quoted 27 lines · On Sun, 29 May 2022 15:18:01 +0200 Romain Naour <[email protected]> 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.

Quoted 7 lines

[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

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

Quoted 2 lines
(quoted diff) +2 -0
+	select BR2_RISCV_ISA_RVZicsr if BR2_TOOLCHAIN_GCC_AT_LEAST_12
+	select BR2_RISCV_ISA_RVZifencei if BR2_TOOLCHAIN_GCC_AT_LEAST_12

[...]

Review config BR2_RISCV_ISA_CUSTOM_RVD · line 76

Quoted 13 lines
(quoted diff) +4 -1
 	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:

arch/arch.mk.riscv +4 -0
index f3bf2b3467..d77f88dd70 100644
@@ -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

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#19 lore raw

Hello Thomas,

Le 23/07/2022 à 14:39, Thomas Petazzoni via buildroot a écrit :

Quoted 99 lines

Hello Romain,

Quoted 27 lines · On Sun, 29 May 2022 15:18:01 +0200 Romain Naour <[email protected]> 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.

Quoted 7 lines

[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

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

Quoted 2 lines
(quoted diff) +2 -0
+	select BR2_RISCV_ISA_RVZicsr if BR2_TOOLCHAIN_GCC_AT_LEAST_12
+	select BR2_RISCV_ISA_RVZifencei if BR2_TOOLCHAIN_GCC_AT_LEAST_12

[...]

Review config BR2_RISCV_ISA_CUSTOM_RVD · line 76

Quoted 13 lines
(quoted diff) +4 -1
 	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:

arch/arch.mk.riscv +4 -0
index f3bf2b3467..d77f88dd70 100644
@@ -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
Quoted 5 lines

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/[email protected]/

http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

But this requires gcc-12

http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/#2933736

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

Best regards,
Romain

Quoted 2 lines

Thomas

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#20 lore raw

Hello,

Quoted 3 lines · On Sat, 23 Jul 2022 15:00:40 +0200 Romain Naour <[email protected]> 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.

Quoted 11 lines

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

http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

But this requires gcc-12

http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/#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

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot