Source: bpfcc
Version: 0.37.0+ds-9
Severity: important
Tags: ftbfs patch
User: [email protected]
Usertags: llvm-23-default
Control: affects -1 + src:llvm-defaults
Control: block 1154024 by -1
Hello,
We are going to switch the default LLVM version to 23 (transition bug
#1154024). llvm-defaults 0.75~exp1, in experimental, already points to
23.
bpfcc fails to build in unstable with it, and builds without it:
src/cc/bcc_debug.cc:151:68: error: no matching function for call to
'llvm::MCContext::MCContext(llvm::Triple&,
std::unique_ptr<llvm::MCAsmInfo>::pointer, [...])'
In LLVM 23, the MCContext constructor takes references instead of
pointers:
MCContext(const Triple &TheTriple, const MCAsmInfo &MAI,
const MCRegisterInfo &MRI, const MCSubtargetInfo &MSTI, ...)
so src/cc/bcc_debug.cc:151 should pass *MAI, *MRI, *STI for
LLVM_VERSION_MAJOR >= 23.
The attached debdiff adds an LLVM >= 23 branch. bpfcc builds with it.
To reproduce, with sbuild:
sbuild -d unstable \
--extra-repository='deb http://deb.debian.org/debian experimental main' \
--build-dep-resolver=aptitude \
--add-depends='clang (>= 1:23~), llvm-dev (>= 1:23~), libclang-dev (>=
1:23~)' \
<package>
The --add-depends forces the llvm-defaults packages from experimental
(the default apt resolver won't pick them, aptitude does), everything
else comes from unstable.
The severity will be raised to serious once llvm-defaults 23 is in
unstable.
Cheers,
Sylvestre
diff --git a/debian/patches/llvm-23-mccontext.patch b/debian/patches/llvm-23-mccontext.patch
new file mode 100644
index 0000000..6a9a375
--- /dev/null
+++ b/debian/patches/llvm-23-mccontext.patch
@@ -0,0 +1,23 @@
+Description: Fix the build with LLVM 23
+ MCContext takes references instead of pointers since LLVM 23.
+Author: Sylvestre Ledru <[email protected]>
+Forwarded: no
+Last-Update: 2026-11-15
+---
+Index: bpfcc-0.37.0+ds/src/cc/bcc_debug.cc
+===================================================================
+--- bpfcc-0.37.0+ds.orig/src/cc/bcc_debug.cc
++++ bpfcc-0.37.0+ds/src/cc/bcc_debug.cc
+@@ -147,7 +147,11 @@ void SourceDebugger::dump() {
+ std::unique_ptr<MCSubtargetInfo> STI(
+ T->createMCSubtargetInfo(TripleArg, "", ""));
+ MCObjectFileInfo MOFI;
+-#if LLVM_VERSION_MAJOR >= 13
++#if LLVM_VERSION_MAJOR >= 23
++ MCContext Ctx(TheTriple, *MAI, *MRI, *STI, nullptr);
++ Ctx.setObjectFileInfo(&MOFI);
++ MOFI.initMCObjectFileInfo(Ctx, false, false);
++#elif LLVM_VERSION_MAJOR >= 13
+ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), nullptr);
+ Ctx.setObjectFileInfo(&MOFI);
+ MOFI.initMCObjectFileInfo(Ctx, false, false);
diff --git a/debian/patches/series b/debian/patches/series
index 6ba28e4..105e5ec 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ fix-install-path.patch
2003-libbpf-tools-debian.patch
0001-Cleanup-existing-temporary-kernel-headers-path.patch
2004-fix-u64-format-strings.patch
+llvm-23-mccontext.patch