Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds
@ 2022-07-25  9:44 Romain Naour
  2022-07-25 10:29 ` Arnout Vandecappelle
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Romain Naour @ 2022-07-25  9:44 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Thomas Petazzoni

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@smile.fr>
Cc: Waldemar Brodkorb <wbx@openadk.org>
Cc: Thomas Petazzoni <thomas.petazzoni@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@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/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@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/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@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
+
-- 
2.34.3

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

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

* Re: [Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds
  2022-07-25  9:44 [Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds Romain Naour
@ 2022-07-25 10:29 ` Arnout Vandecappelle
  2022-07-25 12:29 ` Thomas Petazzoni via buildroot
  2022-08-17  6:50 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2022-07-25 10:29 UTC (permalink / raw)
  To: Romain Naour, buildroot; +Cc: Thomas Petazzoni



On 25/07/2022 11:44, Romain Naour wrote:
> 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].

  So, why don't we send it upstream then? Waldemar might need to do a copyright 
assignment to GCC then however.


> 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@smile.fr>
> Cc: Waldemar Brodkorb <wbx@openadk.org>
> Cc: Thomas Petazzoni <thomas.petazzoni@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?

  There is a reason to use nothread: it can make code slightly more efficient 
because mutexes are elided. However, that would only work for really really 
small applications, where I doubt there's much use of using Buildroot.

  So in the end, I wouldn't be opposed at all to get rid of nothread.

  However, there is currently (but hopefully not forever) one more reason to 
keep nothreads: NPTL is only implemented for MMU, and LinuxThreads is not 
implemented for RISCV_64. So the RISCV_64 NOMMU architecture doesn't support 
threads at all at the moment. This will hopefully be fixed in uClibc at some 
point, but for the moment we still need it.

  Regards,
  Arnout


> ---
>   ...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@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/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@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/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@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
> +
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds
  2022-07-25  9:44 [Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds Romain Naour
  2022-07-25 10:29 ` Arnout Vandecappelle
@ 2022-07-25 12:29 ` Thomas Petazzoni via buildroot
  2022-08-17  6:50 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-25 12:29 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Mon, 25 Jul 2022 11:44:56 +0200
Romain Naour <romain.naour@smile.fr> wrote:

> 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@smile.fr>
> Cc: Waldemar Brodkorb <wbx@openadk.org>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---

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] 4+ messages in thread

* Re: [Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds
  2022-07-25  9:44 [Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds Romain Naour
  2022-07-25 10:29 ` Arnout Vandecappelle
  2022-07-25 12:29 ` Thomas Petazzoni via buildroot
@ 2022-08-17  6:50 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2022-08-17  6:50 UTC (permalink / raw)
  To: Romain Naour; +Cc: Thomas Petazzoni, buildroot

>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

 > 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@smile.fr>
 > Cc: Waldemar Brodkorb <wbx@openadk.org>
 > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed to 2022.05.x and 2022.02.x (without the gcc 12.1.0 patch), thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-08-17  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25  9:44 [Buildroot] [PATCH] package/gcc: disable split-stack for non-thread builds Romain Naour
2022-07-25 10:29 ` Arnout Vandecappelle
2022-07-25 12:29 ` Thomas Petazzoni via buildroot
2022-08-17  6:50 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox