From 686d5ba78193f0a96f395dbcde58ccfc9b22c936 Mon Sep 17 00:00:00 2001 From: Romain Naour Date: Mon, 25 Jul 2022 11:44:56 +0200 Subject: [PATCH] package/gcc: disable split-stack for non-thread builds Since commit [1], the autobuilder script generates fully random configurations that can trigger configurations that were not tested before. Here, the toolchain build with uClibc-ng without threads support (BR2_PTHREADS_NONE=y) fails to build due to a missing pthread.h header: ../../../libgcc/generic-morestack-thread.c:42:10: fatal error: pthread.h: No such file or directory 42 | #include 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 Cc: Waldemar Brodkorb Cc: Thomas Petazzoni Signed-off-by: Thomas Petazzoni (cherry picked from commit fff68f75b3519cadb2639fde2296b26db919d79d) [Peter: drop gcc-12.1 patch] Signed-off-by: Peter Korsgaard --- ...le-split-stack-for-non-thread-builds.patch | 26 +++++++++++++++++++ ...le-split-stack-for-non-thread-builds.patch | 26 +++++++++++++++++++ 2 files changed, 52 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 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 +Date: Mon, 25 Jul 2022 00:29:55 +0200 +Subject: [PATCH] disable split-stack for non-thread builds + +Signed-off-by: Waldemar Brodkorb +[Romain: convert to git format] +Signed-off-by: Romain Naour +--- + 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 +Date: Mon, 25 Jul 2022 00:29:55 +0200 +Subject: [PATCH] disable split-stack for non-thread builds + +Signed-off-by: Waldemar Brodkorb +[Romain: convert to git format] +Signed-off-by: Romain Naour +--- + 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 +