Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

60.1. llvm-23.1.2

Compiler infrastructure libraries and tools from the LLVM project

Version 23.1.2, release 1
Shelf toolchain — The native compilers, the linker, the C library, and the LLVM family
Phase 31_compilers (Compilers), 1 of 22 in build order
Licence Apache-2.0 WITH LLVM-exception
Homepage https://llvm.org/
Build time 108.2 SBU
Installed size 274.5 MiB in 2997 files
Recipe ports/core/toolchain/llvm/kpkgbuild

About

LLVM: the code generator libraries and their tools (llc, opt, lli, llvm-ar, llvm-objdump, llvm-config and the rest) of the tree’s current LLVM series. Much of 31_compilers is built on it: clang, lld, compiler-rt, openmp and libunwind configure against its installed CMake package, and rust links it instead of the LLVM in its own source. Later phases use it for mesa’s shader compilers, the BPF tools (bpftrace, bcc, bpftool), qemu, wine, spirv-llvm-translator and libclc.

The port carries upstream’s whole llvm-project source archive and configures its llvm directory alone; each other LLVM port carries the same archive and configures its own directory (see A second version beside the first). It is built as one shared library per component, libLLVMCore.so, libLLVMX86CodeGen.so and so on, and there is no libLLVM.so.

Why it is in KDOS

The comment above clang and llvm in script/phases/31_compilers/packages.txt:

clang and llvm are developer tools, not needed for self-hosting: they serve the projects that prefer LLVM. lldb is its own port, in 41_system.

Sources

Dependencies

Depends on: cmake, ninja, libffi, python3, libxml2, zstd, zlib, binutils, python3-sphinx.

Required by (26): bcc, bpftool, bpftrace, castxml, clang, compiler-rt, firefox-esr, ispc, kdevelop, libclc, librewolf, libunwind, limine, lld, lldb, mesa, mesa-opencl, openmp, perf, python3-pyside6, qemu, qt-creator, rust, spirv-llvm-translator, thunderbird, wine.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/31_compilers/phase.env && kpkg install llvm'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/toolchain/llvm.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/toolchain/llvm
echo 'c98bbef08a2b4c2613cd50e9aa9ae7b69b1fe6c16b2c40373bc0ab6116fdf78a  llvm-23.1.2.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/llvm
SRC=$SRC_ROOT/llvm-23.1.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf llvm-23.1.2.tar.xz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

cmake -S llvm -B build -G Ninja \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D CMAKE_BUILD_TYPE=Release \
	-D LLVM_HOST_TRIPLE="$(cc -dumpmachine)" \
	-D LLVM_DEFAULT_TARGET_TRIPLE="$(cc -dumpmachine)" \
	-D CMAKE_C_FLAGS_RELEASE="$CFLAGS -DNDEBUG" \
	-D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS -include cstdint -DNDEBUG" \
	-D LLVM_BINUTILS_INCDIR=/usr/include \
	-D LLVM_BUILD_LLVM_DYLIB=OFF \
	-D LLVM_LINK_LLVM_DYLIB=OFF \
	-D BUILD_SHARED_LIBS=ON \
	-D LLVM_PARALLEL_COMPILE_JOBS="$(echo "$MAKEFLAGS" | grep -o '[0-9]*')" \
	-D LLVM_INCLUDE_EXAMPLES=OFF \
	-D LLVM_INCLUDE_TESTS=OFF \
	-D LLVM_ENABLE_FFI=ON \
	-D LLVM_ENABLE_RTTI=ON \
	-D LLVM_ENABLE_ZLIB=FORCE_ON \
	-D LLVM_ENABLE_ZSTD=FORCE_ON \
	-D LLVM_ENABLE_LIBXML2=FORCE_ON \
	-D LLVM_ENABLE_LIBEDIT=OFF \
	-D LLVM_ENABLE_LIBPFM=OFF \
	-D LLVM_ENABLE_Z3_SOLVER=OFF \
	-D LLVM_ENABLE_BINDINGS=OFF \
	-D LLVM_USE_PERF=ON \
	-D LLVM_ENABLE_OCAMLDOC=OFF \
	-D LLVM_INSTALL_UTILS=ON \
	-D LLVM_UTILS_INSTALL_DIR=lib/llvm/utils \
	-D LLVM_TOOL_LLVM_IR2VEC_BUILD=OFF \
	-D LLVM_ENABLE_LIBCXX=OFF \
	-D LLVM_ENABLE_LLD=OFF \
	-D LLVM_OPTIMIZED_TABLEGEN=ON \
	-D LLVM_INCLUDE_BENCHMARKS=OFF \
	-D LLVM_TARGETS_TO_BUILD=all \
	-D LLVM_ENABLE_SPHINX=ON \
	-D SPHINX_OUTPUT_HTML=OFF \
	-D SPHINX_OUTPUT_MAN=ON \
	-D SPHINX_WARNINGS_AS_ERRORS=OFF \
	-Wno-dev

cmake --build build
DESTDIR=$PKG cmake --install build

cmake --build build --target docs-llvm-man
install -Dm644 build/docs/man/*.1 -t "$PKG/usr/share/man/man1"
rm -f "$PKG/usr/share/man/man1/llvm-ir2vec.1"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/llvm, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf llvm-23.1.2-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/llvm, and runs the triggers its paths call for.

Contents

Installed programs: clang-offload-packager, dsymutil, llc, lli, llubi, llvm-addr2line, llvm-ar, llvm-as, llvm-bcanalyzer, llvm-bitcode-strip, llvm-c-test, llvm-cas, llvm-cat, llvm-cfi-verify, llvm-cgdata, llvm-config, llvm-cov, llvm-ctxprof-util, llvm-cvtres, llvm-cxxdump, llvm-cxxfilt, llvm-cxxmap, llvm-debuginfo-analyzer, llvm-debuginfod, llvm-debuginfod-find, llvm-diff, llvm-dis, llvm-dlltool, llvm-dwarfdump, llvm-dwarfutil, llvm-dwp, llvm-exegesis, llvm-extract, llvm-extract-bundle-entry, llvm-gpu-loader, llvm-gsymutil, llvm-ifs, llvm-install-name-tool, llvm-jitlink, llvm-lib, llvm-libtool-darwin, llvm-link, llvm-lipo, llvm-lto, llvm-lto2, llvm-mc, llvm-mca, llvm-ml, llvm-ml64, llvm-modextract, llvm-mt, llvm-nm, llvm-objcopy, llvm-objdump, llvm-offload-binary, llvm-offload-wrapper, llvm-opt-report, llvm-otool, llvm-pdbutil, llvm-profdata, llvm-profgen, llvm-ranlib, llvm-rc, llvm-readelf, llvm-readobj, llvm-readtapi, llvm-reduce, llvm-remarkutil, llvm-rtdyld, llvm-sim, llvm-size, llvm-split, llvm-stress, llvm-strings, llvm-strip, llvm-symbolizer, llvm-tblgen, llvm-tli-checker, llvm-undname, llvm-windres, llvm-xray, opt, reduce-chunk-list, sancov, sanstats, verify-uselistorder.

Installed libraries: libLLVMAArch64AsmParser.so, libLLVMAArch64CodeGen.so, libLLVMAArch64Desc.so, libLLVMAArch64Disassembler.so, libLLVMAArch64Info.so, libLLVMAArch64Utils.so, libLLVMABI.so, libLLVMAMDGPUAsmParser.so, libLLVMAMDGPUCodeGen.so, libLLVMAMDGPUDesc.so, libLLVMAMDGPUDisassembler.so, libLLVMAMDGPUInfo.so, libLLVMAMDGPUTargetMCA.so, libLLVMAMDGPUUtils.so, libLLVMARMAsmParser.so, libLLVMARMCodeGen.so, libLLVMARMDesc.so, libLLVMARMDisassembler.so, libLLVMARMInfo.so, libLLVMARMUtils.so, libLLVMAVRAsmParser.so, libLLVMAVRCodeGen.so, libLLVMAVRDesc.so, libLLVMAVRDisassembler.so, libLLVMAVRInfo.so, libLLVMAggressiveInstCombine.so, libLLVMAnalysis.so, libLLVMAsmParser.so, libLLVMAsmPrinter.so, libLLVMBPFAsmParser.so, libLLVMBPFCodeGen.so, libLLVMBPFDesc.so, libLLVMBPFDisassembler.so, libLLVMBPFInfo.so, libLLVMBinaryFormat.so, libLLVMBitReader.so, libLLVMBitWriter.so, libLLVMBitstreamReader.so, libLLVMCAS.so, libLLVMCFGuard.so, libLLVMCFIVerify.so, libLLVMCGData.so, libLLVMCodeGen.so, libLLVMCodeGenTypes.so, libLLVMCore.so, libLLVMCoroutines.so, libLLVMCoverage.so, libLLVMDTLTO.so, libLLVMDWARFCFIChecker.so, libLLVMDWARFLinker.so, libLLVMDWARFLinkerClassic.so, libLLVMDWARFLinkerParallel.so, libLLVMDWP.so, libLLVMDebugInfoBTF.so, libLLVMDebugInfoCodeView.so, libLLVMDebugInfoDWARF.so, libLLVMDebugInfoDWARFLowLevel.so, libLLVMDebugInfoGSYM.so, libLLVMDebugInfoLogicalView.so, libLLVMDebugInfoMSF.so, libLLVMDebugInfoPDB.so, libLLVMDebuginfod.so, libLLVMDemangle.so, libLLVMDiff.so, libLLVMDlltoolDriver.so, libLLVMExecutionEngine.so, libLLVMExegesis.so, libLLVMExegesisAArch64.so, libLLVMExegesisMips.so, libLLVMExegesisPowerPC.so, libLLVMExegesisRISCV.so, libLLVMExegesisX86.so, libLLVMExtensions.so, libLLVMFileCheck.so, libLLVMFrontendAtomic.so, libLLVMFrontendDirective.so, libLLVMFrontendDriver.so, libLLVMFrontendHLSL.so, libLLVMFrontendOffloading.so, libLLVMFrontendOpenACC.so, libLLVMFrontendOpenMP.so, libLLVMFuzzMutate.so, libLLVMFuzzerCLI.so, libLLVMGlobalISel.so, libLLVMHTTP.so, libLLVMHexagonAsmParser.so, libLLVMHexagonCodeGen.so, libLLVMHexagonDesc.so, libLLVMHexagonDisassembler.so, libLLVMHexagonInfo.so, libLLVMHipStdPar.so, libLLVMIRPrinter.so, libLLVMIRReader.so, libLLVMInstCombine.so, libLLVMInstrumentation.so, libLLVMInterfaceStub.so, libLLVMInterpreter.so, libLLVMJITLink.so, libLLVMLTO.so, libLLVMLanaiAsmParser.so, libLLVMLanaiCodeGen.so, libLLVMLanaiDesc.so, libLLVMLanaiDisassembler.so, libLLVMLanaiInfo.so, libLLVMLibDriver.so, libLLVMLineEditor.so, libLLVMLinker.so, libLLVMLoongArchAsmParser.so, libLLVMLoongArchCodeGen.so, libLLVMLoongArchDesc.so, libLLVMLoongArchDisassembler.so, libLLVMLoongArchInfo.so, libLLVMMC.so, libLLVMMCA.so, libLLVMMCDisassembler.so, libLLVMMCJIT.so, libLLVMMCParser.so, libLLVMMIRParser.so, libLLVMMSP430AsmParser.so, libLLVMMSP430CodeGen.so, libLLVMMSP430Desc.so, libLLVMMSP430Disassembler.so, libLLVMMSP430Info.so, libLLVMMipsAsmParser.so, libLLVMMipsCodeGen.so, libLLVMMipsDesc.so, libLLVMMipsDisassembler.so, libLLVMMipsInfo.so, libLLVMNVPTXCodeGen.so, libLLVMNVPTXDesc.so, libLLVMNVPTXInfo.so, libLLVMObjCARCOpts.so, libLLVMObjCopy.so, libLLVMObject.so, libLLVMObjectYAML.so, libLLVMOptDriver.so, libLLVMOption.so, libLLVMOrcDebugging.so, libLLVMOrcJIT.so, libLLVMOrcShared.so, libLLVMOrcTargetProcess.so, libLLVMPasses.so, libLLVMPerfJITEvents.so, libLLVMPlugins.so, libLLVMPowerPCAsmParser.so, libLLVMPowerPCCodeGen.so, libLLVMPowerPCDesc.so, libLLVMPowerPCDisassembler.so, libLLVMPowerPCInfo.so, libLLVMProfileData.so, libLLVMRISCVAsmParser.so, libLLVMRISCVCodeGen.so, libLLVMRISCVDesc.so, libLLVMRISCVDisassembler.so, libLLVMRISCVInfo.so, libLLVMRISCVTargetMCA.so, libLLVMRemarks.so, libLLVMRuntimeDyld.so, libLLVMSPIRVAnalysis.so, libLLVMSPIRVCodeGen.so, libLLVMSPIRVDesc.so, libLLVMSPIRVInfo.so, libLLVMSandboxIR.so, libLLVMScalarOpts.so, libLLVMSelectionDAG.so, libLLVMSparcAsmParser.so, libLLVMSparcCodeGen.so, libLLVMSparcDesc.so, libLLVMSparcDisassembler.so, libLLVMSparcInfo.so, libLLVMSupport.so, libLLVMSupportLSP.so, libLLVMSymbolize.so, libLLVMSystemZAsmParser.so, libLLVMSystemZCodeGen.so, libLLVMSystemZDesc.so, libLLVMSystemZDisassembler.so, libLLVMSystemZInfo.so, libLLVMTableGen.so, libLLVMTableGenBasic.so, libLLVMTableGenCommon.so, libLLVMTarget.so, libLLVMTargetParser.so, libLLVMTelemetry.so, libLLVMTextAPI.so, libLLVMTextAPIBinaryReader.so, libLLVMTransformUtils.so, libLLVMUBAwareInterpreter.so, libLLVMVEAsmParser.so, libLLVMVECodeGen.so, libLLVMVEDesc.so, libLLVMVEDisassembler.so, libLLVMVEInfo.so, libLLVMVectorize.so, libLLVMWebAssemblyAsmParser.so, libLLVMWebAssemblyCodeGen.so, libLLVMWebAssemblyDesc.so, libLLVMWebAssemblyDisassembler.so, libLLVMWebAssemblyInfo.so, libLLVMWebAssemblyUtils.so, libLLVMWindowsDriver.so, libLLVMWindowsManifest.so, libLLVMX86AsmParser.so, libLLVMX86CodeGen.so, libLLVMX86Desc.so, libLLVMX86Disassembler.so, libLLVMX86Info.so, libLLVMX86TargetMCA.so, libLLVMXCoreCodeGen.so, libLLVMXCoreDesc.so, libLLVMXCoreDisassembler.so, libLLVMXCoreInfo.so, libLLVMXRay.so, libLLVMipo.so, libLTO.so, libRemarks.so.

Installed directories: /usr/include/llvm, /usr/include/llvm-c, /usr/lib/cmake/llvm, /usr/lib/llvm, /usr/share/licenses/llvm, /usr/share/opt-viewer.

Short descriptions

dsymutil manipulate archived DWARF debug symbol files
llc LLVM static compiler
lli directly execute programs from LLVM bitcode
llubi LLVM UB-aware Interpreter
llvm-addr2line a drop-in replacement for addr2line
llvm-ar LLVM archiver
llvm-as LLVM assembler
llvm-bcanalyzer LLVM bitcode analyzer
llvm-cgdata LLVM CodeGen Data Tool
llvm-config Print LLVM compilation options
llvm-cov emit coverage information
llvm-cxxfilt LLVM symbol name demangler
llvm-cxxmap Mangled name remapping tool
llvm-debuginfo-analyzer Print a logical representation of low-level debug information. SYNOPSIS DESCRIPTION OPTIONS GENERAL
llvm-diff LLVM structural 'diff'
llvm-dis LLVM disassembler
llvm-dwarfdump dump and verify DWARF debug information
llvm-dwarfutil A tool to copy and manipulate debug info
llvm-exegesis LLVM Machine Instruction Benchmark
llvm-extract extract a function from an LLVM module
llvm-extract-bundle-entry extract an offload bundle entry
llvm-ifs shared object stubbing tool
llvm-install-name-tool LLVM tool for manipulating install-names and rpaths
llvm-lib LLVM lib.exe compatible library tool
llvm-libtool-darwin LLVM tool for creating libraries for Darwin
llvm-link LLVM bitcode linker
llvm-lipo LLVM tool for manipulating universal binaries
llvm-mc LLVM Machine Code Playground
llvm-mca LLVM Machine Code Analyzer
llvm-nm list LLVM bitcode and object file's symbol table
llvm-objcopy object copying and editing tool
llvm-objdump LLVM's object file dumper
llvm-offload-binary LLVM Offload Binary Packager
llvm-opt-report generate optimization report from YAML
llvm-otool Mach-O dumping tool
llvm-pdbutil PDB File forensics and diagnostics Synopsis Description Subcommands pretty
llvm-profdata Profile data tool
llvm-profgen LLVM SPGO profile generation tool
llvm-ranlib generates an archive index
llvm-readelf GNU-style LLVM Object Reader
llvm-readobj LLVM Object Reader
llvm-reduce LLVM automatic testcase reducer.
llvm-remarkutil Remark utility
llvm-size print size information
llvm-stress generate random .ll files
llvm-strings print strings
llvm-strip object stripping tool
llvm-symbolizer convert addresses into source code locations
llvm-tblgen Target Description to C++ Code for LLVM
llvm-tli-checker TargetLibraryInfo vs library checker
opt LLVM optimizer

Notes

The manual pages are one target, built and installed by name after the main install. LLVM_BUILD_DOCS would put docs-llvm-man in the default build beside docs-dsymutil-man and docs-llvm-dwarfdump-man, which rebuild the same tree into the same output directory at the same time. The set is built from every page of the command guide, including the one for llvm-ir2vec, which this build leaves out, so that page is deleted after the copy.

Every port that builds on LLVM reads its installed CMake package, /usr/lib/cmake/llvm, and takes from it the configuration recorded there: the target list, RTTI, exception handling (off, upstream’s default) and the library layout. A consumer that names one of those on its own command line does not override what LLVMConfig.cmake sets; clang and lld show the effect.