bpftrace: Upgrade to 0.26.1

Fix build with LLVM 23

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj
2026-09-07 19:01:28 -07:00
parent e21c2256dd
commit 3319a20a86
4 changed files with 80 additions and 47 deletions
@@ -1,39 +0,0 @@
From ce5d908bb1256ede680fbfd521f087060a567dca Mon Sep 17 00:00:00 2001
From: Martin Jansa <martin.jansa@gmail.com>
Date: Tue, 3 Sep 2024 14:17:51 +0200
Subject: [PATCH] CMakeLists.txt: allow to set BISON_FLAGS like -l
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Upstream-Status: Pending
---
CMakeLists.txt | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,16 +108,21 @@ include_directories(SYSTEM ${LIBCEREAL_I
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
+
+# avoid buildpaths in generated #line statements and allow to pass --file-prefix-map=OLD=NEW
+set(BISON_FLAGS "${BISON_FLAGS} -l")
+set(FLEX_FLAGS "${FLEX_FLAGS} -L")
+
# `parser_class_name` is deprecated and generates warnings in bison >= 3.3.
# But `api.parser.class` is not supported in bison < 3.3. So we must inject
# the %define based on the bison version here.
if(${BISON_VERSION} VERSION_GREATER_EQUAL 3.3)
- set(BISON_FLAGS "-Dapi.parser.class={Parser} -Wcounterexamples")
+ set(BISON_FLAGS "${BISON_FLAGS} -Dapi.parser.class={Parser} -Wcounterexamples")
else()
- set(BISON_FLAGS "-Dparser_class_name={Parser} -Wcounterexamples")
+ set(BISON_FLAGS "${BISON_FLAGS} -Dparser_class_name={Parser} -Wcounterexamples")
endif()
bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS ${BISON_FLAGS} VERBOSE)
-flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
+flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc COMPILE_FLAGS ${FLEX_FLAGS})
add_flex_bison_dependency(flex_lexer bison_parser)
add_library(parser STATIC ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
target_compile_options(parser PRIVATE "-w")
@@ -0,0 +1,38 @@
From d09a791bb88c69c34dd2e294213ed2a47568267f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Viktor=20Mal=C3=ADk?= <viktor.malik@gmail.com>
Date: Tue, 18 Aug 2026 21:47:37 +0200
Subject: [PATCH] IRBuilderBPF: Fix HasTerminator on LLVM 23 (#5298)
LLVM 23 changed the implementation of BasicBlock::getTerminator(), which
now doesn't check that a basic block actually has a terminator and
should only be called after a successful BasicBlock::hasTerminator()
check. Add the check to IRBuilderBPF::HasTerminator() for LLVM 23.
Signed-off-by: Viktor Malik <viktor.malik@gmail.com>
Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/commit/d09a791bb88c69c34dd2e294213ed2a47568267f]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/ast/irbuilderbpf.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp
index fb94f9bdde6b..2a2ac6209c19 100644
--- a/src/ast/irbuilderbpf.cpp
+++ b/src/ast/irbuilderbpf.cpp
@@ -2512,7 +2512,13 @@ llvm::Value *IRBuilderBPF::CreateCheckedBinop(Binop &binop,
bool IRBuilderBPF::HasTerminator()
{
BasicBlock *current_block = GetInsertBlock();
- return current_block && current_block->getTerminator();
+ if (!current_block)
+ return false;
+#if LLVM_VERSION_MAJOR >= 23
+ if (!current_block->hasTerminator())
+ return false;
+#endif
+ return current_block->getTerminator();
}
} // namespace bpftrace::ast
@@ -0,0 +1,36 @@
From f0768d0a3d08b4ba7fbc85f874fbe905cd4a6880 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Viktor=20Mal=C3=ADk?= <viktor.malik@gmail.com>
Date: Wed, 19 Aug 2026 09:25:25 +0200
Subject: [PATCH] Add support for LLVM 23 (#5299)
- Bump MAX_LLVM_MAJOR
- Add new Nix targets
- Bump BCC version to the commit fixing LLVM 23 build
- Adjust CI jobs
Also drop support for LLVM 18. Since the Nix fuzz shell depended on LLVM
18, move that to 22.
Signed-off-by: Viktor Malik <viktor.malik@gmail.com>
Only the CMakeLists.txt hunk is backported here; the Nix and CI changes of
the original commit do not apply to an OE build, and the BCC bump is
handled by the bcc recipe.
Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/commit/f0768d0a3d08b4ba7fbc85f874fbe905cd4a6880]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index baea14e65c60..a781bf347d61 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 22)
+ set(MAX_LLVM_MAJOR 23)
endif()
if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
@@ -3,9 +3,7 @@ HOMEPAGE = "https://github.com/iovisor/bpftrace"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
DEPENDS += "bison-native \
flex-native \
gzip-native \
DEPENDS += "gzip-native \
elfutils \
bpftool-native \
bcc \
@@ -13,15 +11,16 @@ DEPENDS += "bison-native \
libbpf \
xxd-native \
"
DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-native', '', d)}"
DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-native zip-native', '', d)}"
SRC_URI = "git://github.com/iovisor/bpftrace;branch=release/0.25.x;protocol=https;tag=v${PV} \
SRC_URI = "git://github.com/iovisor/bpftrace;branch=release/0.26.x;protocol=https;tag=v${PV} \
file://run-ptest \
file://0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch \
file://0001-cmake-BuildBPF.cmake-introduce-DEBUG_PREFIX_MAP.patch \
file://0003-cmake-BuildBPF.cmake-link-data-source-binary-without.patch \
file://0004-IRBuilderBPF-Fix-HasTerminator-on-LLVM-23.patch \
file://0005-CMakeLists-Add-support-for-LLVM-23.patch \
"
SRCREV = "e491811e5d648288c01f42ce087967b271f504a0"
SRCREV = "1bac8a8daad6e0aa579980e877d0c9d5fc296593"
inherit bash-completion cmake ptest pkgconfig
@@ -64,7 +63,6 @@ EXTRA_OECMAKE = " \
-DUSE_SYSTEM_BPF_BCC=ON \
-DUSE_SYSTEM_LIBBPF=ON \
-DENABLE_MAN=OFF \
-DBISON_FLAGS='--file-prefix-map=${WORKDIR}=' \
"
PACKAGES:remove:powerpc64 = "${PN}-ptest"