diff options
Diffstat (limited to 'dynamic-layers')
| -rw-r--r-- | dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch (renamed from dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch) | 23 | ||||
| -rw-r--r-- | dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch | 53 | ||||
| -rw-r--r-- | dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch | 49 | ||||
| -rw-r--r-- | dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch | 338 | ||||
| -rw-r--r-- | dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch | 41 | ||||
| -rw-r--r-- | dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.21.2.bb (renamed from dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb) | 8 |
6 files changed, 12 insertions, 500 deletions
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/0001-cmake-Bump-max-LLVM-version-to-19.patch index 8a5dbf2..88dc60b 100644 --- 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/0001-cmake-Bump-max-LLVM-version-to-19.patch | |||
| @@ -1,27 +1,24 @@ | |||
| 1 | From 16186113346c268a0bb45424ba1c41768b7e94cf Mon Sep 17 00:00:00 2001 | 1 | From 16186113346c268a0bb45424ba1c41768b7e94cf Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 16 Feb 2024 10:14:41 -0800 | 3 | Date: Fri, 16 Feb 2024 10:14:41 -0800 |
| 4 | Subject: [PATCH 4/4] cmake: Bump max LLVM version to 18+ | 4 | Subject: [PATCH] cmake: Bump max LLVM version to 19 |
| 5 | 5 | ||
| 6 | Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009] | 6 | Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3433] |
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 8 | --- | 8 | --- |
| 9 | CMakeLists.txt | 2 +- | 9 | CMakeLists.txt | 2 +- |
| 10 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 11 | 11 | ||
| 12 | diff --git a/CMakeLists.txt b/CMakeLists.txt | 12 | Index: git/CMakeLists.txt |
| 13 | index 7983ee17..7d0433de 100644 | 13 | =================================================================== |
| 14 | --- a/CMakeLists.txt | 14 | --- git.orig/CMakeLists.txt |
| 15 | +++ b/CMakeLists.txt | 15 | +++ git/CMakeLists.txt |
| 16 | @@ -139,7 +139,7 @@ else() | 16 | @@ -152,7 +152,7 @@ else() |
| 17 | endif() | 17 | endif() |
| 18 | 18 | ||
| 19 | set(MIN_LLVM_MAJOR 6) | 19 | set(MIN_LLVM_MAJOR 13) |
| 20 | -set(MAX_LLVM_MAJOR 17) | 20 | -set(MAX_LLVM_MAJOR 18) |
| 21 | +set(MAX_LLVM_MAJOR 18) | 21 | +set(MAX_LLVM_MAJOR 19) |
| 22 | 22 | ||
| 23 | if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR})) | 23 | if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR})) |
| 24 | message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}") | 24 | message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}") |
| 25 | -- | ||
| 26 | 2.43.2 | ||
| 27 | |||
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 @@ | |||
| 1 | From 62319459e7ef14a37293bc10830b52edf89daabe Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Wentao Zhang <wentao.zhang@windriver.com> | ||
| 3 | Date: Tue, 15 Aug 2023 11:18:36 +0800 | ||
| 4 | Subject: [PATCH 1/4] replace python with python3 in the test | ||
| 5 | |||
| 6 | "runtime:call" in ptest gets the following FAILED: | ||
| 7 | python: No such file or directory | ||
| 8 | replace python with python3 in the test scripts. | ||
| 9 | |||
| 10 | $export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin | ||
| 11 | $cd /usr/lib/bpftrace/ptest/tests | ||
| 12 | $python3 runtime/engine/main.py --filter="call.*" | ||
| 13 | *** | ||
| 14 | [ RUN ] call.strftime_microsecond_extension_rollover | ||
| 15 | [ FAILED ] call.strftime_microsecond_extension_rollover | ||
| 16 | Command: /usr/bin/bpftrace -e 'BEGIN { printf("%s - %s\n", strftime | ||
| 17 | ("1%f", 1000000123000), strftime("1%f", 0)); exit(); }' | tail -n | ||
| 18 | +2 | xargs -I{} python -c "print({})" | ||
| 19 | Unclean exit code: 127 | ||
| 20 | Output: __BPFTRACE_NOTIFY_PROBES_ATTACHED\nxargs: python: No such | ||
| 21 | file or directory\n | ||
| 22 | *** | ||
| 23 | |||
| 24 | Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009] | ||
| 25 | |||
| 26 | Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com> | ||
| 27 | --- | ||
| 28 | tests/runtime/call | 4 ++-- | ||
| 29 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 30 | |||
| 31 | diff --git a/tests/runtime/call b/tests/runtime/call | ||
| 32 | index 7f7cce6d..174bce95 100644 | ||
| 33 | --- a/tests/runtime/call | ||
| 34 | +++ b/tests/runtime/call | ||
| 35 | @@ -371,13 +371,13 @@ TIMEOUT 5 | ||
| 36 | # | ||
| 37 | # Note we add a `1` before the timestamp b/c leading zeros (eg `0123`) is invalid integer in python. | ||
| 38 | NAME strftime_microsecond_extension | ||
| 39 | -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({})" | ||
| 40 | +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({})" | ||
| 41 | EXPECT 123 | ||
| 42 | TIMEOUT 1 | ||
| 43 | |||
| 44 | # Similar to above test but test that rolling over past 1s works as expected | ||
| 45 | NAME strftime_microsecond_extension_rollover | ||
| 46 | -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({})" | ||
| 47 | +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({})" | ||
| 48 | EXPECT 123 | ||
| 49 | TIMEOUT 1 | ||
| 50 | |||
| 51 | -- | ||
| 52 | 2.43.2 | ||
| 53 | |||
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 @@ | |||
| 1 | From 76538f80d3c56430c3105b6a3a7614313b01ddc5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Frank van der Linden <fvdl@google.com> | ||
| 3 | Date: Mon, 11 Mar 2024 15:35:32 +0000 | ||
| 4 | Subject: [PATCH] use 64bit alignment for map counter atomic add | ||
| 5 | |||
| 6 | For an atomic inc of a map counter (ringbuf loss counter), generate | ||
| 7 | IR with 64bit alignment. This is more correct, and will avoid problems | ||
| 8 | with upcoming LLVM versions, as they will emit a function call for | ||
| 9 | a potentially unaligned atomicrmw. This will lead to an error like this: | ||
| 10 | |||
| 11 | error: <unknown>:0:0: in function BEGIN i64 (ptr): t15: i64 = GlobalAddress<ptr @__atomic_compare_exchange> 0 too many arguments | ||
| 12 | |||
| 13 | Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/pull/3045/commits/3878a437ca946ab69cc92bcd2cb3c2369625b3dc] | ||
| 14 | |||
| 15 | Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com> | ||
| 16 | --- | ||
| 17 | CHANGELOG.md | 2 ++ | ||
| 18 | src/ast/irbuilderbpf.cpp | 2 +- | ||
| 19 | 2 files changed, 3 insertions(+), 1 deletion(-) | ||
| 20 | |||
| 21 | diff --git a/CHANGELOG.md b/CHANGELOG.md | ||
| 22 | index 4fa3b673..81b6e0e2 100644 | ||
| 23 | --- a/CHANGELOG.md | ||
| 24 | +++ b/CHANGELOG.md | ||
| 25 | @@ -19,6 +19,8 @@ and this project adheres to | ||
| 26 | #### Fixed | ||
| 27 | - Fix field resolution on structs with anon union as first field | ||
| 28 | - [#2964](https://github.com/bpftrace/bpftrace/pull/2964) | ||
| 29 | +- Fix alignment of atomic map counter update | ||
| 30 | + - [#3045](https://github.com/bpftrace/bpftrace/pull/3045) | ||
| 31 | #### Docs | ||
| 32 | #### Tools | ||
| 33 | |||
| 34 | diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp | ||
| 35 | index 2ff3c0ce..98c4b0d5 100644 | ||
| 36 | --- a/src/ast/irbuilderbpf.cpp | ||
| 37 | +++ b/src/ast/irbuilderbpf.cpp | ||
| 38 | @@ -1474,7 +1474,7 @@ void IRBuilderBPF::CreateAtomicIncCounter(const std::string &map_name, | ||
| 39 | CREATE_ATOMIC_RMW(AtomicRMWInst::BinOp::Add, | ||
| 40 | val, | ||
| 41 | getInt64(1), | ||
| 42 | - 1, | ||
| 43 | + 8, | ||
| 44 | AtomicOrdering::SequentiallyConsistent); | ||
| 45 | CreateBr(lookup_merge_block); | ||
| 46 | |||
| 47 | -- | ||
| 48 | 2.35.5 | ||
| 49 | |||
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 @@ | |||
| 1 | From 441f38a0fa9711a08ca8d904b542559593bffb16 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Fri, 16 Feb 2024 10:32:27 -0800 | ||
| 4 | Subject: [PATCH 2/4] ast: Repace getInt8PtrTy with getPtrTy | ||
| 5 | |||
| 6 | getPtrTy is added in LLVM-15 and is to be used instead of getInt8PtrTy | ||
| 7 | which is gone in LLVM-18 onwards | ||
| 8 | |||
| 9 | https://github.com/llvm/llvm-project/commit/7e0802aeb5b90 | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009] | ||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | --- | ||
| 14 | src/ast/irbuilderbpf.cpp | 58 ++++++++++++++++----------------- | ||
| 15 | src/ast/passes/codegen_llvm.cpp | 22 ++++++------- | ||
| 16 | 2 files changed, 40 insertions(+), 40 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp | ||
| 19 | index 670a9e98..2ff3c0ce 100644 | ||
| 20 | --- a/src/ast/irbuilderbpf.cpp | ||
| 21 | +++ b/src/ast/irbuilderbpf.cpp | ||
| 22 | @@ -301,7 +301,7 @@ CallInst *IRBuilderBPF::createMapLookup(const std::string &map_name, | ||
| 23 | Value *key, | ||
| 24 | const std::string &name) | ||
| 25 | { | ||
| 26 | - return createMapLookup(map_name, key, getInt8PtrTy(), name); | ||
| 27 | + return createMapLookup(map_name, key, getPtrTy(), name); | ||
| 28 | } | ||
| 29 | |||
| 30 | CallInst *IRBuilderBPF::createMapLookup(const std::string &map_name, | ||
| 31 | @@ -329,7 +329,7 @@ CallInst *IRBuilderBPF::CreateGetJoinMap(BasicBlock *failure_callback, | ||
| 32 | { | ||
| 33 | return createGetScratchMap(to_string(MapManager::Type::Join), | ||
| 34 | "join", | ||
| 35 | - getInt8PtrTy(), | ||
| 36 | + getPtrTy(), | ||
| 37 | loc, | ||
| 38 | failure_callback); | ||
| 39 | } | ||
| 40 | @@ -358,8 +358,8 @@ CallInst *IRBuilderBPF::createGetScratchMap(const std::string &map_name, | ||
| 41 | BasicBlock *lookup_merge_block = BasicBlock::Create( | ||
| 42 | module_.getContext(), "lookup_" + name + "_merge", parent); | ||
| 43 | Value *condition = CreateICmpNE( | ||
| 44 | - CreateIntCast(call, getInt8PtrTy(), true), | ||
| 45 | - ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()), | ||
| 46 | + CreateIntCast(call, getPtrTy(), true), | ||
| 47 | + ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()), | ||
| 48 | "lookup_" + name + "_cond"); | ||
| 49 | CreateCondBr(condition, lookup_merge_block, lookup_failure_block); | ||
| 50 | |||
| 51 | @@ -379,7 +379,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx, | ||
| 52 | Value *key, | ||
| 53 | const location &loc) | ||
| 54 | { | ||
| 55 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 56 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 57 | return CreateMapLookupElem(ctx, map.ident, key, map.type, loc); | ||
| 58 | } | ||
| 59 | |||
| 60 | @@ -389,7 +389,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx, | ||
| 61 | SizedType &type, | ||
| 62 | const location &loc) | ||
| 63 | { | ||
| 64 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 65 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 66 | CallInst *call = createMapLookup(map_name, key); | ||
| 67 | |||
| 68 | // Check if result == 0 | ||
| 69 | @@ -406,8 +406,8 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx, | ||
| 70 | |||
| 71 | AllocaInst *value = CreateAllocaBPF(type, "lookup_elem_val"); | ||
| 72 | Value *condition = CreateICmpNE( | ||
| 73 | - CreateIntCast(call, getInt8PtrTy(), true), | ||
| 74 | - ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()), | ||
| 75 | + CreateIntCast(call, getPtrTy(), true), | ||
| 76 | + ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()), | ||
| 77 | "map_lookup_cond"); | ||
| 78 | CreateCondBr(condition, lookup_success_block, lookup_failure_block); | ||
| 79 | |||
| 80 | @@ -449,7 +449,7 @@ void IRBuilderBPF::CreateMapUpdateElem(Value *ctx, | ||
| 81 | { | ||
| 82 | Value *map_ptr = GetMapVar(map.ident); | ||
| 83 | |||
| 84 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 85 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 86 | assert(key->getType()->isPointerTy()); | ||
| 87 | assert(val->getType()->isPointerTy()); | ||
| 88 | |||
| 89 | @@ -478,7 +478,7 @@ void IRBuilderBPF::CreateMapDeleteElem(Value *ctx, | ||
| 90 | Value *key, | ||
| 91 | const location &loc) | ||
| 92 | { | ||
| 93 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 94 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 95 | assert(key->getType()->isPointerTy()); | ||
| 96 | Value *map_ptr = GetMapVar(map.ident); | ||
| 97 | |||
| 98 | @@ -541,7 +541,7 @@ void IRBuilderBPF::CreateProbeRead(Value *ctx, | ||
| 99 | AddrSpace as, | ||
| 100 | const location &loc) | ||
| 101 | { | ||
| 102 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 103 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 104 | assert(size && size->getType()->getIntegerBitWidth() <= 32); | ||
| 105 | size = CreateIntCast(size, getInt32Ty(), false); | ||
| 106 | |||
| 107 | @@ -581,7 +581,7 @@ CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx, | ||
| 108 | AddrSpace as, | ||
| 109 | const location &loc) | ||
| 110 | { | ||
| 111 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 112 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 113 | assert(size && size->getType()->isIntegerTy()); | ||
| 114 | if ([[maybe_unused]] auto *dst_alloca = dyn_cast<AllocaInst>(dst)) { | ||
| 115 | assert(dst_alloca->getAllocatedType()->isArrayTy() && | ||
| 116 | @@ -615,7 +615,7 @@ Value *IRBuilderBPF::CreateUSDTReadArgument(Value *ctx, | ||
| 117 | AddrSpace as, | ||
| 118 | const location &loc) | ||
| 119 | { | ||
| 120 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 121 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 122 | // Argument size must be 1, 2, 4, or 8. See | ||
| 123 | // https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation | ||
| 124 | int abs_size = std::abs(argument->size); | ||
| 125 | @@ -711,7 +711,7 @@ Value *IRBuilderBPF::CreateUSDTReadArgument(Value *ctx, | ||
| 126 | AddrSpace as, | ||
| 127 | const location &loc) | ||
| 128 | { | ||
| 129 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 130 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 131 | struct bcc_usdt_argument argument; | ||
| 132 | |||
| 133 | void *usdt; | ||
| 134 | @@ -1337,7 +1337,7 @@ CallInst *IRBuilderBPF::CreateGetStackId(Value *ctx, | ||
| 135 | StackType stack_type, | ||
| 136 | const location &loc) | ||
| 137 | { | ||
| 138 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 139 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 140 | |||
| 141 | Value *map_ptr = GetMapVar(stack_type.name()); | ||
| 142 | |||
| 143 | @@ -1350,7 +1350,7 @@ CallInst *IRBuilderBPF::CreateGetStackId(Value *ctx, | ||
| 144 | // Return: >= 0 stackid on success or negative error | ||
| 145 | FunctionType *getstackid_func_type = FunctionType::get( | ||
| 146 | getInt64Ty(), | ||
| 147 | - { getInt8PtrTy(), map_ptr->getType(), getInt64Ty() }, | ||
| 148 | + { getPtrTy(), map_ptr->getType(), getInt64Ty() }, | ||
| 149 | false); | ||
| 150 | CallInst *call = CreateHelperCall(libbpf::BPF_FUNC_get_stackid, | ||
| 151 | getstackid_func_type, | ||
| 152 | @@ -1399,7 +1399,7 @@ void IRBuilderBPF::CreateOutput(Value *ctx, | ||
| 153 | size_t size, | ||
| 154 | const location *loc) | ||
| 155 | { | ||
| 156 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 157 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 158 | assert(data && data->getType()->isPointerTy()); | ||
| 159 | |||
| 160 | if (bpftrace_.feature_->has_map_ringbuf()) { | ||
| 161 | @@ -1464,8 +1464,8 @@ void IRBuilderBPF::CreateAtomicIncCounter(const std::string &map_name, | ||
| 162 | parent); | ||
| 163 | |||
| 164 | Value *condition = CreateICmpNE( | ||
| 165 | - CreateIntCast(call, getInt8PtrTy(), true), | ||
| 166 | - ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()), | ||
| 167 | + CreateIntCast(call, getPtrTy(), true), | ||
| 168 | + ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()), | ||
| 169 | "map_lookup_cond"); | ||
| 170 | CreateCondBr(condition, lookup_success_block, lookup_failure_block); | ||
| 171 | |||
| 172 | @@ -1521,8 +1521,8 @@ void IRBuilderBPF::CreateMapElemAdd(Value *ctx, | ||
| 173 | |||
| 174 | AllocaInst *value = CreateAllocaBPF(type, "lookup_elem_val"); | ||
| 175 | Value *condition = CreateICmpNE( | ||
| 176 | - CreateIntCast(call, getInt8PtrTy(), true), | ||
| 177 | - ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()), | ||
| 178 | + CreateIntCast(call, getPtrTy(), true), | ||
| 179 | + ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()), | ||
| 180 | "map_lookup_cond"); | ||
| 181 | CreateCondBr(condition, lookup_success_block, lookup_failure_block); | ||
| 182 | |||
| 183 | @@ -1557,7 +1557,7 @@ void IRBuilderBPF::CreatePerfEventOutput(Value *ctx, | ||
| 184 | // long bpf_perf_event_output(struct pt_regs *ctx, struct bpf_map *map, | ||
| 185 | // u64 flags, void *data, u64 size) | ||
| 186 | FunctionType *perfoutput_func_type = FunctionType::get(getInt64Ty(), | ||
| 187 | - { getInt8PtrTy(), | ||
| 188 | + { getPtrTy(), | ||
| 189 | map_ptr->getType(), | ||
| 190 | getInt64Ty(), | ||
| 191 | data->getType(), | ||
| 192 | @@ -1600,7 +1600,7 @@ void IRBuilderBPF::CreateTracePrintk(Value *fmt_ptr, | ||
| 193 | |||
| 194 | // long bpf_trace_printk(const char *fmt, u32 fmt_size, ...) | ||
| 195 | FunctionType *traceprintk_func_type = FunctionType::get( | ||
| 196 | - getInt64Ty(), { getInt8PtrTy(), getInt32Ty() }, true); | ||
| 197 | + getInt64Ty(), { getPtrTy(), getInt32Ty() }, true); | ||
| 198 | |||
| 199 | CreateHelperCall(libbpf::BPF_FUNC_trace_printk, | ||
| 200 | traceprintk_func_type, | ||
| 201 | @@ -1630,7 +1630,7 @@ void IRBuilderBPF::CreateOverrideReturn(Value *ctx, Value *rc) | ||
| 202 | // long bpf_override_return(struct pt_regs *regs, u64 rc) | ||
| 203 | // Return: 0 | ||
| 204 | FunctionType *override_func_type = FunctionType::get( | ||
| 205 | - getInt64Ty(), { getInt8PtrTy(), getInt64Ty() }, false); | ||
| 206 | + getInt64Ty(), { getPtrTy(), getInt64Ty() }, false); | ||
| 207 | PointerType *override_func_ptr_type = PointerType::get(override_func_type, 0); | ||
| 208 | Constant *override_func = ConstantExpr::getCast( | ||
| 209 | Instruction::IntToPtr, | ||
| 210 | @@ -1807,7 +1807,7 @@ void IRBuilderBPF::CreateHelperError(Value *ctx, | ||
| 211 | libbpf::bpf_func_id func_id, | ||
| 212 | const location &loc) | ||
| 213 | { | ||
| 214 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 215 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 216 | assert(return_value && return_value->getType() == getInt32Ty()); | ||
| 217 | |||
| 218 | if (bpftrace_.helper_check_level_ == 0 || | ||
| 219 | @@ -1847,7 +1847,7 @@ void IRBuilderBPF::CreateHelperErrorCond(Value *ctx, | ||
| 220 | const location &loc, | ||
| 221 | bool compare_zero) | ||
| 222 | { | ||
| 223 | - assert(ctx && ctx->getType() == getInt8PtrTy()); | ||
| 224 | + assert(ctx && ctx->getType() == getPtrTy()); | ||
| 225 | if (bpftrace_.helper_check_level_ == 0 || | ||
| 226 | (bpftrace_.helper_check_level_ == 1 && return_zero_if_err(func_id))) | ||
| 227 | return; | ||
| 228 | @@ -1883,7 +1883,7 @@ void IRBuilderBPF::CreatePath(Value *ctx, | ||
| 229 | // int bpf_d_path(struct path *path, char *buf, u32 sz) | ||
| 230 | // Return: 0 or error | ||
| 231 | FunctionType *d_path_func_type = FunctionType::get( | ||
| 232 | - getInt64Ty(), { getInt8PtrTy(), buf->getType(), getInt32Ty() }, false); | ||
| 233 | + getInt64Ty(), { getPtrTy(), buf->getType(), getInt32Ty() }, false); | ||
| 234 | CallInst *call = CreateHelperCall( | ||
| 235 | libbpf::bpf_func_id::BPF_FUNC_d_path, | ||
| 236 | d_path_func_type, | ||
| 237 | @@ -1905,9 +1905,9 @@ void IRBuilderBPF::CreateSeqPrintf(Value *ctx, | ||
| 238 | // Return: 0 or error | ||
| 239 | FunctionType *seq_printf_func_type = FunctionType::get(getInt64Ty(), | ||
| 240 | { getInt64Ty(), | ||
| 241 | - getInt8PtrTy(), | ||
| 242 | + getPtrTy(), | ||
| 243 | getInt32Ty(), | ||
| 244 | - getInt8PtrTy(), | ||
| 245 | + getPtrTy(), | ||
| 246 | getInt32Ty() }, | ||
| 247 | false); | ||
| 248 | PointerType *seq_printf_func_ptr_type = PointerType::get(seq_printf_func_type, | ||
| 249 | diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp | ||
| 250 | index 073d48ae..258b0b0b 100644 | ||
| 251 | --- a/src/ast/passes/codegen_llvm.cpp | ||
| 252 | +++ b/src/ast/passes/codegen_llvm.cpp | ||
| 253 | @@ -380,10 +380,10 @@ void CodegenLLVM::visit(Call &call) | ||
| 254 | |||
| 255 | AllocaInst *value = b_.CreateAllocaBPF(type, "lookup_elem_val"); | ||
| 256 | Value *condition = b_.CreateICmpNE( | ||
| 257 | - b_.CreateIntCast(lookup, b_.getInt8PtrTy(), true), | ||
| 258 | + b_.CreateIntCast(lookup, b_.getPtrTy(), true), | ||
| 259 | ConstantExpr::getCast(Instruction::IntToPtr, | ||
| 260 | b_.getInt64(0), | ||
| 261 | - b_.getInt8PtrTy()), | ||
| 262 | + b_.getPtrTy()), | ||
| 263 | "map_lookup_cond"); | ||
| 264 | b_.CreateCondBr(condition, lookup_success_block, lookup_failure_block); | ||
| 265 | |||
| 266 | @@ -437,10 +437,10 @@ void CodegenLLVM::visit(Call &call) | ||
| 267 | |||
| 268 | AllocaInst *value = b_.CreateAllocaBPF(type, "lookup_elem_val"); | ||
| 269 | Value *condition = b_.CreateICmpNE( | ||
| 270 | - b_.CreateIntCast(lookup, b_.getInt8PtrTy(), true), | ||
| 271 | + b_.CreateIntCast(lookup, b_.getPtrTy(), true), | ||
| 272 | ConstantExpr::getCast(Instruction::IntToPtr, | ||
| 273 | b_.getInt64(0), | ||
| 274 | - b_.getInt8PtrTy()), | ||
| 275 | + b_.getPtrTy()), | ||
| 276 | "map_lookup_cond"); | ||
| 277 | b_.CreateCondBr(condition, lookup_success_block, lookup_failure_block); | ||
| 278 | |||
| 279 | @@ -687,7 +687,7 @@ void CodegenLLVM::visit(Call &call) | ||
| 280 | ? Instruction::BitCast | ||
| 281 | : Instruction::IntToPtr, | ||
| 282 | expr_, | ||
| 283 | - b_.getInt8PtrTy()), | ||
| 284 | + b_.getPtrTy()), | ||
| 285 | call.loc); | ||
| 286 | expr_ = buf; | ||
| 287 | expr_deleter_ = [this, buf]() { b_.CreateLifetimeEnd(buf); }; | ||
| 288 | @@ -919,9 +919,9 @@ void CodegenLLVM::visit(Call &call) | ||
| 289 | |||
| 290 | // and finally the seq_printf call | ||
| 291 | b_.CreateSeqPrintf(ctx_, | ||
| 292 | - b_.CreateIntToPtr(fmt, b_.getInt8PtrTy()), | ||
| 293 | + b_.CreateIntToPtr(fmt, b_.getPtrTy()), | ||
| 294 | b_.getInt32(size), | ||
| 295 | - b_.CreatePointerCast(data, b_.getInt8PtrTy()), | ||
| 296 | + b_.CreatePointerCast(data, b_.getPtrTy()), | ||
| 297 | b_.getInt32(data_size), | ||
| 298 | call.loc); | ||
| 299 | |||
| 300 | @@ -950,7 +950,7 @@ void CodegenLLVM::visit(Call &call) | ||
| 301 | values.push_back(expr_); | ||
| 302 | } | ||
| 303 | |||
| 304 | - b_.CreateTracePrintk(b_.CreateIntToPtr(fmt, b_.getInt8PtrTy()), | ||
| 305 | + b_.CreateTracePrintk(b_.CreateIntToPtr(fmt, b_.getPtrTy()), | ||
| 306 | b_.getInt32(size), | ||
| 307 | values, | ||
| 308 | call.loc); | ||
| 309 | @@ -1878,7 +1878,7 @@ void CodegenLLVM::visit(FieldAccess &acc) | ||
| 310 | // `is_data_loc` should only be set if field access is on `args` which | ||
| 311 | // has to be a ctx access | ||
| 312 | assert(type.IsCtxAccess()); | ||
| 313 | - assert(ctx_->getType() == b_.getInt8PtrTy()); | ||
| 314 | + assert(ctx_->getType() == b_.getPtrTy()); | ||
| 315 | // Parser needs to have rewritten field to be a u64 | ||
| 316 | assert(field.type.IsIntTy()); | ||
| 317 | assert(field.type.GetIntBitWidth() == 64); | ||
| 318 | @@ -2416,7 +2416,7 @@ void CodegenLLVM::createRet(Value *value) | ||
| 319 | void CodegenLLVM::visit(Probe &probe) | ||
| 320 | { | ||
| 321 | FunctionType *func_type = FunctionType::get(b_.getInt64Ty(), | ||
| 322 | - { b_.getInt8PtrTy() }, // struct | ||
| 323 | + { b_.getPtrTy() }, // struct | ||
| 324 | // pt_regs | ||
| 325 | // *ctx | ||
| 326 | false); | ||
| 327 | @@ -3773,7 +3773,7 @@ Function *CodegenLLVM::createMapLenCallback() | ||
| 328 | auto saved_ip = b_.saveIP(); | ||
| 329 | |||
| 330 | std::array<llvm::Type *, 4> args = { | ||
| 331 | - b_.getInt8PtrTy(), b_.getInt8PtrTy(), b_.getInt8PtrTy(), b_.getInt8PtrTy() | ||
| 332 | + b_.getPtrTy(), b_.getPtrTy(), b_.getPtrTy(), b_.getPtrTy() | ||
| 333 | }; | ||
| 334 | |||
| 335 | FunctionType *callback_type = FunctionType::get(b_.getInt64Ty(), args, false); | ||
| 336 | -- | ||
| 337 | 2.43.2 | ||
| 338 | |||
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 @@ | |||
| 1 | From 71618b5eae717c491e11b770dff14ba79306f0c8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Fri, 16 Feb 2024 10:40:21 -0800 | ||
| 4 | Subject: [PATCH 3/4] ast: Adjust to enum changes in llvm 18 | ||
| 5 | |||
| 6 | llvm 18 has change CodeGenOpt::Level/CodeGenFileType into enum classes via | ||
| 7 | https://github.com/llvm/llvm-project/commit/0a1aa6cda2758b0926a95f87d39ffefb1cb90200 | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009] | ||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | src/ast/passes/codegen_llvm.cpp | 6 ++++-- | ||
| 13 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp | ||
| 16 | index 258b0b0b..ceab4bc4 100644 | ||
| 17 | --- a/src/ast/passes/codegen_llvm.cpp | ||
| 18 | +++ b/src/ast/passes/codegen_llvm.cpp | ||
| 19 | @@ -73,7 +73,7 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace) | ||
| 20 | Optional<Reloc::Model>() | ||
| 21 | #endif | ||
| 22 | )); | ||
| 23 | - target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive); | ||
| 24 | + target_machine_->setOptLevel(llvm::CodeGenOptLevel::Aggressive); | ||
| 25 | |||
| 26 | module_->setTargetTriple(LLVMTargetTriple); | ||
| 27 | module_->setDataLayout(target_machine_->createDataLayout()); | ||
| 28 | @@ -3530,7 +3530,9 @@ void CodegenLLVM::emit(raw_pwrite_stream &stream) | ||
| 29 | { | ||
| 30 | legacy::PassManager PM; | ||
| 31 | |||
| 32 | -#if LLVM_VERSION_MAJOR >= 10 | ||
| 33 | +#if LLVM_VERSION_MAJOR >= 18 | ||
| 34 | + auto type = CodeGenFileType::ObjectFile; | ||
| 35 | +#elif LLVM_VERSION_MAJOR >= 10 | ||
| 36 | auto type = llvm::CGFT_ObjectFile; | ||
| 37 | #else | ||
| 38 | auto type = llvm::TargetMachine::CGFT_ObjectFile; | ||
| 39 | -- | ||
| 40 | 2.43.2 | ||
| 41 | |||
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.21.2.bb index cf829dc..addd2c5 100644 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.21.2.bb | |||
| @@ -19,14 +19,10 @@ RDEPENDS:${PN} += "bash python3 xz" | |||
| 19 | PV .= "+git" | 19 | PV .= "+git" |
| 20 | 20 | ||
| 21 | SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ | 21 | SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ |
| 22 | file://0001-replace-python-with-python3-in-the-test.patch \ | ||
| 23 | file://0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch \ | ||
| 24 | file://0003-ast-Adjust-to-enum-changes-in-llvm-18.patch \ | ||
| 25 | file://0004-cmake-Bump-max-LLVM-version-to-18.patch \ | ||
| 26 | file://0001-use-64bit-alignment-for-map-counter-atomic-add.patch \ | ||
| 27 | file://run-ptest \ | 22 | file://run-ptest \ |
| 23 | file://0001-cmake-Bump-max-LLVM-version-to-19.patch \ | ||
| 28 | " | 24 | " |
| 29 | SRCREV = "fe6362b4e2c1b9d0833c7d3f308c1d4006b54723" | 25 | SRCREV = "b2e255870ba010d4a7e4852bffcf1c567b016fd0" |
| 30 | 26 | ||
| 31 | S = "${WORKDIR}/git" | 27 | S = "${WORKDIR}/git" |
| 32 | 28 | ||
