Merge bitcoin/bitcoin#32760: depends: capnp 1.2.0

c7eaac326a depends: capnp 1.2.0 (fanquake)

Pull request description:

  See https://github.com/capnproto/capnproto/compare/release-1.1.0...release-1.2.0. We can drop all the patches we are currently applying.

ACKs for top commit:
  Sjors:
    ACK c7eaac326a
  theStack:
    ACK c7eaac326a
  ryanofsky:
    Code review ACK c7eaac326a. Just checked hashes, compared tarball to git and diffed 1.1.0 and 1.2.0 tarballs which showed only minor and expected changes.

Tree-SHA512: 75085ec96952e9693c67531c3d04cd0d7df580dd1df35ce50dff618b29f651674c17a84e9089c6b7ed230e2b4fd0a7f24e2220e983ec00235db9a9d1ee2d7116
This commit is contained in:
Ryan Ofsky
2025-06-16 12:17:00 -04:00
5 changed files with 2 additions and 227 deletions

View File

@@ -4,8 +4,6 @@ $(package)_download_path=$(native_$(package)_download_path)
$(package)_download_file=$(native_$(package)_download_file)
$(package)_file_name=$(native_$(package)_file_name)
$(package)_sha256_hash=$(native_$(package)_sha256_hash)
$(package)_patches=abi_placement_new.patch
$(package)_patches += fix_openbsd_build.patch
define $(package)_set_vars
$(package)_config_opts := -DBUILD_TESTING=OFF
@@ -14,11 +12,6 @@ define $(package)_set_vars
$(package)_cxxflags += -fdebug-prefix-map=$($(package)_extract_dir)=/usr -fmacro-prefix-map=$($(package)_extract_dir)=/usr
endef
define $(package)_preprocess_cmds
patch -p2 < $($(package)_patch_dir)/abi_placement_new.patch && \
patch -p2 < $($(package)_patch_dir)/fix_openbsd_build.patch
endef
define $(package)_config_cmds
$($(package)_cmake) .
endef

View File

@@ -1,10 +1,9 @@
package=native_capnp
$(package)_version=1.1.0
$(package)_version=1.2.0
$(package)_download_path=https://capnproto.org/
$(package)_download_file=capnproto-c++-$($(package)_version).tar.gz
$(package)_file_name=capnproto-cxx-$($(package)_version).tar.gz
$(package)_sha256_hash=07167580e563f5e821e3b2af1c238c16ec7181612650c5901330fa9a0da50939
$(package)_patches=fix_openbsd_build.patch
$(package)_sha256_hash=ed00e44ecbbda5186bc78a41ba64a8dc4a861b5f8d4e822959b0144ae6fd42ef
define $(package)_set_vars
$(package)_config_opts := -DBUILD_TESTING=OFF
@@ -12,10 +11,6 @@ define $(package)_set_vars
$(package)_config_opts += -DWITH_ZLIB=OFF
endef
define $(package)_preprocess_cmds
patch -p2 < $($(package)_patch_dir)/fix_openbsd_build.patch
endef
define $(package)_config_cmds
$($(package)_cmake) .
endef

View File

@@ -1,71 +0,0 @@
From 74560f26f75dda4257dce541ca362a1e763b2971 Mon Sep 17 00:00:00 2001
From: Ryan Ofsky <ryan@ofsky.org>
Date: Thu, 6 Feb 2025 08:39:05 -0500
Subject: [PATCH 1/1] Avoid gcc/clang ABI incompatibility caused by
PlacementNew
GCC and clang do not use same calling convention for passing empty struct
parameters. There is more information about this in
https://itanium-cxx-abi.github.io/cxx-abi/cxx-abi-dev/archives/2015-December/002869.html
Unfortunately this can create an issue in capnproto if it is built without
optimizations in GCC, and the resulting static libraries are used in a clang
program, or vice versa.
Depending on what order libraries are specified on the linker command line, and
whether code compiled with the other compiler is calling any header functions
that cause weak a `operator new(unsigned int, kj::_::PlacementNew, void*)`
symbol to be defined in its own objects, this can cause the linker to link a
GCC-generated `kj::ctor` with a clang-generated `operator new`, and the
resulting program to crash due to the compilers using different calling
conventions for `operator new`.
This problem is difficult to avoid in general, but pretty easy to avoid here by
changing `operator new` parameter order so the empty struct parameter is last.
This change should be beneficial for capnproto users that may be compiling it
without optimizations, and not necessarily using a single compiler to build all
their dependencies.
The problem does not occur if any optimizations are enabled because `operator
new` calls are inlined in that case.
---
c++/src/kj/common.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/c++/src/kj/common.h b/c++/src/kj/common.h
index b8edde3c..28ab11d6 100644
--- a/c++/src/kj/common.h
+++ b/c++/src/kj/common.h
@@ -1034,24 +1034,27 @@ private:
// We want placement new, but we don't want to #include <new>. operator new cannot be defined in
// a namespace, and defining it globally conflicts with the definition in <new>. So we have to
-// define a dummy type and an operator new that uses it.
+// define a dummy type and an operator new that uses it. The dummy type is intentionally passed
+// as the last parameter so clang and GCC ABI calling conventions for empty struct struct parameters
+// are compatible, and there are not segfaults trying to call clang operator new/delete from GCC or
+// vice versa.
namespace _ { // private
struct PlacementNew {};
} // namespace _ (private)
} // namespace kj
-inline void* operator new(size_t, kj::_::PlacementNew, void* __p) noexcept {
+inline void* operator new(size_t, void* __p, kj::_::PlacementNew) noexcept {
return __p;
}
-inline void operator delete(void*, kj::_::PlacementNew, void* __p) noexcept {}
+inline void operator delete(void*, void* __p, kj::_::PlacementNew) noexcept {}
namespace kj {
template <typename T, typename... Params>
inline void ctor(T& location, Params&&... params) {
- new (_::PlacementNew(), &location) T(kj::fwd<Params>(params)...);
+ new (&location, _::PlacementNew()) T(kj::fwd<Params>(params)...);
}
template <typename T>

View File

@@ -1,71 +0,0 @@
From 0cd1792332dce6a3afae6e2bc2939da69fea65fa Mon Sep 17 00:00:00 2001
From: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
Date: Sat, 31 May 2025 00:49:44 +0200
Subject: [PATCH 1/2] In cidr.c++, include <netinet/in.h> on all non-Windows
systems
The motivation for this commit is to fix the build for OpenBSD,
but it may also solves the same potential problem for other systems
without causing any harm.
Suggested already twice, see
https://github.com/capnproto/capnproto/pull/1846#discussion_r1399499535
https://github.com/capnproto/capnproto/pull/1907#discussion_r1452602424
---
c++/src/kj/cidr.c++ | 3 ---
1 file changed, 3 deletions(-)
diff --git a/c++/src/kj/cidr.c++ b/c++/src/kj/cidr.c++
index 6a1fa32e..9432b8f4 100644
--- a/c++/src/kj/cidr.c++
+++ b/c++/src/kj/cidr.c++
@@ -39,9 +39,6 @@
#else
#include <sys/socket.h>
#include <arpa/inet.h>
-#endif
-
-#if __FreeBSD__
#include <netinet/in.h>
#endif
--
2.49.0
From 2e76d17db3fc484061487c0779b16495939d30c3 Mon Sep 17 00:00:00 2001
From: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
Date: Sat, 31 May 2025 01:06:42 +0200
Subject: [PATCH 2/2] Don't set KJ_USE_KQUEUE on OpenBSD
OpenBSD doesn't support user event filters yet, hence
the build fails as it misses the symbol EVFILT_USER in
the kqueue implementation in async-unix.c++. Fix that
by not setting KJ_USE_KQUEUE on OpenBSD, so the poll()-
based implementation is used instead.
Suggested in
https://github.com/capnproto/capnproto/pull/1907/commits/829d3f03735f8f6762a50fc346db56bf02140f02#r1452600300
---
c++/src/kj/async-unix.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/c++/src/kj/async-unix.h b/c++/src/kj/async-unix.h
index 665305ea..e66ad8e4 100644
--- a/c++/src/kj/async-unix.h
+++ b/c++/src/kj/async-unix.h
@@ -37,8 +37,9 @@ KJ_BEGIN_HEADER
#if __linux__
// Default to epoll on Linux.
#define KJ_USE_EPOLL 1
-#elif __APPLE__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__
-// MacOS and BSDs prefer kqueue() for event notification.
+#elif __APPLE__ || __FreeBSD__ || __NetBSD__ || __DragonFly__
+// MacOS and most BSDs prefer kqueue() for event notification.
+// (Note that OpenBSD's kqueue(2) doesn't support user event filters yet)
#define KJ_USE_KQUEUE 1
#endif
#endif
--
2.49.0

View File

@@ -1,71 +0,0 @@
From 0cd1792332dce6a3afae6e2bc2939da69fea65fa Mon Sep 17 00:00:00 2001
From: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
Date: Sat, 31 May 2025 00:49:44 +0200
Subject: [PATCH 1/2] In cidr.c++, include <netinet/in.h> on all non-Windows
systems
The motivation for this commit is to fix the build for OpenBSD,
but it may also solves the same potential problem for other systems
without causing any harm.
Suggested already twice, see
https://github.com/capnproto/capnproto/pull/1846#discussion_r1399499535
https://github.com/capnproto/capnproto/pull/1907#discussion_r1452602424
---
c++/src/kj/cidr.c++ | 3 ---
1 file changed, 3 deletions(-)
diff --git a/c++/src/kj/cidr.c++ b/c++/src/kj/cidr.c++
index 6a1fa32e..9432b8f4 100644
--- a/c++/src/kj/cidr.c++
+++ b/c++/src/kj/cidr.c++
@@ -39,9 +39,6 @@
#else
#include <sys/socket.h>
#include <arpa/inet.h>
-#endif
-
-#if __FreeBSD__
#include <netinet/in.h>
#endif
--
2.49.0
From 2e76d17db3fc484061487c0779b16495939d30c3 Mon Sep 17 00:00:00 2001
From: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
Date: Sat, 31 May 2025 01:06:42 +0200
Subject: [PATCH 2/2] Don't set KJ_USE_KQUEUE on OpenBSD
OpenBSD doesn't support user event filters yet, hence
the build fails as it misses the symbol EVFILT_USER in
the kqueue implementation in async-unix.c++. Fix that
by not setting KJ_USE_KQUEUE on OpenBSD, so the poll()-
based implementation is used instead.
Suggested in
https://github.com/capnproto/capnproto/pull/1907/commits/829d3f03735f8f6762a50fc346db56bf02140f02#r1452600300
---
c++/src/kj/async-unix.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/c++/src/kj/async-unix.h b/c++/src/kj/async-unix.h
index 665305ea..e66ad8e4 100644
--- a/c++/src/kj/async-unix.h
+++ b/c++/src/kj/async-unix.h
@@ -37,8 +37,9 @@ KJ_BEGIN_HEADER
#if __linux__
// Default to epoll on Linux.
#define KJ_USE_EPOLL 1
-#elif __APPLE__ || __FreeBSD__ || __OpenBSD__ || __NetBSD__ || __DragonFly__
-// MacOS and BSDs prefer kqueue() for event notification.
+#elif __APPLE__ || __FreeBSD__ || __NetBSD__ || __DragonFly__
+// MacOS and most BSDs prefer kqueue() for event notification.
+// (Note that OpenBSD's kqueue(2) doesn't support user event filters yet)
#define KJ_USE_KQUEUE 1
#endif
#endif
--
2.49.0