40 lines
1.2 KiB
Diff
40 lines
1.2 KiB
Diff
|
From 0e79852bfd9d8f8efd0091abc7e15b964c79cc0d Mon Sep 17 00:00:00 2001
|
||
|
From: Jerome Marchand <jmarchan@redhat.com>
|
||
|
Date: Wed, 23 Mar 2022 09:47:25 +0100
|
||
|
Subject: [PATCH 3/6] Fix libbtf 0.6.0 build
|
||
|
|
||
|
Libbtf 0.6.0 introduced a new version of btf_dump__new(). The new
|
||
|
version is btf_dump__new_v0_6_0() while the old version was renamed
|
||
|
btf_dump__new_deprecated(). btf_dump__new() is now overloaded,
|
||
|
unfortunately the macro doesn't work on cpp, at least with LLVM 12.
|
||
|
Let's call btf_dump__new_deprecated() explicitely when it's defined.
|
||
|
|
||
|
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
||
|
---
|
||
|
src/btf.cpp | 9 +++++++++
|
||
|
1 file changed, 9 insertions(+)
|
||
|
|
||
|
diff --git a/src/btf.cpp b/src/btf.cpp
|
||
|
index a5a5e2c0..fccf0a00 100644
|
||
|
--- a/src/btf.cpp
|
||
|
+++ b/src/btf.cpp
|
||
|
@@ -24,6 +24,15 @@
|
||
|
#pragma GCC diagnostic pop
|
||
|
#include <bpf/libbpf.h>
|
||
|
|
||
|
+/*
|
||
|
+ * Since libbtf 0.6, btf_dump__new() has been overloaded and now can design
|
||
|
+ * either btf_dump__new_v0_6_0() or btf_dump__new_deprecated(), which is the
|
||
|
+ * same as btf_dump__new() for libbtf < 0.6, and the one we still use.
|
||
|
+ */
|
||
|
+#if LIBBPF_MAJOR_VERSION == 0 && LIBBPF_MINOR_VERSION >= 6
|
||
|
+#define btf_dump__new(a1, a2, a3, a4) btf_dump__new_deprecated(a1, a2, a3, a4)
|
||
|
+#endif
|
||
|
+
|
||
|
#include "bpftrace.h"
|
||
|
|
||
|
namespace bpftrace {
|
||
|
--
|
||
|
2.35.3
|
||
|
|