* [Buildroot] [PATCH v2] package/btop: fix build failure on ARM Thumb-1 target
@ 2026-10-19 4:24 Fengwei Tan
2026-10-20 7:27 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Fengwei Tan @ 2026-10-19 4:24 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Petazzoni, 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/
Fixes: a7d47860f323 ("package/btop: new package")
Signed-off-by: Fengwei Tan <tfx2001@outlook.com>
---
Changes in v2:
- Add Fixes trailer pointing to the commit introducing the issue
- Link to v1: https://patch.msgid.link/SY8P300MB0041CF44C55A5BC134A52D6EB5992@SY8P300MB0041.AUSP300.PROD.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 000000000000..b26a55069869
--- /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] 2+ messages in thread
* Re: [Buildroot] [PATCH v2] package/btop: fix build failure on ARM Thumb-1 target
2026-10-19 4:24 [Buildroot] [PATCH v2] package/btop: fix build failure on ARM Thumb-1 target Fengwei Tan
@ 2026-10-20 7:27 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-10-20 7:27 UTC (permalink / raw)
To: Fengwei Tan; +Cc: buildroot
On Mon, Oct 19, 2026 at 12:24:00PM +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/
> Fixes: a7d47860f323 ("package/btop: new package")
> Signed-off-by: Fengwei Tan <tfx2001@outlook.com>
Applied to master, thanks!
Best regards,
Thomas Petazzoni
--
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] 2+ messages in thread
end of thread, other threads:[~2026-10-20 7:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 4:24 [Buildroot] [PATCH v2] package/btop: fix build failure on ARM Thumb-1 target Fengwei Tan
2026-10-20 7:27 ` Thomas Petazzoni via buildroot
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.