From: Romain Naour <romain.naour@gmail.com>
To: buildroot@buildroot.org
Cc: Romain Naour <romain.naour@gmail.com>
Subject: [Buildroot] [PATCH 3/6] package/gcc: add support for gcc 13
Date: Tue, 16 May 2023 15:51:04 +0200 [thread overview]
Message-ID: <20230516135107.238343-3-romain.naour@gmail.com> (raw)
In-Reply-To: <20230516135107.238343-1-romain.naour@gmail.com>
https://gcc.gnu.org/gcc-13/changes.html
https://gcc.gnu.org/gcc-13/porting_to.html
Backport upstream patch to gcc 13.1 for RISC-V build issue with gcc 4.9.x:
GCC should still build with GCC 4.8.3 or newer [1]
using C++03 by default. But a recent change in
RISC-V port introduced a C++11 feature "std::log2" [2].
Use log2 from the C header, without the namespace [3].
[1] https://gcc.gnu.org/install/prerequisites.html
[2] https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=7caa1ae5e451e780fbc4746a54e3f19d4f4304dc
[3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-member-of-std
Rebase patch 0001-disable-split-stack-for-non-thread-builds.patch
required for uClibc-ng without threads support.
Fixes:
https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276589
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
efl2flt for riscv64 is broken with gcc 13.1
https://gitlab.com/DocSepp/buildroot/-/jobs/4197460843
---
...le-split-stack-for-non-thread-builds.patch | 26 ++++++++++
...ISC-V-fix-build-issue-with-gcc-4.9.x.patch | 48 +++++++++++++++++++
package/gcc/Config.in.host | 14 ++++++
package/gcc/gcc.hash | 2 +
4 files changed, 90 insertions(+)
create mode 100644 package/gcc/13.1.0/0001-disable-split-stack-for-non-thread-builds.patch
create mode 100644 package/gcc/13.1.0/0002-RISC-V-fix-build-issue-with-gcc-4.9.x.patch
diff --git a/package/gcc/13.1.0/0001-disable-split-stack-for-non-thread-builds.patch b/package/gcc/13.1.0/0001-disable-split-stack-for-non-thread-builds.patch
new file mode 100644
index 0000000000..e801085dad
--- /dev/null
+++ b/package/gcc/13.1.0/0001-disable-split-stack-for-non-thread-builds.patch
@@ -0,0 +1,26 @@
+From 4f67134e0b1404fef4ea72342be8fab4c37ca8c8 Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <wbx@openadk.org>
+Date: Mon, 25 Jul 2022 00:29:55 +0200
+Subject: [PATCH] disable split-stack for non-thread builds
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+[Romain: convert to git format]
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+ libgcc/config/t-stack | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libgcc/config/t-stack b/libgcc/config/t-stack
+index cc0366b4cd8..f3f97e86d60 100644
+--- a/libgcc/config/t-stack
++++ b/libgcc/config/t-stack
+@@ -1,4 +1,6 @@
+ # Makefile fragment to provide generic support for -fsplit-stack.
+ # This should be used in config.host for any host which supports
+ # -fsplit-stack.
++ifeq ($(enable_threads),yes)
+ LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c
++endif
+--
+2.34.3
+
diff --git a/package/gcc/13.1.0/0002-RISC-V-fix-build-issue-with-gcc-4.9.x.patch b/package/gcc/13.1.0/0002-RISC-V-fix-build-issue-with-gcc-4.9.x.patch
new file mode 100644
index 0000000000..55fb40e358
--- /dev/null
+++ b/package/gcc/13.1.0/0002-RISC-V-fix-build-issue-with-gcc-4.9.x.patch
@@ -0,0 +1,48 @@
+From e5253b777eefef7d66d3bd1c641de6d133d3573d Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Tue, 2 May 2023 14:21:55 +0200
+Subject: [PATCH] RISC-V: fix build issue with gcc 4.9.x
+
+GCC should still build with GCC 4.8.3 or newer [1]
+using C++03 by default. But a recent change in
+RISC-V port introduced a C++11 feature "std::log2" [2].
+
+Use log2 from the C header, without the namespace [3].
+
+[1] https://gcc.gnu.org/install/prerequisites.html
+[2] https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=7caa1ae5e451e780fbc4746a54e3f19d4f4304dc
+[3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-member-of-std
+
+Fixes:
+https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276589
+
+gcc/ChangeLog:
+ * config/riscv/genrvv-type-indexer.cc: Use log2 from the C header, without
+ the namespace.
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+(cherry picked from commit 87c347c2897537a6aa391efbfc5ed00c625434fe)
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ gcc/config/riscv/genrvv-type-indexer.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc
+index e677b55290c..eebe382d1c3 100644
+--- a/gcc/config/riscv/genrvv-type-indexer.cc
++++ b/gcc/config/riscv/genrvv-type-indexer.cc
+@@ -115,9 +115,9 @@ same_ratio_eew_type (unsigned sew, int lmul_log2, unsigned eew, bool unsigned_p,
+ if (sew == eew)
+ elmul_log2 = lmul_log2;
+ else if (sew > eew)
+- elmul_log2 = lmul_log2 - std::log2 (sew / eew);
++ elmul_log2 = lmul_log2 - log2 (sew / eew);
+ else /* sew < eew */
+- elmul_log2 = lmul_log2 + std::log2 (eew / sew);
++ elmul_log2 = lmul_log2 + log2 (eew / sew);
+
+ if (float_p)
+ return floattype (eew, elmul_log2);
+--
+2.34.3
+
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index cd1b9fa46d..3beaaef309 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -59,6 +59,19 @@ config BR2_GCC_VERSION_12_X
depends on !BR2_archs4x_rel31
select BR2_TOOLCHAIN_GCC_AT_LEAST_12
+config BR2_GCC_VERSION_13_X
+ bool "gcc 13.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_13
+
endchoice
# libcilkrts was introduced in gcc 4.9 and removed in gcc 8.x
@@ -89,6 +102,7 @@ config BR2_GCC_VERSION
default "10.4.0" if BR2_GCC_VERSION_10_X
default "11.3.0" if BR2_GCC_VERSION_11_X
default "12.2.0" if BR2_GCC_VERSION_12_X
+ default "13.1.0" if BR2_GCC_VERSION_13_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 666124fa6d..d324852bdd 100644
--- a/package/gcc/gcc.hash
+++ b/package/gcc/gcc.hash
@@ -6,6 +6,8 @@ sha512 440c08ca746da450d9a1b35e8fd2305cb27e7e6987cd9d0f7d375f3b1fc9e4b0bd7acb3c
sha512 f0be5ad705c73b84477128a69c047f57dd47002f375eb60e1e842e08cf2009a509e92152bca345823926d550b7395ae6d4de7db51d1ee371c2dc37313881fca7 gcc-11.3.0.tar.xz
# From https://gcc.gnu.org/pub/gcc/releases/gcc-12.2.0/sha512.sum
sha512 e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173 gcc-12.2.0.tar.xz
+# From https://gcc.gnu.org/pub/gcc/releases/gcc-13.1.0/sha512.sum
+sha512 6cf06dfc48f57f5e67f7efe3248019329a14d690c728d9f2f7ef5fa0d58f1816f309586ba7ea2eac20d0b60a2d1b701f68392e9067dd46f827ba0efd7192db33 gcc-13.1.0.tar.xz
# Locally calculated (fetched from Github)
sha512 b0853e2b1c5998044392023fa653e399e74118c46e616504ac59e1a2cf27620f94434767ce06b6cf4ca3dfb57f81d6eda92752befaf095ea5e564a9181b4659c gcc-arc-2020.09-release.tar.gz
--
2.34.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-05-16 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 13:51 [Buildroot] [PATCH 1/6] toolchain/Config.in: add BR2_TOOLCHAIN_GCC_AT_LEAST_13 blind option Romain Naour
2023-05-16 13:51 ` [Buildroot] [PATCH 2/6] toolchain/toolchain-external/toolchain-external-custom: add gcc 13 version selection Romain Naour
2023-05-16 13:51 ` Romain Naour [this message]
2023-05-21 4:13 ` [Buildroot] [PATCH 3/6] package/gcc: add support for gcc 13 Bagas Sanjaya
2023-07-27 21:36 ` [Buildroot] [External] - " Vincent Fazio
2023-05-16 13:51 ` [Buildroot] [PATCH 4/6] arch/Config.in: add BR2_ARCH_NEEDS_GCC_AT_LEAST_13 Romain Naour
2023-05-16 13:51 ` [Buildroot] [PATCH 5/6] package/gcc: switch to gcc 12.x as the default Romain Naour
2023-05-16 13:51 ` [Buildroot] [PATCH 6/6] package/gcc: remove gcc 10.x Romain Naour
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230516135107.238343-3-romain.naour@gmail.com \
--to=romain.naour@gmail.com \
--cc=buildroot@buildroot.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.