summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Include-missing-c-runtime-headers.patch39
-rw-r--r--meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Raise-max-supported-clang-version-to-clang-21.patch24
-rw-r--r--meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch11
-rw-r--r--meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-chrono-Fix-build-when-using-libc-casting-ns-to-syste.patch54
-rw-r--r--meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0003-ast-Adapt-to-Clang-LLVM-21-DiagnosticOptions-API.patch78
-rw-r--r--meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.0.bb (renamed from meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.23.5.bb)9
6 files changed, 208 insertions, 7 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Include-missing-c-runtime-headers.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Include-missing-c-runtime-headers.patch
new file mode 100644
index 0000000000..d3009fa295
--- /dev/null
+++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Include-missing-c-runtime-headers.patch
@@ -0,0 +1,39 @@
1From ead4dc45e35fc6c3770ef4021720e0e6a5b60674 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 31 Aug 2025 15:23:27 -0700
4Subject: [PATCH 1/3] Include missing c++ runtime headers
5
6These headers are required and found to fail builds
7when using llvm/libc++ instead of libstdc++ on linux
8
9Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/4526]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/util/bpf_names.cpp | 1 +
13 tests/opaque.cpp | 1 +
14 2 files changed, 2 insertions(+)
15
16diff --git a/src/util/bpf_names.cpp b/src/util/bpf_names.cpp
17index 68525bfc..ab8f6f2f 100644
18--- a/src/util/bpf_names.cpp
19+++ b/src/util/bpf_names.cpp
20@@ -1,6 +1,7 @@
21 #include <algorithm>
22 #include <iomanip>
23 #include <iostream>
24+#include <sstream> // for std::ostringstream
25
26 #include "util/bpf_names.h"
27
28diff --git a/tests/opaque.cpp b/tests/opaque.cpp
29index a030a05d..034888d3 100644
30--- a/tests/opaque.cpp
31+++ b/tests/opaque.cpp
32@@ -1,6 +1,7 @@
33 #include "util/opaque.h"
34 #include "gtest/gtest.h"
35 #include <cstring>
36+#include <numbers> // for std::numbers
37 #include <string>
38 #include <vector>
39
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Raise-max-supported-clang-version-to-clang-21.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Raise-max-supported-clang-version-to-clang-21.patch
new file mode 100644
index 0000000000..3fb8d131b6
--- /dev/null
+++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Raise-max-supported-clang-version-to-clang-21.patch
@@ -0,0 +1,24 @@
1From 7bd8ec690ad587e7f180bcd061a6205b28d86260 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 31 Aug 2025 09:50:35 -0700
4Subject: [PATCH] cmake: Raise max supported clang version to clang-21
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 CMakeLists.txt | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/CMakeLists.txt b/CMakeLists.txt
13index 025fa738..a0f16dd1 100644
14--- a/CMakeLists.txt
15+++ b/CMakeLists.txt
16@@ -172,7 +172,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
17 # releases.
18 set(MAX_LLVM_MAJOR 999)
19 else()
20- set(MAX_LLVM_MAJOR 20)
21+ set(MAX_LLVM_MAJOR 21)
22 endif()
23
24 if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch
index 4f0ebbf564..c9e1749dd5 100644
--- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch
+++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch
@@ -12,7 +12,7 @@ Upstream-Status: Pending
12 12
13--- a/CMakeLists.txt 13--- a/CMakeLists.txt
14+++ b/CMakeLists.txt 14+++ b/CMakeLists.txt
15@@ -100,16 +100,20 @@ include_directories(SYSTEM ${LIBCEREAL_I 15@@ -108,16 +108,21 @@ include_directories(SYSTEM ${LIBCEREAL_I
16 16
17 find_package(BISON REQUIRED) 17 find_package(BISON REQUIRED)
18 find_package(FLEX REQUIRED) 18 find_package(FLEX REQUIRED)
@@ -20,15 +20,16 @@ Upstream-Status: Pending
20+# avoid buildpaths in generated #line statements and allow to pass --file-prefix-map=OLD=NEW 20+# avoid buildpaths in generated #line statements and allow to pass --file-prefix-map=OLD=NEW
21+set(BISON_FLAGS "${BISON_FLAGS} -l") 21+set(BISON_FLAGS "${BISON_FLAGS} -l")
22+set(FLEX_FLAGS "${FLEX_FLAGS} -L") 22+set(FLEX_FLAGS "${FLEX_FLAGS} -L")
23+
23 # `parser_class_name` is deprecated and generates warnings in bison >= 3.3. 24 # `parser_class_name` is deprecated and generates warnings in bison >= 3.3.
24 # But `api.parser.class` is not supported in bison < 3.3. So we must inject 25 # But `api.parser.class` is not supported in bison < 3.3. So we must inject
25 # the %define based on the bison version here. 26 # the %define based on the bison version here.
26 if(${BISON_VERSION} VERSION_GREATER_EQUAL 3.3) 27 if(${BISON_VERSION} VERSION_GREATER_EQUAL 3.3)
27- set(BISON_FLAGS "-Dapi.parser.class={Parser}") 28- set(BISON_FLAGS "-Dapi.parser.class={Parser} -Wcounterexamples")
28+ set(BISON_FLAGS "${BISON_FLAGS} -Dapi.parser.class={Parser}") 29+ set(BISON_FLAGS "${BISON_FLAGS} -Dapi.parser.class={Parser} -Wcounterexamples")
29 else() 30 else()
30- set(BISON_FLAGS "-Dparser_class_name={Parser}") 31- set(BISON_FLAGS "-Dparser_class_name={Parser} -Wcounterexamples")
31+ set(BISON_FLAGS "${BISON_FLAGS} -Dparser_class_name={Parser}") 32+ set(BISON_FLAGS "${BISON_FLAGS} -Dparser_class_name={Parser} -Wcounterexamples")
32 endif() 33 endif()
33 bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS ${BISON_FLAGS} VERBOSE) 34 bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS ${BISON_FLAGS} VERBOSE)
34-flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc) 35-flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-chrono-Fix-build-when-using-libc-casting-ns-to-syste.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-chrono-Fix-build-when-using-libc-casting-ns-to-syste.patch
new file mode 100644
index 0000000000..140cc12add
--- /dev/null
+++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-chrono-Fix-build-when-using-libc-casting-ns-to-syste.patch
@@ -0,0 +1,54 @@
1From 381047c14dfbc3b89a5e87404cb7cf886f10c119 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 31 Aug 2025 15:26:36 -0700
4Subject: [PATCH 2/3] chrono: Fix build when using libc++ casting ns to
5 system_clock::duration
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10libc++ from LLVM/Clang 21 release requires that time_point::operator+=
11receive the exact duration type of the time_point. On many Linux configs,
12system_clock::duration is microseconds, so doing:
13
14 t += std::chrono::nanoseconds(...);
15
16fails with:
17 error: no viable overloaded '+='
18 note: candidate function not viable: no known conversion from
19 'duration<..., nano>' to 'const duration<..., micro>' for 1st argument
20
21Cast the nanoseconds to system_clock::duration via duration_cast before
22adding them. This builds with Clang 21 + libc++ and remains compatible
23with libstdc++. Semantics are unchanged except for truncation to the
24clock’s native resolution (which already applies).
25
26No functional change intended.
27
28Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/4526]
29
30Signed-off-by: Khem Raj <raj.khem@gmail.com>
31---
32 src/bpftrace.cpp | 6 ++++--
33 1 file changed, 4 insertions(+), 2 deletions(-)
34
35diff --git a/src/bpftrace.cpp b/src/bpftrace.cpp
36index a49a3efe..485267e0 100644
37--- a/src/bpftrace.cpp
38+++ b/src/bpftrace.cpp
39@@ -992,11 +992,13 @@ std::chrono::time_point<std::chrono::system_clock> BPFtrace::resolve_timestamp(
40 << "Cannot resolve timestamp due to failed boot time calculation";
41 } else {
42 t += std::chrono::seconds(boottime_->tv_sec);
43- t += std::chrono::nanoseconds(boottime_->tv_nsec);
44+ t += std::chrono::duration_cast<std::chrono::system_clock::duration>(
45+ std::chrono::nanoseconds(boottime_->tv_nsec));
46 }
47 }
48
49- t += std::chrono::nanoseconds(nsecs);
50+ t += std::chrono::duration_cast<std::chrono::system_clock::duration>(
51+ std::chrono::nanoseconds(nsecs));
52 return t;
53 }
54
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0003-ast-Adapt-to-Clang-LLVM-21-DiagnosticOptions-API.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0003-ast-Adapt-to-Clang-LLVM-21-DiagnosticOptions-API.patch
new file mode 100644
index 0000000000..e5ae0219f7
--- /dev/null
+++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0003-ast-Adapt-to-Clang-LLVM-21-DiagnosticOptions-API.patch
@@ -0,0 +1,78 @@
1From 9771348249981680c2b893a435099673e79997c4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 31 Aug 2025 15:29:26 -0700
4Subject: [PATCH 3/3] ast: Adapt to Clang/LLVM 21 DiagnosticOptions API
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Clang 21 removed intrusive ref-counting from DiagnosticOptions and
10switched consumers to take a DiagnosticOptions&. Building bpftrace
11with clang-21/libc++ failed with errors like:
12
13 IntrusiveRefCntPtr.h:163: error: no member named 'Retain' in
14 'clang::DiagnosticOptions'
15 Diagnostic.h:578: no known conversion from
16 'IntrusiveRefCntPtr<clang::DiagnosticOptions>' to
17 'DiagnosticOptions&'
18
19Update the frontend glue:
20- For LLVM >= 21, construct a real DiagnosticOptions object and pass
21 it by reference to TextDiagnosticPrinter and DiagnosticsEngine
22 (no IntrusiveRefCntPtr). Keep it alive via shared_ptr to satisfy
23 DiagnosticsEngine’s reference lifetime.
24- Replace ci.setInvocation(inv) with
25 ci.getInvocation() = *inv; which is stable across modern Clang.
26
27Retain the old code path for LLVM < 21 via #if guards.
28
29This fixes builds with clang-21/libc++ while keeping compatibility
30with older LLVM releases.
31
32No functional change intended.
33
34Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/4526]
35
36Signed-off-by: Khem Raj <raj.khem@gmail.com>
37---
38 src/ast/passes/clang_build.cpp | 15 +++++++++++++--
39 1 file changed, 13 insertions(+), 2 deletions(-)
40
41diff --git a/src/ast/passes/clang_build.cpp b/src/ast/passes/clang_build.cpp
42index fa5b2add..3debc350 100644
43--- a/src/ast/passes/clang_build.cpp
44+++ b/src/ast/passes/clang_build.cpp
45@@ -78,12 +78,21 @@ static Result<> build(CompileContext &ctx,
46 // a string, which we can then capture and associate with the import.
47 std::string errstr;
48 llvm::raw_string_ostream err(errstr);
49+#if LLVM_VERSION_MAJOR < 21
50 auto diagOpts = llvm::makeIntrusiveRefCnt<clang::DiagnosticOptions>();
51 auto diags = std::make_unique<clang::DiagnosticsEngine>(
52 llvm::makeIntrusiveRefCnt<clang::DiagnosticIDs>(),
53 diagOpts,
54 new clang::TextDiagnosticPrinter(err, diagOpts.get()));
55-
56+#else
57+ // Clang 21: DiagnosticOptions is NOT intrusive-refcounted anymore.
58+ // Keep it alive for the program lifetime (or store it on a longer-lived object).
59+ static std::shared_ptr<clang::DiagnosticOptions> diagOpts =
60+ std::make_shared<clang::DiagnosticOptions>();
61+ llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagID(new clang::DiagnosticIDs());
62+ auto client = std::make_unique<clang::TextDiagnosticPrinter>(err, *diagOpts);
63+ auto diags = std::make_unique<clang::DiagnosticsEngine>(diagID, *diagOpts, client.release());
64+#endif
65 // We create a temporary memfd that we can use to store the output,
66 // since the ClangDriver API is framed in terms of filenames. Perhaps
67 // we could use the internals here, but that carries other risks.
68@@ -122,7 +131,9 @@ static Result<> build(CompileContext &ctx,
69 inv->getCodeGenOpts().DebugColumnInfo = true;
70
71 clang::CompilerInstance ci;
72- ci.setInvocation(inv);
73+ // Cross-version friendly: assign into the existing invocation
74+ // (works across modern Clang majors, including 21)
75+ ci.getInvocation() = *inv;
76 ci.setDiagnostics(diags.release());
77 ci.setFileManager(new clang::FileManager(clang::FileSystemOptions(), vfs));
78 ci.createSourceManager(ci.getFileManager());
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.23.5.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.0.bb
index 1b2f8ab0e4..7e9cbf485e 100644
--- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.23.5.bb
+++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.0.bb
@@ -7,6 +7,7 @@ DEPENDS += "bison-native \
7 flex-native \ 7 flex-native \
8 gzip-native \ 8 gzip-native \
9 elfutils \ 9 elfutils \
10 bpftool-native \
10 bcc \ 11 bcc \
11 systemtap \ 12 systemtap \
12 libcereal \ 13 libcereal \
@@ -16,11 +17,15 @@ DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-nativ
16 17
17RDEPENDS:${PN} += "bash python3 xz" 18RDEPENDS:${PN} += "bash python3 xz"
18 19
19SRC_URI = "git://github.com/iovisor/bpftrace;branch=release/0.23.x;protocol=https \ 20SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \
20 file://run-ptest \ 21 file://run-ptest \
22 file://0001-cmake-Raise-max-supported-clang-version-to-clang-21.patch \
21 file://0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch \ 23 file://0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch \
24 file://0001-Include-missing-c-runtime-headers.patch \
25 file://0002-chrono-Fix-build-when-using-libc-casting-ns-to-syste.patch \
26 file://0003-ast-Adapt-to-Clang-LLVM-21-DiagnosticOptions-API.patch \
22" 27"
23SRCREV = "e48ccc66c9971515648b63699bc4b1490c388d85" 28SRCREV = "3b78184eed28501ab4bbb55e45c4172538999da1"
24 29
25inherit bash-completion cmake ptest pkgconfig 30inherit bash-completion cmake ptest pkgconfig
26 31