diff options
| -rw-r--r-- | meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Include-missing-c-runtime-headers.patch | 39 | ||||
| -rw-r--r-- | meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Raise-max-supported-clang-version-to-clang-21.patch | 24 | ||||
| -rw-r--r-- | meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-chrono-Fix-build-when-using-libc-casting-ns-to-syste.patch | 54 | ||||
| -rw-r--r-- | meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0003-ast-Adapt-to-Clang-LLVM-21-DiagnosticOptions-API.patch | 78 | ||||
| -rw-r--r-- | meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.1.bb (renamed from meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.0.bb) | 8 |
5 files changed, 2 insertions, 201 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 deleted file mode 100644 index d3009fa295..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Include-missing-c-runtime-headers.patch +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | From ead4dc45e35fc6c3770ef4021720e0e6a5b60674 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sun, 31 Aug 2025 15:23:27 -0700 | ||
| 4 | Subject: [PATCH 1/3] Include missing c++ runtime headers | ||
| 5 | |||
| 6 | These headers are required and found to fail builds | ||
| 7 | when using llvm/libc++ instead of libstdc++ on linux | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/4526] | ||
| 10 | Signed-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 | |||
| 16 | diff --git a/src/util/bpf_names.cpp b/src/util/bpf_names.cpp | ||
| 17 | index 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 | |||
| 28 | diff --git a/tests/opaque.cpp b/tests/opaque.cpp | ||
| 29 | index 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 deleted file mode 100644 index 3fb8d131b6..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Raise-max-supported-clang-version-to-clang-21.patch +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | From 7bd8ec690ad587e7f180bcd061a6205b28d86260 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sun, 31 Aug 2025 09:50:35 -0700 | ||
| 4 | Subject: [PATCH] cmake: Raise max supported clang version to clang-21 | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 8 | --- | ||
| 9 | CMakeLists.txt | 2 +- | ||
| 10 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 11 | |||
| 12 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 13 | index 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-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 deleted file mode 100644 index 140cc12add..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-chrono-Fix-build-when-using-libc-casting-ns-to-syste.patch +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | From 381047c14dfbc3b89a5e87404cb7cf886f10c119 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sun, 31 Aug 2025 15:26:36 -0700 | ||
| 4 | Subject: [PATCH 2/3] chrono: Fix build when using libc++ casting ns to | ||
| 5 | system_clock::duration | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 9 | |||
| 10 | libc++ from LLVM/Clang 21 release requires that time_point::operator+= | ||
| 11 | receive the exact duration type of the time_point. On many Linux configs, | ||
| 12 | system_clock::duration is microseconds, so doing: | ||
| 13 | |||
| 14 | t += std::chrono::nanoseconds(...); | ||
| 15 | |||
| 16 | fails 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 | |||
| 21 | Cast the nanoseconds to system_clock::duration via duration_cast before | ||
| 22 | adding them. This builds with Clang 21 + libc++ and remains compatible | ||
| 23 | with libstdc++. Semantics are unchanged except for truncation to the | ||
| 24 | clock’s native resolution (which already applies). | ||
| 25 | |||
| 26 | No functional change intended. | ||
| 27 | |||
| 28 | Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/4526] | ||
| 29 | |||
| 30 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 31 | --- | ||
| 32 | src/bpftrace.cpp | 6 ++++-- | ||
| 33 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
| 34 | |||
| 35 | diff --git a/src/bpftrace.cpp b/src/bpftrace.cpp | ||
| 36 | index 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 deleted file mode 100644 index e5ae0219f7..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0003-ast-Adapt-to-Clang-LLVM-21-DiagnosticOptions-API.patch +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | From 9771348249981680c2b893a435099673e79997c4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sun, 31 Aug 2025 15:29:26 -0700 | ||
| 4 | Subject: [PATCH 3/3] ast: Adapt to Clang/LLVM 21 DiagnosticOptions API | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | Clang 21 removed intrusive ref-counting from DiagnosticOptions and | ||
| 10 | switched consumers to take a DiagnosticOptions&. Building bpftrace | ||
| 11 | with 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 | |||
| 19 | Update 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 | |||
| 27 | Retain the old code path for LLVM < 21 via #if guards. | ||
| 28 | |||
| 29 | This fixes builds with clang-21/libc++ while keeping compatibility | ||
| 30 | with older LLVM releases. | ||
| 31 | |||
| 32 | No functional change intended. | ||
| 33 | |||
| 34 | Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/4526] | ||
| 35 | |||
| 36 | Signed-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 | |||
| 41 | diff --git a/src/ast/passes/clang_build.cpp b/src/ast/passes/clang_build.cpp | ||
| 42 | index 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.24.0.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.1.bb index 50fada36bf..add2ff01a8 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.0.bb +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.24.1.bb | |||
| @@ -18,15 +18,11 @@ DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-nativ | |||
| 18 | RDEPENDS:${PN} += "bash python3 xz" | 18 | RDEPENDS:${PN} += "bash python3 xz" |
| 19 | RDEPENDS:${PN}-ptest += "bpftool" | 19 | RDEPENDS:${PN}-ptest += "bpftool" |
| 20 | 20 | ||
| 21 | SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ | 21 | SRC_URI = "git://github.com/iovisor/bpftrace;branch=release/0.24.x;protocol=https;tag=v${PV} \ |
| 22 | file://run-ptest \ | 22 | file://run-ptest \ |
| 23 | file://0001-cmake-Raise-max-supported-clang-version-to-clang-21.patch \ | ||
| 24 | 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 \ |
| 25 | file://0001-Include-missing-c-runtime-headers.patch \ | ||
| 26 | file://0002-chrono-Fix-build-when-using-libc-casting-ns-to-syste.patch \ | ||
| 27 | file://0003-ast-Adapt-to-Clang-LLVM-21-DiagnosticOptions-API.patch \ | ||
| 28 | " | 24 | " |
| 29 | SRCREV = "3b78184eed28501ab4bbb55e45c4172538999da1" | 25 | SRCREV = "4c1f02a43f993758d445952ccd96e552752defec" |
| 30 | 26 | ||
| 31 | inherit bash-completion cmake ptest pkgconfig | 27 | inherit bash-completion cmake ptest pkgconfig |
| 32 | 28 | ||
