LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

codiff

Diff DWARF debug info between two object files

TLDR

Diff two object files (default: show struct and function changes)
$ codiff [old.o] [new.o]
copy
Only show struct changes
$ codiff -s [old.o] [new.o]
copy
Only show function changes
$ codiff -f [old.o] [new.o]
copy
Print terse type changes
$ codiff -t [old.o] [new.o]
copy
Verbose output with full per-symbol detail
$ codiff -V [old.o] [new.o]
copy
Quiet mode (exit status only, no output)
$ codiff -q [old.o] [new.o]
copy

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.

INSTALL

sudo apt install pahole
copy
sudo pacman -S pahole
copy
sudo apk add pahole
copy
nix profile install nixpkgs#pahole
copy

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.

SEE ALSO

readelf(1), objdump(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid