Skip to contentSkip to conversation

package/libucontext: new package

PATCH In review James Hilliard 2 participants 3 messages Aug 11, 2022 – Sep 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/libucontext: new package

This package provides a ucontext.h C API on musl libc.

Architecture support table based on:
https://github.com/kaniini/libucontext/tree/libucontext-1.2#supported-features

---
 DEVELOPERS                           |  1 +
 package/Config.in                    |  1 +
 package/libucontext/Config.in        | 33 ++++++++++++++++++++++++++++
 package/libucontext/libucontext.hash |  4 ++++
 package/libucontext/libucontext.mk   | 17 ++++++++++++++
 5 files changed, 56 insertions(+)
 create mode 100644 package/libucontext/Config.in
 create mode 100644 package/libucontext/libucontext.hash
 create mode 100644 package/libucontext/libucontext.mk
DEVELOPERS +1 -0
index d2bd0d809a..b843acca9e 100644
@@ -1334,6 +1334,7 @@ F:	package/exfatprogs/
 F:	package/gensio/
 F:	package/lua-std-debug/
 F:	package/lua-std-normalize/
+F:	package/libucontext/
 F:	package/lilv/
 F:	package/lv2/
 F:	package/pipewire/
package/Config.in +1 -0
index d1c098c48f..3fe0dcc3c8 100644
@@ -2050,6 +2050,7 @@ menu "Other"
 	source "package/libtpl/Config.in"
 	source "package/libubox/Config.in"
 	source "package/libuci/Config.in"
+	source "package/libucontext/Config.in"
 	source "package/libunwind/Config.in"
 	source "package/liburcu/Config.in"
 	source "package/liburing/Config.in"
package/libucontext/Config.in new file +33 -0
new file mode 100644
index 0000000000..84a6e89f23
@@ -0,0 +1,33 @@
+config BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
+	bool
+	default y if BR2_aarch64
+	default y if BR2_aarch64_be
+	default y if BR2_arm
+	default y if BR2_armeb
+	default y if BR2_m68k
+	default y if BR2_mips
+	default y if BR2_mipsel
+	default y if BR2_mips64
+	default y if BR2_mips64el
+	default y if BR2_or1k
+	default y if BR2_powerpc
+	default y if BR2_powerpc64
+	default y if BR2_powerpc64le
+	default y if BR2_riscv && BR2_RISCV_32
+	default y if BR2_riscv && BR2_RISCV_64
+	default y if BR2_s390x
+	default y if BR2_sh4
+	default y if BR2_sh4eb
+	default y if BR2_sh4a
+	default y if BR2_sh4aeb
+	default y if BR2_i386
+	default y if BR2_x86_64
+	depends on BR2_TOOLCHAIN_USES_MUSL
+
+config BR2_PACKAGE_LIBUCONTEXT
+	bool "libucontext"
+	depends on BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
+	help
+	  Ucontext implementation featuring glibc-compatible ABI.
+
+	  https://github.com/kaniini/libucontext
package/libucontext/libucontext.hash new file +4 -0
new file mode 100644
index 0000000000..a8e1e23e36
@@ -0,0 +1,4 @@
+# Locally calculated
+sha256  937fba9d0beebd7cf957b79979b19fe3a29bb9c4bfd25e869477d7154bbf8fd3  libucontext-1.2.tar.gz
+# License files, locally calculated
+sha256  ecf4be354bbb6ccebdf150d1a8f2b3caeb10cf7c8a580f278a30799372f9e037  LICENSE
package/libucontext/libucontext.mk new file +17 -0
new file mode 100644
index 0000000000..75c4f9b9e4
@@ -0,0 +1,17 @@
+################################################################################
+#
+# libucontext
+#
+################################################################################
+
+LIBUCONTEXT_VERSION = 1.2
+LIBUCONTEXT_SITE = $(call github,kaniini,libucontext,libucontext-$(LIBUCONTEXT_VERSION))
+LIBUCONTEXT_LICENSE = ISC
+LIBUCONTEXT_LICENSE_FILES = LICENSE
+LIBUCONTEXT_INSTALL_STAGING = YES
+
+LIBUCONTEXT_CONF_OPTS = \
+	-Dfreestanding=false \
+	-Dexport_unprefixed=true
+
+$(eval $(meson-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/libunwind: add libucontext support

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.

---
 package/libunwind/Config.in    | 19 ++++++++++++++++++-
 package/libunwind/libunwind.mk |  4 ++++
 2 files changed, 22 insertions(+), 1 deletion(-)
package/libunwind/Config.in +18 -1
index dfd0df30fa..08f7f879c9 100644
@@ -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.
 
package/libunwind/libunwind.mk +4 -0
index 9cd587d0a3..afc17f7b25 100644
@@ -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))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to James Hilliard
Quoted 4 lines · James Hilliard

This package provides a ucontext.h C API on musl libc.

Architecture support table based on:
https://github.com/kaniini/libucontext/tree/libucontext-1.2#supported-features

Both applied to master, thanks.

Regards,
Arnout

Quoted 99 lines
---
  DEVELOPERS                           |  1 +
  package/Config.in                    |  1 +
  package/libucontext/Config.in        | 33 ++++++++++++++++++++++++++++
  package/libucontext/libucontext.hash |  4 ++++
  package/libucontext/libucontext.mk   | 17 ++++++++++++++
  5 files changed, 56 insertions(+)

create mode 100644 package/libucontext/Config.in create mode 100644 package/libucontext/libucontext.hash create mode 100644 package/libucontext/libucontext.mk

DEVELOPERS +1 -0
index d2bd0d809a..b843acca9e 100644
@@ -1334,6 +1334,7 @@ F:	package/exfatprogs/
  F:	package/gensio/
  F:	package/lua-std-debug/
  F:	package/lua-std-normalize/
+F:	package/libucontext/
  F:	package/lilv/
  F:	package/lv2/
  F:	package/pipewire/
package/Config.in +1 -0
index d1c098c48f..3fe0dcc3c8 100644
@@ -2050,6 +2050,7 @@ menu "Other"
  	source "package/libtpl/Config.in"
  	source "package/libubox/Config.in"
  	source "package/libuci/Config.in"
+	source "package/libucontext/Config.in"
  	source "package/libunwind/Config.in"
  	source "package/liburcu/Config.in"
  	source "package/liburing/Config.in"
package/libucontext/Config.in new file +33 -0
new file mode 100644
index 0000000000..84a6e89f23
@@ -0,0 +1,33 @@
+config BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
+	bool
+	default y if BR2_aarch64
+	default y if BR2_aarch64_be
+	default y if BR2_arm
+	default y if BR2_armeb
+	default y if BR2_m68k
+	default y if BR2_mips
+	default y if BR2_mipsel
+	default y if BR2_mips64
+	default y if BR2_mips64el
+	default y if BR2_or1k
+	default y if BR2_powerpc
+	default y if BR2_powerpc64
+	default y if BR2_powerpc64le
+	default y if BR2_riscv && BR2_RISCV_32
+	default y if BR2_riscv && BR2_RISCV_64
+	default y if BR2_s390x
+	default y if BR2_sh4
+	default y if BR2_sh4eb
+	default y if BR2_sh4a
+	default y if BR2_sh4aeb
+	default y if BR2_i386
+	default y if BR2_x86_64
+	depends on BR2_TOOLCHAIN_USES_MUSL
+
+config BR2_PACKAGE_LIBUCONTEXT
+	bool "libucontext"
+	depends on BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
+	help
+	  Ucontext implementation featuring glibc-compatible ABI.
+
+	  https://github.com/kaniini/libucontext
package/libucontext/libucontext.hash new file +4 -0
new file mode 100644
index 0000000000..a8e1e23e36
@@ -0,0 +1,4 @@
+# Locally calculated
+sha256  937fba9d0beebd7cf957b79979b19fe3a29bb9c4bfd25e869477d7154bbf8fd3  libucontext-1.2.tar.gz
+# License files, locally calculated
+sha256  ecf4be354bbb6ccebdf150d1a8f2b3caeb10cf7c8a580f278a30799372f9e037  LICENSE
package/libucontext/libucontext.mk new file +7 -0
new file mode 100644
index 0000000000..75c4f9b9e4
@@ -0,0 +1,17 @@
+################################################################################
+#
+# libucontext
+#
+################################################################################
+
+LIBUCONTEXT_VERSION = 1.2

package/libucontext/libucontext.mk line 17

Quoted 10 lines
package/libucontext/libucontext.mk new file +10 -0
+LIBUCONTEXT_SITE = $(call github,kaniini,libucontext,libucontext-$(LIBUCONTEXT_VERSION))
+LIBUCONTEXT_LICENSE = ISC
+LIBUCONTEXT_LICENSE_FILES = LICENSE
+LIBUCONTEXT_INSTALL_STAGING = YES
+
+LIBUCONTEXT_CONF_OPTS = \
+	-Dfreestanding=false \
+	-Dexport_unprefixed=true
+
+$(eval $(meson-package))

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot