summaryrefslogtreecommitdiff
path: root/repo/pahole
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-12-19 23:07:05 +0000
committerdavidovski <david@davidovski.xyz>2022-12-19 23:07:05 +0000
commit05d004dfe0c9a9d898fac8a4a0292ca2a74ca391 (patch)
tree0b058ac267139f2a0525dec42b307664363e5b11 /repo/pahole
parent4c61af227b0fb3e028c877dc1c2e0b6513960762 (diff)
Making things work
Diffstat (limited to 'repo/pahole')
-rw-r--r--repo/pahole/0001-libbpf-Update-libbpf-to-the-latest-git-HEAD.patch120
-rw-r--r--repo/pahole/pahole.xibuild40
2 files changed, 146 insertions, 14 deletions
diff --git a/repo/pahole/0001-libbpf-Update-libbpf-to-the-latest-git-HEAD.patch b/repo/pahole/0001-libbpf-Update-libbpf-to-the-latest-git-HEAD.patch
new file mode 100644
index 0000000..34e616b
--- /dev/null
+++ b/repo/pahole/0001-libbpf-Update-libbpf-to-the-latest-git-HEAD.patch
@@ -0,0 +1,120 @@
+From c0cf45c77c8ff72b141605a0d7ec79d2cd577ee8 Mon Sep 17 00:00:00 2001
+From: Kui-Feng Lee <kuifeng@fb.com>
+Date: Wed, 26 Jan 2022 11:20:39 -0800
+Subject: [PATCH] libbpf: Update libbpf to the latest git HEAD
+
+Replace deprecated APIs with new ones.
+
+Signed-off-by: Kui-Feng Lee <kuifeng@fb.com>
+Acked-by: Andrii Nakryiko <andrii@kernel.org>
+Cc: Alexei Starovoitov <ast@kernel.org>
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Cc: bpf@vger.kernel.org
+Cc: dwarves@vger.kernel.org
+Link: https://lore.kernel.org/r/20220126192039.2840752-5-kuifeng@fb.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+---
+
+Upstream commit 73383b3a39afe86b22e098773e47b8546c48a649
+not strictly required but fixes incompatibilities when building with
+libbpf 0.7.0
+
+ btf_encoder.c | 20 ++++++++++----------
+ btf_loader.c | 2 +-
+ lib/bpf | 2 +-
+ 3 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/btf_encoder.c b/btf_encoder.c
+index 9d015f304e92..4aa003b6aa54 100644
+--- a/btf_encoder.c
++++ b/btf_encoder.c
+@@ -172,7 +172,7 @@ __attribute ((format (printf, 5, 6)))
+ static void btf__log_err(const struct btf *btf, int kind, const char *name,
+ bool output_cr, const char *fmt, ...)
+ {
+- fprintf(stderr, "[%u] %s %s", btf__get_nr_types(btf) + 1,
++ fprintf(stderr, "[%u] %s %s", btf__type_cnt(btf),
+ btf_kind_str[kind], name ?: "(anon)");
+
+ if (fmt && *fmt) {
+@@ -203,7 +203,7 @@ static void btf_encoder__log_type(const struct btf_encoder *encoder, const struc
+ out = err ? stderr : stdout;
+
+ fprintf(out, "[%u] %s %s",
+- btf__get_nr_types(btf), btf_kind_str[kind],
++ btf__type_cnt(btf) - 1, btf_kind_str[kind],
+ btf__printable_name(btf, t->name_off));
+
+ if (fmt && *fmt) {
+@@ -449,10 +449,10 @@ static int btf_encoder__add_field(struct btf_encoder *encoder, const char *name,
+ int err;
+
+ err = btf__add_field(btf, name, type, offset, bitfield_size);
+- t = btf__type_by_id(btf, btf__get_nr_types(btf));
++ t = btf__type_by_id(btf, btf__type_cnt(btf) - 1);
+ if (err) {
+ fprintf(stderr, "[%u] %s %s's field '%s' offset=%u bit_size=%u type=%u Error emitting field\n",
+- btf__get_nr_types(btf), btf_kind_str[btf_kind(t)],
++ btf__type_cnt(btf) - 1, btf_kind_str[btf_kind(t)],
+ btf__printable_name(btf, t->name_off),
+ name, offset, bitfield_size, type);
+ } else {
+@@ -899,9 +899,9 @@ static int btf_encoder__write_raw_file(struct btf_encoder *encoder)
+ const void *raw_btf_data;
+ int fd, err;
+
+- raw_btf_data = btf__get_raw_data(encoder->btf, &raw_btf_size);
++ raw_btf_data = btf__raw_data(encoder->btf, &raw_btf_size);
+ if (raw_btf_data == NULL) {
+- fprintf(stderr, "%s: btf__get_raw_data failed!\n", __func__);
++ fprintf(stderr, "%s: btf__raw_data failed!\n", __func__);
+ return -1;
+ }
+
+@@ -976,7 +976,7 @@ static int btf_encoder__write_elf(struct btf_encoder *encoder)
+ }
+ }
+
+- raw_btf_data = btf__get_raw_data(btf, &raw_btf_size);
++ raw_btf_data = btf__raw_data(btf, &raw_btf_size);
+
+ if (btf_data) {
+ /* Existing .BTF section found */
+@@ -1043,10 +1043,10 @@ int btf_encoder__encode(struct btf_encoder *encoder)
+ btf_encoder__add_datasec(encoder, PERCPU_SECTION);
+
+ /* Empty file, nothing to do, so... done! */
+- if (btf__get_nr_types(encoder->btf) == 0)
++ if (btf__type_cnt(encoder->btf) == 1)
+ return 0;
+
+- if (btf__dedup(encoder->btf, NULL, NULL)) {
++ if (btf__dedup(encoder->btf, NULL)) {
+ fprintf(stderr, "%s: btf__dedup failed!\n", __func__);
+ return -1;
+ }
+@@ -1403,7 +1403,7 @@ void btf_encoder__delete(struct btf_encoder *encoder)
+
+ int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu)
+ {
+- uint32_t type_id_off = btf__get_nr_types(encoder->btf);
++ uint32_t type_id_off = btf__type_cnt(encoder->btf) - 1;
+ struct llvm_annotation *annot;
+ int btf_type_id, tag_type_id;
+ uint32_t core_id;
+diff --git a/btf_loader.c b/btf_loader.c
+index 7a5b16ff393e..c7d69ccea4d3 100644
+--- a/btf_loader.c
++++ b/btf_loader.c
+@@ -399,7 +399,7 @@ static int btf__load_types(struct btf *btf, struct cu *cu)
+ uint32_t type_index;
+ int err;
+
+- for (type_index = 1; type_index <= btf__get_nr_types(btf); type_index++) {
++ for (type_index = 1; type_index < btf__type_cnt(btf); type_index++) {
+ const struct btf_type *type_ptr = btf__type_by_id(btf, type_index);
+ uint32_t type = btf_kind(type_ptr);
+
+--
+2.35.1
+
diff --git a/repo/pahole/pahole.xibuild b/repo/pahole/pahole.xibuild
index 821c4f5..46586dc 100644
--- a/repo/pahole/pahole.xibuild
+++ b/repo/pahole/pahole.xibuild
@@ -1,22 +1,34 @@
#!/bin/sh
-MAKEDEPS="cmake-modules python make "
-DEPS="libelf python elfutils libdwarf musl-obstack argp-standalone"
+NAME="pahole"
+DESC="dwarf manipulation utilities"
-PKG_VER=1.22
-SOURCE=https://git.kernel.org/pub/scm/devel/pahole/pahole.git
-BRANCH=v$PKG_VER
+MAKEDEPS=" cmake elfutils libdwarf zlib libbpf linux-headers musl-obstack argp-standalone samurai"
-DESC="Pahole and other DWARF Utils"
+PKG_VER=1.24
+SOURCE="https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-v$PKG_VER.tar.gz"
-build () {
- cmake -B build -G Ninja . \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_BUILD_TYPE=None \
- -D__LIB=lib
- cmake --build build
+ADDITIONAL="
+0001-libbpf-Update-libbpf-to-the-latest-git-HEAD.patch
+"
+
+prepare () {
+ apply_patches
}
-package () {
- DESTDIR="$PKG_DEST" cmake --install build
+build() {
+ export CFLAGS="$CFLAGS -I/usr/include/bpf/uapi"
+
+ cmake -B build -G Ninja . \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_BUILD_TYPE=None \
+ -D__LIB=lib \
+ -DCMAKE_MODULE_PATH=/usr/lib/cmake \
+ -DLIBBPF_EMBEDDED=OFF
+ cmake --build build
}
+
+package() {
+ DESTDIR="$PKG_DEST" cmake --build build --target install
+}
+