Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/btop: fix build failure on ARM Thumb-1 target
@ 2026-10-18 14:47 Fengwei Tan
  2026-10-18 20:06 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Fengwei Tan @ 2026-10-18 14:47 UTC (permalink / raw)
  To: buildroot; +Cc: Fengwei Tan

Add a patch to add CMake compile test for -fstack-clash-protection, only
enabling the flag when the test succeeds.

Fixes: https://autobuild.buildroot.org/results/573e0fc3178f8c9a0583bf86a678caa775410ef2/
Signed-off-by: Fengwei Tan <tfx2001@outlook.com>
---
 ...compile-test-for-fstack-clash-protec.patch | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 package/btop/0001-build-cmake-add-compile-test-for-fstack-clash-protec.patch

diff --git a/package/btop/0001-build-cmake-add-compile-test-for-fstack-clash-protec.patch b/package/btop/0001-build-cmake-add-compile-test-for-fstack-clash-protec.patch
new file mode 100644
index 0000000000..b26a550698
--- /dev/null
+++ b/package/btop/0001-build-cmake-add-compile-test-for-fstack-clash-protec.patch
@@ -0,0 +1,56 @@
+From f7b5ba16d3662ca036c6b1724fe741b28f29106a Mon Sep 17 00:00:00 2001
+From: Fengwei Tan <tfx2001@outlook.com>
+Date: Sun, 18 Oct 2026 16:37:11 +0800
+Subject: [PATCH] build(cmake): add compile test for -fstack-clash-protection
+
+On ARM Thumb-1 targets, GCC front end accepts -fstack-clash-protection,
+but fails to compile actual code:
+
+  format.h:960:36: sorry, unimplemented: '-fstack-check=specific' for Thumb-1
+
+Add a compile test with large stack allocation to trigger the compiler
+to emit stack-clash protection code, verifying whether the flag works
+correctly.
+
+Apple Clang ignores -fstack-clash-protection and emits a warning, so
+skip this flag on Apple platforms.
+
+Upstream: https://github.com/aristocratos/btop/pull/1918
+Signed-off-by: Fengwei Tan <tfx2001@outlook.com>
+---
+ CMakeLists.txt | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3398196..0be6365 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -134,10 +134,23 @@ endif()
+ target_compile_options(libbtop PUBLIC -Wall -Wextra -Wpedantic)
+ 
+ include(CheckCXXCompilerFlag)
+-
+-if(NOT APPLE)
++include(CMakePushCheckState)
++
++cmake_push_check_state(RESET)
++set(CMAKE_REQUIRED_FLAGS "-fstack-clash-protection")
++check_cxx_source_compiles("
++  int main(int argc, char *argv[]) {
++    char buf[16384], *src = argv[0], *dst = buf;
++    while ((*dst++ = *src++) != 0) {}
++    return buf[argc];
++  }
++" HAS_FSTACK_CLASH_PROTECTION)
++cmake_pop_check_state()
++
++if(NOT APPLE AND HAS_FSTACK_CLASH_PROTECTION)
+   target_compile_options(libbtop PUBLIC -fstack-clash-protection)
+ endif()
++
+ check_cxx_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR)
+ if(HAS_FSTACK_PROTECTOR)
+   target_compile_options(libbtop PUBLIC -fstack-protector)
+-- 
+2.56.0
+
-- 
2.56.0

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

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

* Re: [Buildroot] [PATCH] package/btop: fix build failure on ARM Thumb-1 target
  2026-10-18 14:47 [Buildroot] [PATCH] package/btop: fix build failure on ARM Thumb-1 target Fengwei Tan
@ 2026-10-18 20:06 ` Thomas Petazzoni via buildroot
  2026-10-19  3:05   ` Fengwei Tan
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-10-18 20:06 UTC (permalink / raw)
  To: Fengwei Tan; +Cc: buildroot

Hello,

On Sun, Oct 18, 2026 at 10:47:23PM +0800, Fengwei Tan wrote:
> Add a patch to add CMake compile test for -fstack-clash-protection, only
> enabling the flag when the test succeeds.
> 
> Fixes: https://autobuild.buildroot.org/results/573e0fc3178f8c9a0583bf86a678caa775410ef2/
> Signed-off-by: Fengwei Tan <tfx2001@outlook.com>

Thanks a lot for the patch. However, for fixes, we need to help the
maintainers of Buildroot LTS, and for that we need to indicate which
commit introduced the issue/regression in the first place. Does this
issue exists since btop was introduced? Or due to some other Buildroot
change?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/btop: fix build failure on ARM Thumb-1 target
  2026-10-18 20:06 ` Thomas Petazzoni via buildroot
@ 2026-10-19  3:05   ` Fengwei Tan
  0 siblings, 0 replies; 3+ messages in thread
From: Fengwei Tan @ 2026-10-19  3:05 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: buildroot

Hi Thomas,

在 2026/10/19 04:06, Thomas Petazzoni 写道: 
> Thanks a lot for the patch. However, for fixes, we need to help the
> maintainers of Buildroot LTS, and for that we need to indicate which
> commit introduced the issue/regression in the first place. Does this
> issue exists since btop was introduced? Or due to some other Buildroot
> change?

This issue has existed since btop was first added to Buildroot. I will
send a v2 including the Fixes: trailer to indicate the commit that
introduced the package.

Thanks,
Fengwei Tan
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-10-19  3:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18 14:47 [Buildroot] [PATCH] package/btop: fix build failure on ARM Thumb-1 target Fengwei Tan
2026-10-18 20:06 ` Thomas Petazzoni via buildroot
2026-10-19  3:05   ` Fengwei Tan

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