[Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds

Romain Naour romain.naour at smile.fr
Mon Jul 25 09:44:56 UTC 2022


Since commit [1], the autobuilder script generate fully random
configurations that can triggers configuration that was not tested
before.

Here, the toolchain build with uClibc-ng without threads support
(BR2_PTHREADS_NONE=y) fail to build due to missing pthread.h header.

../../../libgcc/generic-morestack-thread.c:42:10: fatal error: pthread.h: No such file or directory
   42 | #include <pthread.h>

This issue was actually fixed by this commit [2] adding a patch for
gcc 4.8, 4.9, 5.3. But it get lost when gcc 6 was added to Buildroot [3].

Since then the issue was present in Buildroot but has not been noticed.

[1] https://git.buildroot.net/buildroot-test/commit/?id=27b18dcb1686a98ce718b6a816e98f8505957a6c
[2] 2631219f648f4aa13fa36d06a483e4507cb6f3d7
[3] 519d83bfa0442439026db4e71e605a5c1347e566

Fixes:
http://autobuild.buildroot.org/results/5ec/5ec9eefacd27ef4fa73066013188796b43a30428
https://bugs.busybox.net/show_bug.cgi?id=8766

Signed-off-by: Romain Naour <romain.naour at smile.fr>
Cc: Waldemar Brodkorb <wbx at openadk.org>
Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---

>From Peter's comments (2016):
"I also doubt the no-thread option gets used very much.
Perhaps the way forward is to deprecate it and then make
threads always available, similar to how we did for
largefile/IPv6?"

https://bugs.busybox.net/show_bug.cgi?id=8766#c4

We are now in 2022, do we still want to support the no-thread
option?
---
 ...le-split-stack-for-non-thread-builds.patch | 26 +++++++++++++++++++
 ...le-split-stack-for-non-thread-builds.patch | 26 +++++++++++++++++++
 ...le-split-stack-for-non-thread-builds.patch | 26 +++++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 package/gcc/10.3.0/0006-disable-split-stack-for-non-thread-builds.patch
 create mode 100644 package/gcc/11.3.0/0004-disable-split-stack-for-non-thread-builds.patch
 create mode 100644 package/gcc/12.1.0/0001-disable-split-stack-for-non-thread-builds.patch

diff --git a/package/gcc/10.3.0/0006-disable-split-stack-for-non-thread-builds.patch b/package/gcc/10.3.0/0006-disable-split-stack-for-non-thread-builds.patch
new file mode 100644
index 0000000000..668b1cd9d7
--- /dev/null
+++ b/package/gcc/10.3.0/0006-disable-split-stack-for-non-thread-builds.patch
@@ -0,0 +1,26 @@
+From cdb76d638e91cc53949585d98fa653d3671b92ac Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <wbx at 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 at openadk.org>
+[Romain: convert to git format]
+Signed-off-by: Romain Naour <romain.naour at 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/11.3.0/0004-disable-split-stack-for-non-thread-builds.patch b/package/gcc/11.3.0/0004-disable-split-stack-for-non-thread-builds.patch
new file mode 100644
index 0000000000..dba2d02d7f
--- /dev/null
+++ b/package/gcc/11.3.0/0004-disable-split-stack-for-non-thread-builds.patch
@@ -0,0 +1,26 @@
+From 3b9d7d397fa6dc290eb05bffca80968efb6ec2e5 Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <wbx at 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 at openadk.org>
+[Romain: convert to git format]
+Signed-off-by: Romain Naour <romain.naour at 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/12.1.0/0001-disable-split-stack-for-non-thread-builds.patch b/package/gcc/12.1.0/0001-disable-split-stack-for-non-thread-builds.patch
new file mode 100644
index 0000000000..e801085dad
--- /dev/null
+++ b/package/gcc/12.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 at 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 at openadk.org>
+[Romain: convert to git format]
+Signed-off-by: Romain Naour <romain.naour at 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
+
-- 
2.34.3




More information about the buildroot mailing list