bpftrace: fix build with libbpf 0.6.0

libbpf 0.6.0 relies on typeof in bpf/btf.h to pick the right version of
btf_dump__new() but that's not valid c++.
see https://github.com/iovisor/bpftrace/issues/2068
This commit is contained in:
Dominique Martinet 2021-12-04 21:54:07 +09:00
parent 559fe43665
commit fa857bb435
2 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,39 @@
diff -ur source/src/btf.cpp new/src/btf.cpp
--- source/src/btf.cpp 1970-01-01 09:00:01.000000000 +0900
+++ new/src/btf.cpp 2021-12-04 21:46:59.337023489 +0900
@@ -225,7 +225,7 @@
char err_buf[256];
int err;
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
err = libbpf_get_error(dump);
if (err)
{
@@ -496,7 +496,7 @@
char err_buf[256];
int err;
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
err = libbpf_get_error(dump);
if (err)
{
@@ -554,7 +554,7 @@
char err_buf[256];
int err;
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
err = libbpf_get_error(dump);
if (err)
{
@@ -648,7 +648,7 @@
char err_buf[256];
int err;
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
err = libbpf_get_error(dump);
if (err)
{

View file

@ -17,6 +17,11 @@ stdenv.mkDerivation rec {
sha256 = "sha256-rlaajNfpoiMtU/4aNAnbQ0VixPz9/302TZMarGzsb58=";
};
# libbpf 0.6.0 relies on typeof in bpf/btf.h to pick the right version of
# btf_dump__new() but that's not valid c++.
# see https://github.com/iovisor/bpftrace/issues/2068
patches = [ ./btf-dump-new-0.6.0.patch ];
buildInputs = with llvmPackages;
[ llvm libclang
elfutils libelf bcc