Blame SOURCES/bpftrace-0.13.1-Fix-libbtf-0.6.0-build.patch

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