Source: smlsharp
Version: 4.1.0-1.1
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.
smlsharp fails to build in unstable with it, and builds without it:
src/llvm/main/smlsharp_gc.cpp:149:18: error: no matching function for
call to 'llvm::TargetLoweringObjectFile::getSectionForConstant(const
llvm::DataLayout&, llvm::SectionKind, std::nullptr_t, llvm::Align&) const'
In LLVM 23, TargetLoweringObjectFile::getSectionForConstant takes an
additional const Function *F argument (after the alignment), the call
in src/llvm/main/smlsharp_gc.cpp:148 needs it. #1123477 was the same
kind of port for LLVM 21.
The attached debdiff adds it for LLVM >= 23. smlsharp 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.patch b/debian/patches/llvm-23.patch
new file mode 100644
index 0000000..c8e076d
--- /dev/null
+++ b/debian/patches/llvm-23.patch
@@ -0,0 +1,23 @@
+Description: Fix the build with LLVM 23
+ TargetLoweringObjectFile::getSectionForConstant takes an additional
+ "const Function *" argument since LLVM 23.
+Author: Sylvestre Ledru <[email protected]>
+Forwarded: no
+Last-Update: 2026-11-15
+---
+Index: smlsharp-4.1.0/src/llvm/main/smlsharp_gc.cpp
+===================================================================
+--- smlsharp-4.1.0.orig/src/llvm/main/smlsharp_gc.cpp
++++ smlsharp-4.1.0/src/llvm/main/smlsharp_gc.cpp
+@@ -147,7 +147,11 @@ SMLSharpGCPrinter::finishAssembly(Module
+ #endif
+ (ap.getObjFileLowering().getSectionForConstant
+ (ap.getDataLayout(), SectionKind::getReadOnly(),
++#if LLVM_VERSION_MAJOR >= 23
++ nullptr, align, nullptr));
++#else
+ nullptr, align));
++#endif
+ EmitAlignPtrSize(ap);
+ #if LLVM_VERSION_MAJOR <= 10
+ ap.OutStreamer->EmitLabel(sml_ftab);
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..57a9af7
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+llvm-23.patch