Skip to content

Commit e158a2a

Browse files
0xB10Cfanquake
andcommitted
build: add systemtap's sys/sdt.h as depends
The sys/sdt.h header is required to build Bitcoin Core with Userspace Statically Defined Tracing support. Systemtap version 4.5 (May 2021) is used as the most recent version 4.6 (Nov 2021) fails to build. See e.g. https://sourceware.org/git/?p=systemtap.git;a=commit;h=1d3653936fc1fd13135a723a27e6c7e959793ad0 As Systemtap itself is not needed, the build steps (configure and make) are skipped. We require fewer build dependecies and don't waste time building depends we don't end up using. However, the configure step would normally processes sys/sdt-config.h.in. The resulting sdt-config.h defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT (either 0 or 1 to indicate whether the assembler supports "?" in .pushsection directives). For now, we assume all currently used assemblers supports this feature and remove the check from the sys/sdt.h header file in a patch. Co-authored-by: Michael Ford <[email protected]>
1 parent 38146a4 commit e158a2a

File tree

6 files changed

+54
-2
lines changed

6 files changed

+54
-2
lines changed

depends/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ NO_SQLITE ?=
3939
NO_WALLET ?=
4040
NO_ZMQ ?=
4141
NO_UPNP ?=
42+
NO_USDT ?=
4243
NO_NATPMP ?=
4344
MULTIPROCESS ?=
4445
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
@@ -149,8 +150,9 @@ natpmp_packages_$(NO_NATPMP) = $(natpmp_packages)
149150

150151
zmq_packages_$(NO_ZMQ) = $(zmq_packages)
151152
multiprocess_packages_$(MULTIPROCESS) = $(multiprocess_packages)
153+
usdt_packages_$(NO_USDT) = $(usdt_$(host_os)_packages)
152154

153-
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(natpmp_packages_)
155+
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(natpmp_packages_) $(usdt_packages_)
154156
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
155157

156158
ifneq ($(zmq_packages_),)
@@ -228,6 +230,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
228230
-e 's|@no_bdb@|$(NO_BDB)|' \
229231
-e 's|@no_sqlite@|$(NO_SQLITE)|' \
230232
-e 's|@no_upnp@|$(NO_UPNP)|' \
233+
-e 's|@no_usdt@|$(NO_USDT)|' \
231234
-e 's|@no_natpmp@|$(NO_NATPMP)|' \
232235
-e 's|@multiprocess@|$(MULTIPROCESS)|' \
233236
-e 's|@debug@|$(DEBUG)|' \

depends/config.site.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ if test -z "$enable_zmq" && test -n "@no_zmq@"; then
7070
enable_zmq=no
7171
fi
7272

73+
if test -z "$enable_usdt" && test -n "@no_usdt@"; then
74+
enable_usdt=no
75+
fi
76+
7377
if test "@host_os@" = darwin; then
7478
BREW=no
7579
fi

depends/packages/packages.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ natpmp_packages=libnatpmp
1919
multiprocess_packages = libmultiprocess capnp
2020
multiprocess_native_packages = native_libmultiprocess native_capnp
2121

22+
usdt_linux_packages=systemtap
23+
2224
darwin_native_packages = native_ds_store native_mac_alias
2325

2426
$(host_arch)_$(host_os)_native_packages += native_b2

depends/packages/systemtap.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package=systemtap
2+
$(package)_version=4.5
3+
$(package)_download_path=https://sourceware.org/systemtap/ftp/releases/
4+
$(package)_file_name=$(package)-$($(package)_version).tar.gz
5+
$(package)_sha256_hash=75078ed37e0dd2a769c9d1f9394170b2d9f4d7daa425f43ca80c13bad6cfc925
6+
$(package)_patches=remove_SDT_ASM_SECTION_AUTOGROUP_SUPPORT_check.patch
7+
8+
define $(package)_preprocess_cmds
9+
patch -p1 < $($(package)_patch_dir)/remove_SDT_ASM_SECTION_AUTOGROUP_SUPPORT_check.patch && \
10+
mkdir -p $($(package)_staging_prefix_dir)/include/sys && \
11+
cp includes/sys/sdt.h $($(package)_staging_prefix_dir)/include/sys/sdt.h
12+
endef
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
commit b92d4c121486f3c6e8a2cea537c53eb09894479a
2+
Author: 0xb10c <[email protected]>
3+
Date: Tue Dec 7 11:02:07 2021 +0100
4+
5+
Remove _SDT_ASM_SECTION_AUTOGROUP_SUPPORT check
6+
7+
We assume that the assembler supports "?" in .pushsection directives.
8+
This enables us to skip configure and make.
9+
10+
See https://github.com/bitcoin/bitcoin/issues/23297.
11+
12+
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
13+
index 97766e710..352b4ee25 100644
14+
--- a/includes/sys/sdt.h
15+
+++ b/includes/sys/sdt.h
16+
@@ -230,12 +230,10 @@ __extension__ extern unsigned long long __sdt_unsp;
17+
nice with code in COMDAT sections, which comes up in C++ code.
18+
Without that assembler support, some combinations of probe placements
19+
in certain kinds of C++ code may produce link-time errors. */
20+
-#include "sdt-config.h"
21+
-#if _SDT_ASM_SECTION_AUTOGROUP_SUPPORT
22+
+/* PATCH: We assume that the assembler supports the feature. This
23+
+ enables us to skip configure and make. In turn, this means we
24+
+ require fewer dependencies and have shorter depend build times. */
25+
# define _SDT_ASM_AUTOGROUP "?"
26+
-#else
27+
-# define _SDT_ASM_AUTOGROUP ""
28+
-#endif
29+
30+
#define _SDT_ASM_BODY(provider, name, pack_args, args) \
31+
_SDT_ASM_1(990: _SDT_NOP) \

doc/dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ These are the dependencies currently used by Bitcoin Core. You can find instruct
2424
| Qt | [5.12.11](https://download.qt.io/official_releases/qt/) | [5.9.5](https://github.com/bitcoin/bitcoin/issues/20104) | No | | |
2525
| SQLite | [3.32.1](https://sqlite.org/download.html) | [3.7.17](https://github.com/bitcoin/bitcoin/pull/19077) | | | |
2626
| XCB | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) (Linux only) |
27-
| systemtap ([tracing](tracing.md))| | | | | |
27+
| systemtap ([tracing](tracing.md))| [4.5](https://sourceware.org/systemtap/ftp/releases/) | | | | |
2828
| xkbcommon | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) (Linux only) |
2929
| ZeroMQ | [4.3.1](https://github.com/zeromq/libzmq/releases) | 4.0.0 | No | | |
3030
| zlib | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) |

0 commit comments

Comments
 (0)