[Buildroot] [git commit] package/libunwind: add libucontext support

Arnout Vandecappelle arnout at mind.be
Sat Sep 30 19:27:10 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=6ea2a27f9047696ce1c463ad55fb4a78df136954
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

We can expand the list of supported musl architectures by
letting libucontext provide required context API's.

Use the following table to determine which architectures require
libucontext for BR2_PACKAGE_LIBUNWIND_MUSL_CONTEXT_REQUIRED:
https://github.com/libunwind/libunwind/tree/v1.6.2#libc-requirements

Enable BR2_PACKAGE_LIBUNWIND_ARCH_SUPPORTS if we have
BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS or if context is not required
by checking for !BR2_PACKAGE_LIBUNWIND_MUSL_CONTEXT_REQUIRED.

Select BR2_PACKAGE_LIBUCONTEXT when selecting BR2_PACKAGE_LIBUNWIND
if we have BR2_PACKAGE_LIBUNWIND_MUSL_CONTEXT_REQUIRED.

Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
Signed-off-by: Arnout Vandecappelle <arnout at mind.be>
---
 package/libunwind/Config.in    | 19 ++++++++++++++++++-
 package/libunwind/libunwind.mk |  4 ++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/package/libunwind/Config.in b/package/libunwind/Config.in
index dfd0df30fa..08f7f879c9 100644
--- a/package/libunwind/Config.in
+++ b/package/libunwind/Config.in
@@ -1,3 +1,17 @@
+config BR2_PACKAGE_LIBUNWIND_MUSL_CONTEXT_REQUIRED
+	bool
+	default y
+	depends on !BR2_ARM_CPU_HAS_ARM
+	depends on !BR2_aarch64
+	depends on !BR2_aarch64_be
+	depends on !BR2_mips
+	depends on !BR2_mipsel
+	depends on !BR2_mips64
+	depends on !BR2_mips64el
+	depends on !BR2_riscv
+	depends on !BR2_x86_64
+	depends on BR2_TOOLCHAIN_USES_MUSL
+
 # libunwind is only available for a certain subset of the
 # architectures (as visible in the list of architectures supported
 # with the glibc C library below).
@@ -17,7 +31,8 @@ config BR2_PACKAGE_LIBUNWIND_ARCH_SUPPORTS
 		(BR2_ARM_CPU_HAS_ARM || BR2_mips || BR2_mipsel || \
 		 BR2_mips64 || BR2_mips64el || BR2_x86_64)
 	default y if BR2_TOOLCHAIN_USES_MUSL && \
-		(BR2_ARM_CPU_HAS_ARM || BR2_aarch64 || BR2_x86_64)
+		(!BR2_PACKAGE_LIBUNWIND_MUSL_CONTEXT_REQUIRED || \
+		 BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
 
 config BR2_PACKAGE_LIBUNWIND
 	bool "libunwind"
@@ -27,6 +42,8 @@ config BR2_PACKAGE_LIBUNWIND
 	# forcefully links against libgcc_s, only available in dynamic
 	# linking configurations
 	depends on !BR2_STATIC_LIBS
+	select BR2_PACKAGE_LIBUCONTEXT if BR2_TOOLCHAIN_USES_MUSL && \
+		BR2_PACKAGE_LIBUNWIND_MUSL_CONTEXT_REQUIRED
 	help
 	  C API to determine the call-chain of a program.
 
diff --git a/package/libunwind/libunwind.mk b/package/libunwind/libunwind.mk
index 9cd587d0a3..afc17f7b25 100644
--- a/package/libunwind/libunwind.mk
+++ b/package/libunwind/libunwind.mk
@@ -16,4 +16,8 @@ LIBUNWIND_CONF_OPTS = \
 	--disable-tests \
 	$(if $(BR2_INSTALL_LIBSTDCPP),--enable-cxx-exceptions,--disable-cxx-exceptions)
 
+ifeq ($(BR2_PACKAGE_LIBUCONTEXT),y)
+LIBUNWIND_DEPENDENCIES += libucontext
+endif
+
 $(eval $(autotools-package))



More information about the buildroot mailing list