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

363.1. dwarves-1.32

pahole and the DWARF tools — encodes the kernel's BTF type information

Version 1.32, release 1
Shelf devtools — Debuggers, tracers, profilers, analysers, linters, language servers and developer utilities
Phase 60_kernel (Kernel), 1 of 2 in build order
Licence GPL-2.0-only
Homepage https://git.kernel.org/pub/scm/devel/pahole/pahole.git
Build time 0.1 SBU
Installed size 974.8 KiB in 42 files
Recipe ports/core/devtools/dwarves/kpkgbuild

About

dwarves is pahole and the other tools that read DWARF debugging information: pfunct, pdwtags, codiff, ctracer, btfdiff and the rest. KDOS builds it for the kernel. The linux port’s configuration turns on CONFIG_DEBUG_INFO_BTF, and with it CONFIG_DEBUG_INFO_BTF_MODULES, which defaults on. kbuild then runs pahole over the kernel’s DWARF to produce BTF, the compact description of the kernel’s own types that bpftrace, sched_ext and CO-RE BPF programs read. linux is the only port that depends on it, and 60_kernel builds it just before the kernel.

Without pahole in the root, the kernel’s olddefconfig drops BTF without a word. The kernel recipe checks for that afterwards and stops the build; see The kernel configuration.

Why it is in KDOS

The comment above it in script/phases/60_kernel/packages.txt:

pahole, which turns the kernel's DWARF into the BTF that DEBUG_INFO_BTF embeds; linux depends on it.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, elfutils, zlib, libbpf, argp-standalone, musl-obstack.

Required by (1): linux.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

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/60_kernel/phase.env && kpkg install dwarves'

What kpkg does

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

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/devtools/dwarves
echo '319cbf319e9fc92065a5407ce47eb868d73566f3d4840a56832734e4579df947  dwarves-1.32.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/dwarves
SRC=$SRC_ROOT/dwarves-1.32
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf dwarves-1.32.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:

mkdir -p build && cd build
cmake .. -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DLIB_INSTALL_DIR=lib \
	-DLIBBPF_EMBEDDED=OFF \
	-DCMAKE_DISABLE_FIND_PACKAGE_Python3=ON
ninja
DESTDIR=$PKG ninja install

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/dwarves, 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 dwarves-1.32-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/dwarves, and runs the triggers its paths call for.

Contents

Installed programs: btfdiff, codiff, ctracer, dtagnames, fullcircle, pahole, pdwtags, pfunct, pglobal, prefcnt, scncopy, syscse.

Installed libraries: libdwarves.so, libdwarves_emit.so, libdwarves_reorganize.so.

Installed directories: /usr/include/dwarves, /usr/share/dwarves, /usr/share/licenses/dwarves.

Short descriptions

pahole show or manipulate data structure layout and pretty print raw data
pfunct Shows function information in debug information.

Notes