Skip to contentSkip to conversation

package/capnproto: update ucontext handling

PATCH In review Fabrice Fontaine 3 participants 3 messages Mar 6, 2024 – Nov 23

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/capnproto: update ucontext handling

musl workaround for getcontext/setcontext is not needed since commit eaeba56aa2d21f1d264c7e361731808e3f072d9d

Moreover, select libucontext if possible to get full ucontext support

---
 package/c-capnproto/Config.in  | 6 ++++--
 package/capnproto/Config.in    | 8 ++++++--
 package/capnproto/capnproto.mk | 5 ++---
 3 files changed, 12 insertions(+), 7 deletions(-)
package/c-capnproto/Config.in +4 -2
index c472128c3f..abe2a602ba 100644
@@ -7,7 +7,8 @@ config BR2_PACKAGE_C_CAPNPROTO
 	depends on BR2_TOOLCHAIN_HAS_THREADS # capnproto
 	depends on BR2_TOOLCHAIN_HAS_ATOMIC # capnproto
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # capnproto
-	depends on BR2_TOOLCHAIN_HAS_UCONTEXT # capnproto
+	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS # capnproto
 	select BR2_PACKAGE_CAPNPROTO
 	help
 	  A C plugin for Cap'n Proto. Generates the code generator
@@ -24,4 +25,5 @@ comment "c-capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, u
 		!BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_TOOLCHAIN_HAS_ATOMIC || \
 		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
-		!BR2_TOOLCHAIN_HAS_UCONTEXT
+		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
+			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
package/capnproto/Config.in +6 -2
index 943ba9de29..93e3a64fb8 100644
@@ -7,7 +7,10 @@ config BR2_PACKAGE_CAPNPROTO
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735
-	depends on BR2_TOOLCHAIN_HAS_UCONTEXT
+	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
+	select BR2_PACKAGE_LIBUCONTEXT if \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
 	help
 	  Cap'n Proto is an insanely fast data interchange format
 	  and capability-based RPC system. Think JSON, except
@@ -25,4 +28,5 @@ comment "capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, uco
 		!BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_TOOLCHAIN_HAS_ATOMIC || \
 		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
-		!BR2_TOOLCHAIN_HAS_UCONTEXT
+		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
+			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
package/capnproto/capnproto.mk +2 -3
index 7424a1420f..d322c27a54 100644
@@ -29,9 +29,8 @@ else
 CAPNPROTO_CONF_OPTS += --without-openssl
 endif
 
-# musl doesn't support getcontext/setcontext
-ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
-CAPNPROTO_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -DKJ_USE_FIBERS=0"
+ifeq ($(BR2_PACKAGE_LIBUCONTEXT),y)
+CAPNPROTO_DEPENDENCIES += libucontext
 endif
 
 $(eval $(autotools-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 38 lines · Fabrice Fontaine

musl workaround for getcontext/setcontext is not needed since commit eaeba56aa2d21f1d264c7e361731808e3f072d9d

Moreover, select libucontext if possible to get full ucontext support

---
  package/c-capnproto/Config.in  | 6 ++++--
  package/capnproto/Config.in    | 8 ++++++--
  package/capnproto/capnproto.mk | 5 ++---
  3 files changed, 12 insertions(+), 7 deletions(-)
package/c-capnproto/Config.in +4 -2
index c472128c3f..abe2a602ba 100644
@@ -7,7 +7,8 @@ config BR2_PACKAGE_C_CAPNPROTO
  	depends on BR2_TOOLCHAIN_HAS_THREADS # capnproto
  	depends on BR2_TOOLCHAIN_HAS_ATOMIC # capnproto
  	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # capnproto
-	depends on BR2_TOOLCHAIN_HAS_UCONTEXT # capnproto
+	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS # capnproto
  	select BR2_PACKAGE_CAPNPROTO
  	help
  	  A C plugin for Cap'n Proto. Generates the code generator
@@ -24,4 +25,5 @@ comment "c-capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, u
  		!BR2_TOOLCHAIN_HAS_THREADS || \
  		!BR2_TOOLCHAIN_HAS_ATOMIC || \
  		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
-		!BR2_TOOLCHAIN_HAS_UCONTEXT
+		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
+			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
package/capnproto/Config.in +0 -0
index 943ba9de29..93e3a64fb8 100644

package/capnproto/Config.in config BR2_PACKAGE_CAPNPROTO · line 13

Quoted 8 lines
package/capnproto/Config.in +4 -1
@@ -7,7 +7,10 @@ config BR2_PACKAGE_CAPNPROTO
  	depends on BR2_TOOLCHAIN_HAS_THREADS
  	depends on BR2_TOOLCHAIN_HAS_ATOMIC
  	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735
-	depends on BR2_TOOLCHAIN_HAS_UCONTEXT
+	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
+	select BR2_PACKAGE_LIBUCONTEXT if \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS

This will select libucontext even if the toolchain already has ucontext, so we
have it twice? Is that really OK, and even if it is, is it really what we want? My feeling is that libucontext should depend on !BR2_TOOLCHAIN_HAS_UCONTEXT...
And here, I feel it should be "if !BR2_TOOLCHAIN_HAS_UCONTEXT && BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS". Which is a bit too cumbersome to repeat in many places, so maybe we should also introduce an auxiliary symbol for that, something like BR2_PACKAGE_LIBUCONTEXT_IF_NEEDED.

Regards,
Arnout

Quoted 16 lines
package/capnproto/Config.in +2 -1
  	help
  	  Cap'n Proto is an insanely fast data interchange format
  	  and capability-based RPC system. Think JSON, except
@@ -25,4 +28,5 @@ comment "capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, uco
  		!BR2_TOOLCHAIN_HAS_THREADS || \
  		!BR2_TOOLCHAIN_HAS_ATOMIC || \
  		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
-		!BR2_TOOLCHAIN_HAS_UCONTEXT
+		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
+			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
package/capnproto/capnproto.mk +0 -0
index 7424a1420f..d322c27a54 100644
@@ -29,9 +29,8 @@ else
  CAPNPROTO_CONF_OPTS += --without-openssl

package/capnproto/capnproto.mk else · line 36

Quoted 10 lines
package/capnproto/capnproto.mk +2 -3
  endif
 
-# musl doesn't support getcontext/setcontext
-ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
-CAPNPROTO_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -DKJ_USE_FIBERS=0"
+ifeq ($(BR2_PACKAGE_LIBUCONTEXT),y)
+CAPNPROTO_DEPENDENCIES += libucontext
  endif
 
  $(eval $(autotools-package))

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

#2 lore raw

PATCH v2 1/1 package/capnproto: update ucontext handling

In reply to Fabrice Fontaine

From: Fabrice Fontaine <[email protected]>

musl workaround for getcontext/setcontext is not needed since commit eaeba56aa2d21f1d264c7e361731808e3f072d9d

Moreover, select libucontext if possible to get full ucontext support

---
Changes v1 -> v2:
- only select libucontext when the toolchain has no ucontext, with the same condition as libdex [Arnout Vandecappelle]
- rebase on master

Supersedes v1: https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/

 package/c-capnproto/Config.in  | 6 ++++--
 package/capnproto/Config.in    | 8 ++++++--
 package/capnproto/capnproto.mk | 5 ++---
 3 files changed, 12 insertions(+), 7 deletions(-)
package/c-capnproto/Config.in +4 -2
index c472128c3f..abe2a602ba 100644
@@ -7,7 +7,8 @@ config BR2_PACKAGE_C_CAPNPROTO
 	depends on BR2_TOOLCHAIN_HAS_THREADS # capnproto
 	depends on BR2_TOOLCHAIN_HAS_ATOMIC # capnproto
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # capnproto
-	depends on BR2_TOOLCHAIN_HAS_UCONTEXT # capnproto
+	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS # capnproto
 	select BR2_PACKAGE_CAPNPROTO
 	help
 	  A C plugin for Cap'n Proto. Generates the code generator
@@ -24,4 +25,5 @@ comment "c-capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, u
 		!BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_TOOLCHAIN_HAS_ATOMIC || \
 		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
-		!BR2_TOOLCHAIN_HAS_UCONTEXT
+		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
+			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
package/capnproto/Config.in +6 -2
index 943ba9de29..4654b5ad77 100644
@@ -7,7 +7,10 @@ config BR2_PACKAGE_CAPNPROTO
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735
-	depends on BR2_TOOLCHAIN_HAS_UCONTEXT
+	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
+	select BR2_PACKAGE_LIBUCONTEXT if \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS && !BR2_TOOLCHAIN_HAS_UCONTEXT
 	help
 	  Cap'n Proto is an insanely fast data interchange format
 	  and capability-based RPC system. Think JSON, except
@@ -25,4 +28,5 @@ comment "capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, uco
 		!BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_TOOLCHAIN_HAS_ATOMIC || \
 		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
-		!BR2_TOOLCHAIN_HAS_UCONTEXT
+		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
+			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
package/capnproto/capnproto.mk +2 -3
index f51e037532..d5be2a3d6c 100644
@@ -33,9 +33,8 @@ else
 CAPNPROTO_CONF_OPTS += --without-openssl
 endif
 
-# musl doesn't support getcontext/setcontext
-ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
-CAPNPROTO_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -DKJ_USE_FIBERS=0"
+ifeq ($(BR2_PACKAGE_LIBUCONTEXT),y)
+CAPNPROTO_DEPENDENCIES += libucontext
 endif
 
 $(eval $(autotools-package))
Signature · 6 lines
2.53.0

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