From df46a0d8084c69237dda48f30e8298df94d896b7 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 30 Aug 2024 06:34:09 +0000 Subject: bpftrace: Upgrade to 0.21.2+ Fix build on upcoming clang-19 Signed-off-by: Khem Raj --- .../0001-cmake-Bump-max-LLVM-version-to-19.patch | 24 ++ ...1-replace-python-with-python3-in-the-test.patch | 53 ---- ...4bit-alignment-for-map-counter-atomic-add.patch | 49 --- ...002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch | 338 --------------------- ...003-ast-Adjust-to-enum-changes-in-llvm-18.patch | 41 --- .../0004-cmake-Bump-max-LLVM-version-to-18.patch | 27 -- .../recipes-devtools/bpftrace/bpftrace_0.20.1.bb | 59 ---- .../recipes-devtools/bpftrace/bpftrace_0.21.2.bb | 55 ++++ 8 files changed, 79 insertions(+), 567 deletions(-) create mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb create mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.21.2.bb (limited to 'dynamic-layers/openembedded-layer') diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch new file mode 100644 index 0000000..88dc60b --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch @@ -0,0 +1,24 @@ +From 16186113346c268a0bb45424ba1c41768b7e94cf Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 16 Feb 2024 10:14:41 -0800 +Subject: [PATCH] cmake: Bump max LLVM version to 19 + +Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3433] +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: git/CMakeLists.txt +=================================================================== +--- git.orig/CMakeLists.txt ++++ git/CMakeLists.txt +@@ -152,7 +152,7 @@ else() + endif() + + set(MIN_LLVM_MAJOR 13) +-set(MAX_LLVM_MAJOR 18) ++set(MAX_LLVM_MAJOR 19) + + 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}") diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch deleted file mode 100644 index 4438716..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 62319459e7ef14a37293bc10830b52edf89daabe Mon Sep 17 00:00:00 2001 -From: Wentao Zhang -Date: Tue, 15 Aug 2023 11:18:36 +0800 -Subject: [PATCH 1/4] replace python with python3 in the test - -"runtime:call" in ptest gets the following FAILED: -python: No such file or directory -replace python with python3 in the test scripts. - -$export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin -$cd /usr/lib/bpftrace/ptest/tests -$python3 runtime/engine/main.py --filter="call.*" -*** -[ RUN ] call.strftime_microsecond_extension_rollover -[ FAILED ] call.strftime_microsecond_extension_rollover - Command: /usr/bin/bpftrace -e 'BEGIN { printf("%s - %s\n", strftime - ("1%f", 1000000123000), strftime("1%f", 0)); exit(); }' | tail -n - +2 | xargs -I{} python -c "print({})" - Unclean exit code: 127 - Output: __BPFTRACE_NOTIFY_PROBES_ATTACHED\nxargs: python: No such - file or directory\n -*** - -Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009] - -Signed-off-by: Wentao Zhang ---- - tests/runtime/call | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/runtime/call b/tests/runtime/call -index 7f7cce6d..174bce95 100644 ---- a/tests/runtime/call -+++ b/tests/runtime/call -@@ -371,13 +371,13 @@ TIMEOUT 5 - # - # Note we add a `1` before the timestamp b/c leading zeros (eg `0123`) is invalid integer in python. - NAME strftime_microsecond_extension --RUN {{BPFTRACE}} -e 'BEGIN { printf("%s - %s\n", strftime("1%f", 1000123000), strftime("1%f", 0)); exit(); }' | tail -n +2 | xargs -I{} python -c "print({})" -+RUN {{BPFTRACE}} -e 'BEGIN { printf("%s - %s\n", strftime("1%f", 1000123000), strftime("1%f", 0)); exit(); }' | tail -n +2 | xargs -I{} python3 -c "print({})" - EXPECT 123 - TIMEOUT 1 - - # Similar to above test but test that rolling over past 1s works as expected - NAME strftime_microsecond_extension_rollover --RUN {{BPFTRACE}} -e 'BEGIN { printf("%s - %s\n", strftime("1%f", 1000000123000), strftime("1%f", 0)); exit(); }' | tail -n +2 | xargs -I{} python -c "print({})" -+RUN {{BPFTRACE}} -e 'BEGIN { printf("%s - %s\n", strftime("1%f", 1000000123000), strftime("1%f", 0)); exit(); }' | tail -n +2 | xargs -I{} python3 -c "print({})" - EXPECT 123 - TIMEOUT 1 - --- -2.43.2 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch deleted file mode 100644 index 49938a1..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 76538f80d3c56430c3105b6a3a7614313b01ddc5 Mon Sep 17 00:00:00 2001 -From: Frank van der Linden -Date: Mon, 11 Mar 2024 15:35:32 +0000 -Subject: [PATCH] use 64bit alignment for map counter atomic add - -For an atomic inc of a map counter (ringbuf loss counter), generate -IR with 64bit alignment. This is more correct, and will avoid problems -with upcoming LLVM versions, as they will emit a function call for -a potentially unaligned atomicrmw. This will lead to an error like this: - -error: :0:0: in function BEGIN i64 (ptr): t15: i64 = GlobalAddress 0 too many arguments - -Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/pull/3045/commits/3878a437ca946ab69cc92bcd2cb3c2369625b3dc] - -Signed-off-by: Wentao Zhang ---- - CHANGELOG.md | 2 ++ - src/ast/irbuilderbpf.cpp | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/CHANGELOG.md b/CHANGELOG.md -index 4fa3b673..81b6e0e2 100644 ---- a/CHANGELOG.md -+++ b/CHANGELOG.md -@@ -19,6 +19,8 @@ and this project adheres to - #### Fixed - - Fix field resolution on structs with anon union as first field - - [#2964](https://github.com/bpftrace/bpftrace/pull/2964) -+- Fix alignment of atomic map counter update -+ - [#3045](https://github.com/bpftrace/bpftrace/pull/3045) - #### Docs - #### Tools - -diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp -index 2ff3c0ce..98c4b0d5 100644 ---- a/src/ast/irbuilderbpf.cpp -+++ b/src/ast/irbuilderbpf.cpp -@@ -1474,7 +1474,7 @@ void IRBuilderBPF::CreateAtomicIncCounter(const std::string &map_name, - CREATE_ATOMIC_RMW(AtomicRMWInst::BinOp::Add, - val, - getInt64(1), -- 1, -+ 8, - AtomicOrdering::SequentiallyConsistent); - CreateBr(lookup_merge_block); - --- -2.35.5 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch deleted file mode 100644 index 9167963..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch +++ /dev/null @@ -1,338 +0,0 @@ -From 441f38a0fa9711a08ca8d904b542559593bffb16 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 16 Feb 2024 10:32:27 -0800 -Subject: [PATCH 2/4] ast: Repace getInt8PtrTy with getPtrTy - -getPtrTy is added in LLVM-15 and is to be used instead of getInt8PtrTy -which is gone in LLVM-18 onwards - -https://github.com/llvm/llvm-project/commit/7e0802aeb5b90 - -Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009] -Signed-off-by: Khem Raj ---- - src/ast/irbuilderbpf.cpp | 58 ++++++++++++++++----------------- - src/ast/passes/codegen_llvm.cpp | 22 ++++++------- - 2 files changed, 40 insertions(+), 40 deletions(-) - -diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp -index 670a9e98..2ff3c0ce 100644 ---- a/src/ast/irbuilderbpf.cpp -+++ b/src/ast/irbuilderbpf.cpp -@@ -301,7 +301,7 @@ CallInst *IRBuilderBPF::createMapLookup(const std::string &map_name, - Value *key, - const std::string &name) - { -- return createMapLookup(map_name, key, getInt8PtrTy(), name); -+ return createMapLookup(map_name, key, getPtrTy(), name); - } - - CallInst *IRBuilderBPF::createMapLookup(const std::string &map_name, -@@ -329,7 +329,7 @@ CallInst *IRBuilderBPF::CreateGetJoinMap(BasicBlock *failure_callback, - { - return createGetScratchMap(to_string(MapManager::Type::Join), - "join", -- getInt8PtrTy(), -+ getPtrTy(), - loc, - failure_callback); - } -@@ -358,8 +358,8 @@ CallInst *IRBuilderBPF::createGetScratchMap(const std::string &map_name, - BasicBlock *lookup_merge_block = BasicBlock::Create( - module_.getContext(), "lookup_" + name + "_merge", parent); - Value *condition = CreateICmpNE( -- CreateIntCast(call, getInt8PtrTy(), true), -- ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()), -+ CreateIntCast(call, getPtrTy(), true), -+ ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()), - "lookup_" + name + "_cond"); - CreateCondBr(condition, lookup_merge_block, lookup_failure_block); - -@@ -379,7 +379,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx, - Value *key, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - return CreateMapLookupElem(ctx, map.ident, key, map.type, loc); - } - -@@ -389,7 +389,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx, - SizedType &type, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - CallInst *call = createMapLookup(map_name, key); - - // Check if result == 0 -@@ -406,8 +406,8 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx, - - AllocaInst *value = CreateAllocaBPF(type, "lookup_elem_val"); - Value *condition = CreateICmpNE( -- CreateIntCast(call, getInt8PtrTy(), true), -- ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()), -+ CreateIntCast(call, getPtrTy(), true), -+ ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()), - "map_lookup_cond"); - CreateCondBr(condition, lookup_success_block, lookup_failure_block); - -@@ -449,7 +449,7 @@ void IRBuilderBPF::CreateMapUpdateElem(Value *ctx, - { - Value *map_ptr = GetMapVar(map.ident); - -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - assert(key->getType()->isPointerTy()); - assert(val->getType()->isPointerTy()); - -@@ -478,7 +478,7 @@ void IRBuilderBPF::CreateMapDeleteElem(Value *ctx, - Value *key, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - assert(key->getType()->isPointerTy()); - Value *map_ptr = GetMapVar(map.ident); - -@@ -541,7 +541,7 @@ void IRBuilderBPF::CreateProbeRead(Value *ctx, - AddrSpace as, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - assert(size && size->getType()->getIntegerBitWidth() <= 32); - size = CreateIntCast(size, getInt32Ty(), false); - -@@ -581,7 +581,7 @@ CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx, - AddrSpace as, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - assert(size && size->getType()->isIntegerTy()); - if ([[maybe_unused]] auto *dst_alloca = dyn_cast(dst)) { - assert(dst_alloca->getAllocatedType()->isArrayTy() && -@@ -615,7 +615,7 @@ Value *IRBuilderBPF::CreateUSDTReadArgument(Value *ctx, - AddrSpace as, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - // Argument size must be 1, 2, 4, or 8. See - // https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation - int abs_size = std::abs(argument->size); -@@ -711,7 +711,7 @@ Value *IRBuilderBPF::CreateUSDTReadArgument(Value *ctx, - AddrSpace as, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - struct bcc_usdt_argument argument; - - void *usdt; -@@ -1337,7 +1337,7 @@ CallInst *IRBuilderBPF::CreateGetStackId(Value *ctx, - StackType stack_type, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - - Value *map_ptr = GetMapVar(stack_type.name()); - -@@ -1350,7 +1350,7 @@ CallInst *IRBuilderBPF::CreateGetStackId(Value *ctx, - // Return: >= 0 stackid on success or negative error - FunctionType *getstackid_func_type = FunctionType::get( - getInt64Ty(), -- { getInt8PtrTy(), map_ptr->getType(), getInt64Ty() }, -+ { getPtrTy(), map_ptr->getType(), getInt64Ty() }, - false); - CallInst *call = CreateHelperCall(libbpf::BPF_FUNC_get_stackid, - getstackid_func_type, -@@ -1399,7 +1399,7 @@ void IRBuilderBPF::CreateOutput(Value *ctx, - size_t size, - const location *loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - assert(data && data->getType()->isPointerTy()); - - if (bpftrace_.feature_->has_map_ringbuf()) { -@@ -1464,8 +1464,8 @@ void IRBuilderBPF::CreateAtomicIncCounter(const std::string &map_name, - parent); - - Value *condition = CreateICmpNE( -- CreateIntCast(call, getInt8PtrTy(), true), -- ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()), -+ CreateIntCast(call, getPtrTy(), true), -+ ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()), - "map_lookup_cond"); - CreateCondBr(condition, lookup_success_block, lookup_failure_block); - -@@ -1521,8 +1521,8 @@ void IRBuilderBPF::CreateMapElemAdd(Value *ctx, - - AllocaInst *value = CreateAllocaBPF(type, "lookup_elem_val"); - Value *condition = CreateICmpNE( -- CreateIntCast(call, getInt8PtrTy(), true), -- ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()), -+ CreateIntCast(call, getPtrTy(), true), -+ ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()), - "map_lookup_cond"); - CreateCondBr(condition, lookup_success_block, lookup_failure_block); - -@@ -1557,7 +1557,7 @@ void IRBuilderBPF::CreatePerfEventOutput(Value *ctx, - // long bpf_perf_event_output(struct pt_regs *ctx, struct bpf_map *map, - // u64 flags, void *data, u64 size) - FunctionType *perfoutput_func_type = FunctionType::get(getInt64Ty(), -- { getInt8PtrTy(), -+ { getPtrTy(), - map_ptr->getType(), - getInt64Ty(), - data->getType(), -@@ -1600,7 +1600,7 @@ void IRBuilderBPF::CreateTracePrintk(Value *fmt_ptr, - - // long bpf_trace_printk(const char *fmt, u32 fmt_size, ...) - FunctionType *traceprintk_func_type = FunctionType::get( -- getInt64Ty(), { getInt8PtrTy(), getInt32Ty() }, true); -+ getInt64Ty(), { getPtrTy(), getInt32Ty() }, true); - - CreateHelperCall(libbpf::BPF_FUNC_trace_printk, - traceprintk_func_type, -@@ -1630,7 +1630,7 @@ void IRBuilderBPF::CreateOverrideReturn(Value *ctx, Value *rc) - // long bpf_override_return(struct pt_regs *regs, u64 rc) - // Return: 0 - FunctionType *override_func_type = FunctionType::get( -- getInt64Ty(), { getInt8PtrTy(), getInt64Ty() }, false); -+ getInt64Ty(), { getPtrTy(), getInt64Ty() }, false); - PointerType *override_func_ptr_type = PointerType::get(override_func_type, 0); - Constant *override_func = ConstantExpr::getCast( - Instruction::IntToPtr, -@@ -1807,7 +1807,7 @@ void IRBuilderBPF::CreateHelperError(Value *ctx, - libbpf::bpf_func_id func_id, - const location &loc) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - assert(return_value && return_value->getType() == getInt32Ty()); - - if (bpftrace_.helper_check_level_ == 0 || -@@ -1847,7 +1847,7 @@ void IRBuilderBPF::CreateHelperErrorCond(Value *ctx, - const location &loc, - bool compare_zero) - { -- assert(ctx && ctx->getType() == getInt8PtrTy()); -+ assert(ctx && ctx->getType() == getPtrTy()); - if (bpftrace_.helper_check_level_ == 0 || - (bpftrace_.helper_check_level_ == 1 && return_zero_if_err(func_id))) - return; -@@ -1883,7 +1883,7 @@ void IRBuilderBPF::CreatePath(Value *ctx, - // int bpf_d_path(struct path *path, char *buf, u32 sz) - // Return: 0 or error - FunctionType *d_path_func_type = FunctionType::get( -- getInt64Ty(), { getInt8PtrTy(), buf->getType(), getInt32Ty() }, false); -+ getInt64Ty(), { getPtrTy(), buf->getType(), getInt32Ty() }, false); - CallInst *call = CreateHelperCall( - libbpf::bpf_func_id::BPF_FUNC_d_path, - d_path_func_type, -@@ -1905,9 +1905,9 @@ void IRBuilderBPF::CreateSeqPrintf(Value *ctx, - // Return: 0 or error - FunctionType *seq_printf_func_type = FunctionType::get(getInt64Ty(), - { getInt64Ty(), -- getInt8PtrTy(), -+ getPtrTy(), - getInt32Ty(), -- getInt8PtrTy(), -+ getPtrTy(), - getInt32Ty() }, - false); - PointerType *seq_printf_func_ptr_type = PointerType::get(seq_printf_func_type, -diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp -index 073d48ae..258b0b0b 100644 ---- a/src/ast/passes/codegen_llvm.cpp -+++ b/src/ast/passes/codegen_llvm.cpp -@@ -380,10 +380,10 @@ void CodegenLLVM::visit(Call &call) - - AllocaInst *value = b_.CreateAllocaBPF(type, "lookup_elem_val"); - Value *condition = b_.CreateICmpNE( -- b_.CreateIntCast(lookup, b_.getInt8PtrTy(), true), -+ b_.CreateIntCast(lookup, b_.getPtrTy(), true), - ConstantExpr::getCast(Instruction::IntToPtr, - b_.getInt64(0), -- b_.getInt8PtrTy()), -+ b_.getPtrTy()), - "map_lookup_cond"); - b_.CreateCondBr(condition, lookup_success_block, lookup_failure_block); - -@@ -437,10 +437,10 @@ void CodegenLLVM::visit(Call &call) - - AllocaInst *value = b_.CreateAllocaBPF(type, "lookup_elem_val"); - Value *condition = b_.CreateICmpNE( -- b_.CreateIntCast(lookup, b_.getInt8PtrTy(), true), -+ b_.CreateIntCast(lookup, b_.getPtrTy(), true), - ConstantExpr::getCast(Instruction::IntToPtr, - b_.getInt64(0), -- b_.getInt8PtrTy()), -+ b_.getPtrTy()), - "map_lookup_cond"); - b_.CreateCondBr(condition, lookup_success_block, lookup_failure_block); - -@@ -687,7 +687,7 @@ void CodegenLLVM::visit(Call &call) - ? Instruction::BitCast - : Instruction::IntToPtr, - expr_, -- b_.getInt8PtrTy()), -+ b_.getPtrTy()), - call.loc); - expr_ = buf; - expr_deleter_ = [this, buf]() { b_.CreateLifetimeEnd(buf); }; -@@ -919,9 +919,9 @@ void CodegenLLVM::visit(Call &call) - - // and finally the seq_printf call - b_.CreateSeqPrintf(ctx_, -- b_.CreateIntToPtr(fmt, b_.getInt8PtrTy()), -+ b_.CreateIntToPtr(fmt, b_.getPtrTy()), - b_.getInt32(size), -- b_.CreatePointerCast(data, b_.getInt8PtrTy()), -+ b_.CreatePointerCast(data, b_.getPtrTy()), - b_.getInt32(data_size), - call.loc); - -@@ -950,7 +950,7 @@ void CodegenLLVM::visit(Call &call) - values.push_back(expr_); - } - -- b_.CreateTracePrintk(b_.CreateIntToPtr(fmt, b_.getInt8PtrTy()), -+ b_.CreateTracePrintk(b_.CreateIntToPtr(fmt, b_.getPtrTy()), - b_.getInt32(size), - values, - call.loc); -@@ -1878,7 +1878,7 @@ void CodegenLLVM::visit(FieldAccess &acc) - // `is_data_loc` should only be set if field access is on `args` which - // has to be a ctx access - assert(type.IsCtxAccess()); -- assert(ctx_->getType() == b_.getInt8PtrTy()); -+ assert(ctx_->getType() == b_.getPtrTy()); - // Parser needs to have rewritten field to be a u64 - assert(field.type.IsIntTy()); - assert(field.type.GetIntBitWidth() == 64); -@@ -2416,7 +2416,7 @@ void CodegenLLVM::createRet(Value *value) - void CodegenLLVM::visit(Probe &probe) - { - FunctionType *func_type = FunctionType::get(b_.getInt64Ty(), -- { b_.getInt8PtrTy() }, // struct -+ { b_.getPtrTy() }, // struct - // pt_regs - // *ctx - false); -@@ -3773,7 +3773,7 @@ Function *CodegenLLVM::createMapLenCallback() - auto saved_ip = b_.saveIP(); - - std::array args = { -- b_.getInt8PtrTy(), b_.getInt8PtrTy(), b_.getInt8PtrTy(), b_.getInt8PtrTy() -+ b_.getPtrTy(), b_.getPtrTy(), b_.getPtrTy(), b_.getPtrTy() - }; - - FunctionType *callback_type = FunctionType::get(b_.getInt64Ty(), args, false); --- -2.43.2 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch deleted file mode 100644 index 35f442f..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 71618b5eae717c491e11b770dff14ba79306f0c8 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 16 Feb 2024 10:40:21 -0800 -Subject: [PATCH 3/4] ast: Adjust to enum changes in llvm 18 - -llvm 18 has change CodeGenOpt::Level/CodeGenFileType into enum classes via -https://github.com/llvm/llvm-project/commit/0a1aa6cda2758b0926a95f87d39ffefb1cb90200 - -Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009] -Signed-off-by: Khem Raj ---- - src/ast/passes/codegen_llvm.cpp | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp -index 258b0b0b..ceab4bc4 100644 ---- a/src/ast/passes/codegen_llvm.cpp -+++ b/src/ast/passes/codegen_llvm.cpp -@@ -73,7 +73,7 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace) - Optional() - #endif - )); -- target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive); -+ target_machine_->setOptLevel(llvm::CodeGenOptLevel::Aggressive); - - module_->setTargetTriple(LLVMTargetTriple); - module_->setDataLayout(target_machine_->createDataLayout()); -@@ -3530,7 +3530,9 @@ void CodegenLLVM::emit(raw_pwrite_stream &stream) - { - legacy::PassManager PM; - --#if LLVM_VERSION_MAJOR >= 10 -+#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; --- -2.43.2 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch deleted file mode 100644 index 8a5dbf2..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 16186113346c268a0bb45424ba1c41768b7e94cf Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 16 Feb 2024 10:14:41 -0800 -Subject: [PATCH 4/4] cmake: Bump max LLVM version to 18+ - -Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009] -Signed-off-by: Khem Raj ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7983ee17..7d0433de 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -139,7 +139,7 @@ else() - endif() - - set(MIN_LLVM_MAJOR 6) --set(MAX_LLVM_MAJOR 17) -+set(MAX_LLVM_MAJOR 18) - - 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.43.2 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb deleted file mode 100644 index cf829dc..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb +++ /dev/null @@ -1,59 +0,0 @@ -SUMMARY = "bpftrace" -HOMEPAGE = "https://github.com/iovisor/bpftrace" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" - -DEPENDS += "bison-native \ - flex-native \ - gzip-native \ - elfutils \ - bcc \ - systemtap \ - libcereal \ - libbpf \ - " -DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-native', '', d)}" - -RDEPENDS:${PN} += "bash python3 xz" - -PV .= "+git" - -SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ - file://0001-replace-python-with-python3-in-the-test.patch \ - file://0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch \ - file://0003-ast-Adjust-to-enum-changes-in-llvm-18.patch \ - file://0004-cmake-Bump-max-LLVM-version-to-18.patch \ - file://0001-use-64bit-alignment-for-map-counter-atomic-add.patch \ - file://run-ptest \ -" -SRCREV = "fe6362b4e2c1b9d0833c7d3f308c1d4006b54723" - -S = "${WORKDIR}/git" - -inherit cmake ptest - -PACKAGECONFIG ?= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" - -PACKAGECONFIG[tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,gtest xxd-native" - -do_install_ptest() { - if [ -e ${B}/tests/bpftrace_test ]; then - install -Dm 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests/bpftrace_test - cp -rf ${B}/tests/runtime ${D}${PTEST_PATH}/tests - cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests - fi -} - -EXTRA_OECMAKE = " \ - -DCMAKE_ENABLE_EXPORTS=1 \ - -DCMAKE_BUILD_TYPE=Release \ - -DUSE_SYSTEM_BPF_BCC=ON \ - -DENABLE_MAN=OFF \ -" - -COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" -COMPATIBLE_HOST:libc-musl = "null" - -INHIBIT_PACKAGE_STRIP_FILES += "\ - ${PKGD}${PTEST_PATH}/tests/testprogs/uprobe_test \ -" diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.21.2.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.21.2.bb new file mode 100644 index 0000000..addd2c5 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.21.2.bb @@ -0,0 +1,55 @@ +SUMMARY = "bpftrace" +HOMEPAGE = "https://github.com/iovisor/bpftrace" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +DEPENDS += "bison-native \ + flex-native \ + gzip-native \ + elfutils \ + bcc \ + systemtap \ + libcereal \ + libbpf \ + " +DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-native', '', d)}" + +RDEPENDS:${PN} += "bash python3 xz" + +PV .= "+git" + +SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ + file://run-ptest \ + file://0001-cmake-Bump-max-LLVM-version-to-19.patch \ +" +SRCREV = "b2e255870ba010d4a7e4852bffcf1c567b016fd0" + +S = "${WORKDIR}/git" + +inherit cmake ptest + +PACKAGECONFIG ?= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" + +PACKAGECONFIG[tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,gtest xxd-native" + +do_install_ptest() { + if [ -e ${B}/tests/bpftrace_test ]; then + install -Dm 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests/bpftrace_test + cp -rf ${B}/tests/runtime ${D}${PTEST_PATH}/tests + cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests + fi +} + +EXTRA_OECMAKE = " \ + -DCMAKE_ENABLE_EXPORTS=1 \ + -DCMAKE_BUILD_TYPE=Release \ + -DUSE_SYSTEM_BPF_BCC=ON \ + -DENABLE_MAN=OFF \ +" + +COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" +COMPATIBLE_HOST:libc-musl = "null" + +INHIBIT_PACKAGE_STRIP_FILES += "\ + ${PKGD}${PTEST_PATH}/tests/testprogs/uprobe_test \ +" -- cgit v1.2.3-54-g00ecf