diff --git a/0001-tools-bashreadline-fix-probe-for-dynamically-linked-.patch b/0001-tools-bashreadline-fix-probe-for-dynamically-linked-.patch new file mode 100644 index 0000000..9fb90d7 --- /dev/null +++ b/0001-tools-bashreadline-fix-probe-for-dynamically-linked-.patch @@ -0,0 +1,45 @@ +From 14b83ac87608ab359f3913b86d31e6f02665f66d Mon Sep 17 00:00:00 2001 +From: Anthony Iliopoulos +Date: Thu, 31 Oct 2024 17:56:11 +0100 +Subject: [PATCH] tools/bashreadline: fix probe for dynamically linked readline +Upstream-status: sent to https://github.com/bpftrace/bpftrace/pull/3564/ +Fixes: bsc#1232536 + +When bash links against libreadline dynamically, the probe fails as the +readline symbol is undefined until runtime. Fix this issue by adding a +fallback probe that hooks directly into libreadline. + +Signed-off-by: Anthony Iliopoulos +[ pvorel: remove CHANGELOG.md change ] +Signed-off-by: Petr Vorel +Signed-off-by: Shung-Hsi Yu +--- + tools/bashreadline.bt | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tools/bashreadline.bt b/tools/bashreadline.bt +index 859ed6fe..30a1e706 100755 +--- a/tools/bashreadline.bt ++++ b/tools/bashreadline.bt +@@ -15,13 +15,17 @@ + * 06-Sep-2018 Brendan Gregg Created this. + */ + ++config = { missing_probes = "ignore" } ++ + BEGIN + { + printf("Tracing bash commands... Hit Ctrl-C to end.\n"); + printf("%-9s %-6s %s\n", "TIME", "PID", "COMMAND"); + } + +-uretprobe:/bin/bash:readline ++uretprobe:/bin/bash:readline, ++uretprobe:libreadline:readline ++/comm == "bash"/ + { + time("%H:%M:%S "); + printf("%-6d %s\n", pid, str(retval)); +-- +2.45.2 + diff --git a/0002-Drop-support-for-LLVM-12-and-below.patch b/0002-Drop-support-for-LLVM-12-and-below.patch new file mode 100644 index 0000000..406ad47 --- /dev/null +++ b/0002-Drop-support-for-LLVM-12-and-below.patch @@ -0,0 +1,363 @@ +From 08a7d5c48bc36c4876e7de62323a8860e886f7a8 Mon Sep 17 00:00:00 2001 +From: Alastair Robertson +Date: Wed, 17 Jul 2024 08:03:30 -0700 +Subject: [PATCH 1/3] Drop support for LLVM 12 and below + +LLVM 11 and below have been untested for a while. +Dropping LLVM 12 allows us to upgrade to C++ 20. +--- + .github/workflows/ci.yml | 5 -- + CHANGELOG.md | 2 + + CMakeLists.txt | 2 +- + flake.nix | 2 - + src/ast/irbuilderbpf.cpp | 18 +----- + src/ast/irbuilderbpf.h | 19 ------- + src/ast/passes/codegen_llvm.cpp | 4 +- + src/clang_parser.cpp | 99 +-------------------------------- + tests/clang_parser.cpp | 5 -- + tests/data/CMakeLists.txt | 8 +-- + tests/testprogs/CMakeLists.txt | 5 -- + 11 files changed, 8 insertions(+), 161 deletions(-) + +diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml +index 6b87ea3c..a37b7bdc 100644 +--- a/.github/workflows/ci.yml ++++ b/.github/workflows/ci.yml +@@ -28,11 +28,6 @@ jobs: + strategy: + matrix: + env: +- - NAME: LLVM 12 Release +- CMAKE_BUILD_TYPE: Release +- NIX_TARGET: .#bpftrace-llvm12 +- TOOLS_TEST_OLDVERSION: tcpdrop.bt +- TOOLS_TEST_DISABLE: biosnoop.bt + - NAME: LLVM 13 Release + CMAKE_BUILD_TYPE: Release + NIX_TARGET: .#bpftrace-llvm13 +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 7fa1fe14..c223b4e5 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -12,6 +12,8 @@ and this project adheres to + #### Changed + #### Deprecated + #### Removed ++- Drop support for LLVM 12 and below ++ - [#3325](https://github.com/bpftrace/bpftrace/pull/3325) + #### Fixed + #### Security + #### Docs +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7e03ca7d..05ca8dcc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -148,7 +148,7 @@ else() + find_package(LLVM REQUIRED) + endif() + +-set(MIN_LLVM_MAJOR 6) ++set(MIN_LLVM_MAJOR 13) + set(MAX_LLVM_MAJOR 18) + + if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR})) +diff --git a/flake.nix b/flake.nix +index 6202e372..9931a2a5 100644 +--- a/flake.nix ++++ b/flake.nix +@@ -145,7 +145,6 @@ + bpftrace-llvm15 = mkBpftrace pkgs.llvmPackages_15; + bpftrace-llvm14 = mkBpftrace pkgs.llvmPackages_14; + bpftrace-llvm13 = mkBpftrace pkgs.llvmPackages_13; +- bpftrace-llvm12 = mkBpftrace pkgs.llvmPackages_12; + + # Self-contained static binary with all dependencies + appimage = nix-appimage.mkappimage.${system} { +@@ -192,7 +191,6 @@ + bpftrace-llvm15 = mkBpftraceDevShell self.packages.${system}.bpftrace-llvm15; + bpftrace-llvm14 = mkBpftraceDevShell self.packages.${system}.bpftrace-llvm14; + bpftrace-llvm13 = mkBpftraceDevShell self.packages.${system}.bpftrace-llvm13; +- bpftrace-llvm12 = mkBpftraceDevShell self.packages.${system}.bpftrace-llvm12; + }; + }); + } +diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp +index deccf4a8..89434075 100644 +--- a/src/ast/irbuilderbpf.cpp ++++ b/src/ast/irbuilderbpf.cpp +@@ -15,14 +15,6 @@ + #include "log.h" + #include "utils.h" + +-#if LLVM_VERSION_MAJOR >= 10 +-#define CREATE_MEMSET(ptr, val, size, align) \ +- CreateMemSet((ptr), (val), (size), MaybeAlign((align))) +-#else +-#define CREATE_MEMSET(ptr, val, size, align) \ +- CreateMemSet((ptr), (val), (size), (align)) +-#endif +- + namespace libbpf { + #include "libbpf/bpf.h" + } // namespace libbpf +@@ -247,7 +239,7 @@ void IRBuilderBPF::CreateMemsetBPF(Value *ptr, Value *val, uint32_t size) + // So only use helper based memset when we really need it. And that's when + // we're memset()ing off-stack. We know it's off stack b/c 512 is program + // stack limit. +- CREATE_MEMSET(ptr, val, getInt64(size), 1); ++ CreateMemSet(ptr, val, getInt64(size), MaybeAlign(1)); + } + } + +@@ -347,11 +339,7 @@ CallInst *IRBuilderBPF::createCall(FunctionType *callee_type, + ArrayRef args, + const Twine &Name) + { +-#if LLVM_VERSION_MAJOR >= 11 + return CreateCall(callee_type, callee, args, Name); +-#else +- return CreateCall(callee, args, Name); +-#endif + } + + Value *IRBuilderBPF::GetMapVar(const std::string &map_name) +@@ -2445,11 +2433,7 @@ StoreInst *IRBuilderBPF::createAlignedStore(Value *val, + Value *ptr, + unsigned int align) + { +-#if LLVM_VERSION_MAJOR < 10 +- return CreateAlignedStore(val, ptr, align); +-#else + return CreateAlignedStore(val, ptr, MaybeAlign(align)); +-#endif + } + + void IRBuilderBPF::CreateProbeRead(Value *ctx, +diff --git a/src/ast/irbuilderbpf.h b/src/ast/irbuilderbpf.h +index 6a42c003..e9b3b124 100644 +--- a/src/ast/irbuilderbpf.h ++++ b/src/ast/irbuilderbpf.h +@@ -11,32 +11,13 @@ + #include "bpftrace.h" + #include "types.h" + +-#if LLVM_VERSION_MAJOR >= 5 && LLVM_VERSION_MAJOR < 7 +-#define CREATE_MEMCPY(dst, src, size, algn) \ +- CreateMemCpy((dst), (src), (size), (algn)) +-#define CREATE_MEMCPY_VOLATILE(dst, src, size, algn) \ +- CreateMemCpy((dst), (src), (size), (algn), true) +-#elif LLVM_VERSION_MAJOR >= 7 && LLVM_VERSION_MAJOR < 10 +-#define CREATE_MEMCPY(dst, src, size, algn) \ +- CreateMemCpy((dst), (algn), (src), (algn), (size)) +-#define CREATE_MEMCPY_VOLATILE(dst, src, size, algn) \ +- CreateMemCpy((dst), (algn), (src), (algn), (size), true) +-#elif LLVM_VERSION_MAJOR >= 10 + #define CREATE_MEMCPY(dst, src, size, algn) \ + CreateMemCpy((dst), MaybeAlign(algn), (src), MaybeAlign(algn), (size)) + #define CREATE_MEMCPY_VOLATILE(dst, src, size, algn) \ + CreateMemCpy((dst), MaybeAlign(algn), (src), MaybeAlign(algn), (size), true) +-#else +-#error Unsupported LLVM version +-#endif + +-#if LLVM_VERSION_MAJOR >= 13 + #define CREATE_ATOMIC_RMW(op, ptr, val, align, order) \ + CreateAtomicRMW((op), (ptr), (val), MaybeAlign((align)), (order)) +-#else +-#define CREATE_ATOMIC_RMW(op, ptr, val, align, order) \ +- CreateAtomicRMW((op), (ptr), (val), (order)) +-#endif + + #if LLVM_VERSION_MAJOR >= 15 + #define GET_PTR_TY() getPtrTy() +diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp +index 562ec65f..f4314023 100644 +--- a/src/ast/passes/codegen_llvm.cpp ++++ b/src/ast/passes/codegen_llvm.cpp +@@ -3727,10 +3727,8 @@ void CodegenLLVM::emit(raw_pwrite_stream &stream) + + #if LLVM_VERSION_MAJOR >= 18 + auto type = CodeGenFileType::ObjectFile; +-#elif LLVM_VERSION_MAJOR >= 10 +- auto type = llvm::CGFT_ObjectFile; + #else +- auto type = llvm::TargetMachine::CGFT_ObjectFile; ++ auto type = llvm::CGFT_ObjectFile; + #endif + + if (target_machine_->addPassesToEmitFile(PM, stream, nullptr, type)) +diff --git a/src/clang_parser.cpp b/src/clang_parser.cpp +index 8d79f076..52bb8786 100644 +--- a/src/clang_parser.cpp ++++ b/src/clang_parser.cpp +@@ -86,102 +86,6 @@ static std::string get_clang_string(CXString string) + return str; + } + +-/* +- * is_anonymous +- * +- * Determine whether the provided cursor points to an anonymous struct. +- * +- * This union is anonymous: +- * struct { int i; }; +- * This is not, although it is marked as such in LLVM 8: +- * struct { int i; } obj; +- * This is not, and does not actually declare an instance of a struct: +- * struct X { int i; }; +- * +- * The libclang API was changed in LLVM 8 and restored under a different +- * function in LLVM 9. For LLVM 8 there is no way to properly tell if +- * a record declaration is anonymous, so we do some hacks here. +- * +- * LLVM version differences: +- * https://reviews.llvm.org/D54996 +- * https://reviews.llvm.org/D61232 +- */ +-static bool is_anonymous(CXCursor c) +-{ +-#if LLVM_VERSION_MAJOR <= 7 +- return clang_Cursor_isAnonymous(c); +-#elif LLVM_VERSION_MAJOR >= 9 +- return clang_Cursor_isAnonymousRecordDecl(c); +-#else // LLVM 8 +- if (!clang_Cursor_isAnonymous(c)) +- return false; +- +- // In LLVM 8, some structs which the above function says are anonymous +- // are actually not. We iterate through the siblings of our struct +- // definition to see if there is a field giving it a name. +- // +- // struct Parent struct Parent +- // { { +- // struct struct +- // { { +- // ... ... +- // } name; }; +- // int sibling; int sibling; +- // }; }; +- // +- // Children of parent: Children of parent: +- // Struct: (cursor c) Struct: (cursor c) +- // Field: (Record)name Field: (int)sibling +- // Field: (int)sibling +- // +- // Record field found after No record field found after +- // cursor - not anonymous cursor - anonymous +- +- auto parent = clang_getCursorSemanticParent(c); +- if (clang_Cursor_isNull(parent)) +- return false; +- +- struct AnonFinderState { +- CXCursor struct_to_check; +- bool is_anon; +- bool prev_was_definition; +- } state; +- +- state.struct_to_check = c; +- state.is_anon = true; +- state.prev_was_definition = false; +- +- clang_visitChildren( +- parent, +- [](CXCursor c2, CXCursor, CXClientData client_data) { +- auto state = static_cast(client_data); +- if (state->prev_was_definition) { +- // This is the next child after the definition of the struct we're +- // interested in. If it is a field containing a record, we assume +- // that it must be the field for our struct, so our struct is not +- // anonymous. +- state->prev_was_definition = false; +- auto kind = clang_getCursorKind(c2); +- auto type = clang_getCanonicalType(clang_getCursorType(c2)); +- if (kind == CXCursor_FieldDecl && type.kind == CXType_Record) { +- state->is_anon = false; +- return CXChildVisit_Break; +- } +- } +- +- // We've found the definition of the struct we're interested in +- if (memcmp(c2.data, +- state->struct_to_check.data, +- 3 * sizeof(uintptr_t)) == 0) +- state->prev_was_definition = true; +- return CXChildVisit_Continue; +- }, +- &state); +- +- return state.is_anon; +-#endif +-} +- + /* + * get_named_parent + * +@@ -192,7 +96,8 @@ static CXCursor get_named_parent(CXCursor c) + { + CXCursor parent = clang_getCursorSemanticParent(c); + +- while (!clang_Cursor_isNull(parent) && is_anonymous(parent)) { ++ while (!clang_Cursor_isNull(parent) && ++ clang_Cursor_isAnonymousRecordDecl(parent)) { + parent = clang_getCursorSemanticParent(parent); + } + +diff --git a/tests/clang_parser.cpp b/tests/clang_parser.cpp +index acf07b19..db099fb4 100644 +--- a/tests/clang_parser.cpp ++++ b/tests/clang_parser.cpp +@@ -208,13 +208,8 @@ TEST(clang_parser, nested_struct_no_type) + parse("struct Foo { struct { int x; } bar; union { int y; } baz; }", + bpftrace); + +-#if LLVM_VERSION_MAJOR >= 13 + std::string bar_name = "struct Foo::(unnamed at definitions.h:2:14)"; + std::string baz_name = "union Foo::(unnamed at definitions.h:2:37)"; +-#else +- std::string bar_name = "struct Foo::(anonymous at definitions.h:2:14)"; +- std::string baz_name = "union Foo::(anonymous at definitions.h:2:37)"; +-#endif + + ASSERT_TRUE(bpftrace.structs.Has("struct Foo")); + ASSERT_TRUE(bpftrace.structs.Has(bar_name)); +diff --git a/tests/data/CMakeLists.txt b/tests/data/CMakeLists.txt +index 7eaded22..caa4b397 100644 +--- a/tests/data/CMakeLists.txt ++++ b/tests/data/CMakeLists.txt +@@ -11,17 +11,11 @@ find_program(AWK awk REQUIRED) + find_program(STRIP strip REQUIRED) + + # Build data_source.o and inject BTF into it +-set(DATA_SOURCE_CFLAGS -g) +-if(LLVM_VERSION_MAJOR VERSION_LESS 13) +- # CI's GCC compile the testprogs using DWARF version 5 +- # LLDB doesn't support DWARF5 before version 13, so we force DWARF4 +- set(DATA_SOURCE_CFLAGS ${DATA_SOURCE_CFLAGS} -gdwarf-4) +-endif() + set(DATA_SOURCE_C ${CMAKE_CURRENT_SOURCE_DIR}/data_source.c) + set(DATA_SOURCE_O ${CMAKE_CURRENT_BINARY_DIR}/data_source.o) + add_custom_command( + OUTPUT ${DATA_SOURCE_O} +- COMMAND gcc ${DATA_SOURCE_CFLAGS} -o ${DATA_SOURCE_O} ${DATA_SOURCE_C} ++ COMMAND gcc -g -o ${DATA_SOURCE_O} ${DATA_SOURCE_C} + # pahole uses LLVM_OBJCOPY env var. + # We must hack it like this b/c cmake does not support setting env vars at build time + COMMAND bash -c "LLVM_OBJCOPY=${LLVM_OBJCOPY} pahole -J ${DATA_SOURCE_O}" +diff --git a/tests/testprogs/CMakeLists.txt b/tests/testprogs/CMakeLists.txt +index 58c17f7a..8f93658c 100644 +--- a/tests/testprogs/CMakeLists.txt ++++ b/tests/testprogs/CMakeLists.txt +@@ -1,9 +1,4 @@ + set(testprog_cflags "-g -O0 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer") +-if(LLVM_VERSION_MAJOR VERSION_LESS 13) +- # CI's GCC compile the testprogs using DWARF version 5 +- # LLDB doesn't support DWARF5 before version 13, so we force DWARF4 +- set(testprog_cflags "${testprog_cflags} -gdwarf-4") +-endif() + + file(GLOB testprog_sources CONFIGURE_DEPENDS *.c) + set(testprogtargets "") +-- +2.47.1 + diff --git a/0003-cmake-Allow-any-LLVM-release-for-debug-builds.patch b/0003-cmake-Allow-any-LLVM-release-for-debug-builds.patch new file mode 100644 index 0000000..44210d6 --- /dev/null +++ b/0003-cmake-Allow-any-LLVM-release-for-debug-builds.patch @@ -0,0 +1,33 @@ +From 4e96768dd8f710ae727caa38397f3edb73faf156 Mon Sep 17 00:00:00 2001 +From: Daniel Xu +Date: Thu, 19 Sep 2024 11:17:25 +0200 +Subject: [PATCH 2/3] cmake: Allow any LLVM release for debug builds + +--- + CMakeLists.txt | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 05ca8dcc..025ff321 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -149,7 +149,15 @@ else() + endif() + + set(MIN_LLVM_MAJOR 13) +-set(MAX_LLVM_MAJOR 18) ++if(CMAKE_BUILD_TYPE STREQUAL "Debug") ++ # We assume bpftrace is not being packaged when CMAKE_BUILD_TYPE=Debug. ++ # So allow building with any LLVM version. This is purely for developers. ++ # Packagers are highly discouraged from shipping bpftrace with untested LLVM ++ # releases. ++ set(MAX_LLVM_MAJOR 999) ++else() ++ set(MAX_LLVM_MAJOR 18) ++endif() + + if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR})) + message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}") +-- +2.47.1 + diff --git a/0004-Bump-max-LLVM-version-to-19-3433.patch b/0004-Bump-max-LLVM-version-to-19-3433.patch new file mode 100644 index 0000000..676f5cd --- /dev/null +++ b/0004-Bump-max-LLVM-version-to-19-3433.patch @@ -0,0 +1,127 @@ +From 63811ea6ccaf2b6315d55b219921eb872a38042c Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 11 Dec 2024 23:14:10 -0800 +Subject: [PATCH 3/3] Bump max LLVM version to 19 (#3433) + +* cmake: Bump max LLVM version to 19 + +* Add CI job for clang/llvm 19 + +* flake.nix: Add LLVM 19 support +--- + .github/workflows/ci.yml | 27 +++++++++++++++------------ + CHANGELOG.md | 2 ++ + CMakeLists.txt | 2 +- + flake.nix | 5 +++++ + 4 files changed, 23 insertions(+), 13 deletions(-) + +diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml +index a37b7bdc..ce28320f 100644 +--- a/.github/workflows/ci.yml ++++ b/.github/workflows/ci.yml +@@ -53,31 +53,34 @@ jobs: + NIX_TARGET: .#bpftrace-llvm17 + TOOLS_TEST_OLDVERSION: tcpdrop.bt + TOOLS_TEST_DISABLE: biosnoop.bt +- - NAME: LLVM 18 Release ++ - NAME: LLVM 18 ++ CMAKE_BUILD_TYPE: Debug ++ NIX_TARGET: .#bpftrace-llvm18 ++ TOOLS_TEST_OLDVERSION: tcpdrop.bt ++ TOOLS_TEST_DISABLE: biosnoop.bt ++ - NAME: LLVM 19 Release + CMAKE_BUILD_TYPE: Release +- NIX_TARGET: .#bpftrace-llvm18 +- TOOLS_TEST_OLDVERSION: tcpdrop.bt ++ NIX_TARGET: .#bpftrace-llvm19 + TOOLS_TEST_DISABLE: biosnoop.bt +- - NAME: LLVM 18 Debug ++ - NAME: LLVM 19 Debug + CMAKE_BUILD_TYPE: Debug +- NIX_TARGET: .#bpftrace-llvm18 +- TOOLS_TEST_OLDVERSION: tcpdrop.bt ++ NIX_TARGET: .#bpftrace-llvm19 + TOOLS_TEST_DISABLE: biosnoop.bt +- - NAME: LLVM 18 Clang Debug ++ - NAME: LLVM 19 Clang Debug + CMAKE_BUILD_TYPE: Debug +- NIX_TARGET: .#bpftrace-llvm18 ++ NIX_TARGET: .#bpftrace-llvm19 + CC: clang + CXX: clang++ + TOOLS_TEST_OLDVERSION: tcpdrop.bt + TOOLS_TEST_DISABLE: biosnoop.bt +- - NAME: Memleak test (LLVM 18 Debug) ++ - NAME: Memleak test (LLVM 19 Debug) + CMAKE_BUILD_TYPE: Debug +- NIX_TARGET: .#bpftrace-llvm18 ++ NIX_TARGET: .#bpftrace-llvm19 + RUN_MEMLEAK_TEST: 1 + RUN_TESTS: 0 +- - NAME: Memleak test (LLVM 18 Release) ++ - NAME: Memleak test (LLVM 19 Release) + CMAKE_BUILD_TYPE: Release +- NIX_TARGET: .#bpftrace-llvm18 ++ NIX_TARGET: .#bpftrace-llvm19 + RUN_MEMLEAK_TEST: 1 + RUN_TESTS: 0 + steps: +diff --git a/CHANGELOG.md b/CHANGELOG.md +index c223b4e5..e326548a 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -9,6 +9,8 @@ and this project adheres to + ## Unreleased + + #### Added ++= Bump max supported LLVM version to 19 ++ - [#3433](https://github.com/bpftrace/bpftrace/pull/3433) + #### Changed + #### Deprecated + #### Removed +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 025ff321..a3ba009a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -156,7 +156,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") + # releases. + set(MAX_LLVM_MAJOR 999) + else() +- set(MAX_LLVM_MAJOR 18) ++ set(MAX_LLVM_MAJOR 19) + endif() + + if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR})) +diff --git a/flake.nix b/flake.nix +index 9931a2a5..e589f989 100644 +--- a/flake.nix ++++ b/flake.nix +@@ -21,6 +21,9 @@ + flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] + (system: + let ++ # The default LLVM version is the latest supported release ++ defaultLlvmVersion = 19; ++ + # Overlay to specify build should use the specific libbpf we want + libbpfVersion = "1.4.2"; + libbpfOverlay = +@@ -139,6 +142,7 @@ + default = bpftrace-llvm18; + + # Support matrix of llvm versions ++ bpftrace-llvm19 = mkBpftrace pkgs.llvmPackages_19; + bpftrace-llvm18 = mkBpftrace pkgs.llvmPackages_18; + bpftrace-llvm17 = mkBpftrace pkgs.llvmPackages_17; + bpftrace-llvm16 = mkBpftrace pkgs.llvmPackages_16; +@@ -185,6 +189,7 @@ + devShells = rec { + default = bpftrace-llvm18; + ++ bpftrace-llvm19 = mkBpftraceDevShell self.packages.${system}.bpftrace-llvm19; + bpftrace-llvm18 = mkBpftraceDevShell self.packages.${system}.bpftrace-llvm18; + bpftrace-llvm17 = mkBpftraceDevShell self.packages.${system}.bpftrace-llvm17; + bpftrace-llvm16 = mkBpftraceDevShell self.packages.${system}.bpftrace-llvm16; +-- +2.47.1 + diff --git a/bpftrace-0.20.4.tar.gz b/bpftrace-0.20.4.tar.gz deleted file mode 100644 index 65ac90d..0000000 --- a/bpftrace-0.20.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7182c59db82dd4eac69fc74d6eb43656e2b45795df0a89840ae0456966d985da -size 1233327 diff --git a/bpftrace-0.21.3.tar.gz b/bpftrace-0.21.3.tar.gz new file mode 100644 index 0000000..74baace --- /dev/null +++ b/bpftrace-0.21.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:704335490c90fb997c50b1e86772be57b374b389ece8ed87471d713bbed9f7f8 +size 1299643 diff --git a/bpftrace.changes b/bpftrace.changes index 9d85704..ed07fc6 100644 --- a/bpftrace.changes +++ b/bpftrace.changes @@ -1,3 +1,62 @@ +------------------------------------------------------------------- +Thu Dec 26 12:57:46 UTC 2024 - Shung-Hsi Yu + +- Support building with LLVM 19 + * add 0002-Drop-support-for-LLVM-12-and-below.patch + * add 0003-cmake-Allow-any-LLVM-release-for-debug-builds.patch + * add 0004-Bump-max-LLVM-version-to-19-3433.patch +- Default to LLVM 19 in Factory and SLE15-SP7 + +------------------------------------------------------------------- +Wed Dec 18 07:43:13 UTC 2024 - Shung-Hsi Yu + +- Update to 0.21.3 + * Fix alignment issue for multi-key maps + +------------------------------------------------------------------- + +Mon Nov 11 11:33:27 UTC 2024 - Michal Suchanek + +- Use clang for build in Factory. + +------------------------------------------------------------------- +Fri Nov 1 14:56:49 UTC 2024 - Petr Vorel + +- Backport fix for tools/bashreadline.bt needed for openQA testing + (bsc#1232536) + 0001-tools-bashreadline-fix-probe-for-dynamically-linked-.patch + +------------------------------------------------------------------- +Wed Oct 30 12:21:20 UTC 2024 - Shung-Hsi Yu + +- Switch to gcc for compilation (bsc#1219008) + +------------------------------------------------------------------- +Thu Oct 24 15:51:11 UTC 2024 - Aleksa Sarai + +- Update to 0.21.2. + + Add lazy_symbolication config option. + + Add ability to list all probes in a program. + + Add ability to call print() with indexed maps to print single map values. + + Add LLVM 18 support. + + Add ability to call delete() with multiple arguments. + + Add for-each loops for iterating over map elements. + + Add optional systemd support. + + Add ability to attach uprobes to inlined functions. + + Enable count, sum, min, and max map reads in kernel space. + + Add config option for handling missing probes. + * Better error message for args in mixed probes. + * Improve DWARF support, using liblldb instead of libdw. + * Use new hash function to reduce collisions when aggregating on stack + traces. + * Disable func builtin for kretprobes and uretprobes when get_func_ip feature + is not available. + * Move error printing from debug to verbose mode. + * Allow attaching to spin_lock functions with mitigations to prevent + deadlocks. + * Remove length limitations for strings coming out of str() and path(). + - Deprecate sarg builtin. + ------------------------------------------------------------------- Wed May 22 07:17:45 UTC 2024 - Shung-Hsi Yu @@ -20,8 +79,8 @@ Tue Mar 19 05:31:53 UTC 2024 - Shung-Hsi Yu ------------------------------------------------------------------- Fri Mar 8 06:42:00 UTC 2024 - Shung-Hsi Yu -- Update to 0.20.2 - * Fix security hole checking unpacked kernel headers (CVE-2024-2313) +- Update to 0.20.2 + * Fix security hole checking unpacked kernel headers (CVE-2024-2313) - Add fix-build-issue-when-using-UAPI-of-older-kernel.patch to fix build issue on pre-v6.0 kernel @@ -43,6 +102,11 @@ Wed Jan 31 07:31:21 UTC 2024 - Shung-Hsi Yu * Fix retval for kretfunc/fexit * Add PPID field to execsnoop.bt +------------------------------------------------------------------- +Mon Jan 22 13:39:02 UTC 2024 - Shung-Hsi Yu + +- Switch to gcc for compilation (bsc#1219008) + ------------------------------------------------------------------- Wed Dec 20 22:44:04 UTC 2023 - Aaron Puchert @@ -171,7 +235,7 @@ Thu Sep 1 04:58:08 UTC 2022 - Shung-Hsi Yu + Fix using wildcards in kfunc + Improve handling of format strings + Fix codegen for buf - + Update biosnoop.bt for kernel >=5.17 + + Update biosnoop.bt for kernel >=5.17 ------------------------------------------------------------------- Tue Jun 21 08:36:57 UTC 2022 - pgajdos@suse.com diff --git a/bpftrace.spec b/bpftrace.spec index 13e9570..97d252a 100644 --- a/bpftrace.spec +++ b/bpftrace.spec @@ -16,15 +16,21 @@ # -# Use default LLVM on openSUSE unless it is not yet supported -%if 0%{?suse_version} >= 1600 || 0%{?is_opensuse} - %if 0%{?product_libs_llvm_ver} > 17 - %define llvm_major_version 17 +# Use default LLVM unless it is not yet supported +%if 0%{?suse_version} >= 1600 + %if 0%{?product_libs_llvm_ver} > 19 + %define llvm_major_version 19 %else %define llvm_major_version %{nil} %endif + %define cc_package clang%{llvm_major_version} + %define cc_binary clang + %define xx_binary clang++ %else # Hard-code latest LLVM for SLES, the default version is too old + %if 0%{?sle_version} == 150700 + %define llvm_major_version 19 + %else %if 0%{?sle_version} == 150600 %define llvm_major_version 17 %else @@ -36,26 +42,36 @@ %endif %endif %endif + %endif + %define cc_package gcc13-c++ + %define cc_binary gcc-13 + %define xx_binary g++-13 %endif Name: bpftrace -Version: 0.20.4 +Version: 0.21.3 Release: 0 Summary: High-level tracing language for Linux eBPF License: Apache-2.0 Group: Development/Tools/Debuggers URL: https://github.com/iovisor/bpftrace Source: https://github.com/iovisor/bpftrace/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM 0001-tools-bashreadline-fix-probe-for-dynamically-linked-.patch bsc#1232536 +Patch0: 0001-tools-bashreadline-fix-probe-for-dynamically-linked-.patch +Patch1: 0002-Drop-support-for-LLVM-12-and-below.patch +Patch2: 0003-cmake-Allow-any-LLVM-release-for-debug-builds.patch +# PATCH-FIX-UPSTREAM 0004-Bump-max-LLVM-version-to-19-3433.patch bpftrace/bpftrace##3433 +Patch3: 0004-Bump-max-LLVM-version-to-19-3433.patch +BuildRequires: %cc_package BuildRequires: binutils BuildRequires: binutils-devel BuildRequires: bison -BuildRequires: clang%{llvm_major_version} BuildRequires: clang%{llvm_major_version}-devel BuildRequires: cmake BuildRequires: flex BuildRequires: libbpf-devel -BuildRequires: libdw-devel BuildRequires: libxml2-devel +BuildRequires: lldb%{llvm_major_version}-devel BuildRequires: llvm%{llvm_major_version}-devel BuildRequires: pkgconfig BuildRequires: readline-devel @@ -95,8 +111,8 @@ find tools -name '*.bt' -type f \ %build # We need to build with clang, enable LTO via CMake instead. %define _lto_cflags %{nil} -export CC="clang" -export CXX="clang++" +export CC="%cc_binary" +export CXX="%xx_binary" %cmake \ -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=TRUE \ -DLLVM_REQUESTED_VERSION="${LLVM_VERSION}" \