The objdiff CLI is an object files comparison tool designed primarily for decompilation projects. It compares object files (.o) at the function and data level, making it possible to inspect differences between an expected object and one produced from the current source code. This tutorial explains how to install objdiff CLI on Ubuntu 26.04.
Prepare environment
C compiler is needed to compile the sample source files used for testing objdiff. Make sure GCC compiler is installed before starting.
sudo apt install -y gcc
Install objdiff CLI
Download the latest release binary directly into /usr/local/bin:
sudo curl -sSLo /usr/local/bin/objdiff-cli https://github.com/encounter/objdiff/releases/latest/download/objdiff-cli-linux-x86_64
Grant execute permissions to the downloaded binary:
sudo chmod a+x /usr/local/bin/objdiff-cli
Confirm that the installation completed successfully by checking objdiff CLI version:
objdiff-cli --version
Testing objdiff CLI
Create two C source files containing slightly different implementations of the same function:
echo 'int add(int a) { return a + 1; }' > add1.c
echo 'int add(int a) { return a + 2; }' > add2.c
Compile both files into object files with optimization enabled:
gcc -O3 -c add1.c -o add1.o
gcc -O3 -c add2.c -o add2.o
Compare the generated object files using objdiff CLI:
objdiff-cli diff --target add1.o --base add2.o add
The command compares the add function from add1.o against the corresponding function in add2.o, allowing differences in the generated machine code to be examined.
Uninstall objdiff CLI
If objdiff CLI is no longer required, remove the installed binary:
sudo rm -rf /usr/local/bin/objdiff-cli
Leave a Comment
Cancel reply