codiff
Diff DWARF debug info between two object files
TLDR
SYNOPSIS
codiff [options] OLDFILE NEWFILE
DESCRIPTION
codiff compares the DWARF (or CTF/BTF) debugging information embedded in two ELF object files and reports the differences in C-level types, structures, and function prototypes. It is part of the dwarves suite alongside pahole, pfunct, pglobal, and pdwtags.The typical use case is verifying the impact of a patch on a kernel module, library, or large binary: a developer compiles the same translation unit before and after a change and runs codiff to see which structures grew, which fields moved, and which exported functions had their signatures altered. Because the comparison is structural rather than textual, renames of unrelated symbols and reordering of unrelated declarations are filtered out automatically.Without -s or -f, both struct and function diffs are produced. The tool requires the input files to be built with debugging information (-g for GCC/Clang).
PARAMETERS
-s, --structs
Show diffs of struct/union/class definitions: added, removed, resized, or re-arranged members.-f, --functions
Show diffs of function signatures and prototypes: parameter or return-type changes, additions, removals.-t, --terse_type_changes
Print a compact summary line for each changed type instead of the full breakdown.-V, --verbose
Verbose output: show offsets, sizes, alignment, and per-member changes for each affected type.-q, --quiet
Only set the exit status; suppress all output. Useful for scripts.-F list, --format_path list
Comma-separated list of debug formats to try in order (e.g. dwarf, ctf, btf).--help
Print help text and exit.
CAVEATS
Input files must contain compatible debug information; stripped binaries produce no output. Comparisons across different toolchain or DWARF versions can yield noise. codiff is intended for object files (.o) and small libraries — full vmlinux comparisons may take significant time and memory.
HISTORY
codiff was written by Arnaldo Carvalho de Melo as part of the dwarves project, first released in 2007 to help kernel developers analyse the binary impact of struct-layout changes. The toolset evolved together with pahole and is now widely used in the Linux kernel workflow, including by BTF generation for eBPF.
