CAdapt patches ELF metadata on Linux to adjust symbol version requirements in compiled programs, shared libraries and kernel modules. It targets cases where ABI compatibility has already been established but version metadata prevents execution or loading.
- GLIBC: Read symbol versions from a supplied
libc.so.6and adapt one ELF file or a directory. Keep the original version when available and preserve hidden symbol markers. - KMOD: Modify
.kovermagicand symbol CRCs in the traditional__versionsformat. - 32-bit and multiple candidates: Both 32-bit and 64-bit little-endian ELF files are supported.
-c(libc) and-i(interpreter) may be repeated (e.g. one 32-bit and one 64-bit each); every target picks the matching candidate by class, endianness and machine, so a directory may mix both. A target with no matching libc/interpreter is warned about and skipped; big-endian ELF files are not yet supported and are warned about and skipped. 32-bit kernel modules use 4-byte CRCs in__versions; when a target module's machine differs from the running system while symbol CRCs orvermagiccome from that system, the change is warned about and refused.
Requires Linux, a GNU++11-capable C++ compiler and CMake 3.5+. Tests also require Python 3.7+ and cc.
cmake -S . -B build -DCADAPT_STRICT=ON
cmake --build build
ctest --test-dir build --output-on-failureThe language standard is fixed to GNU++11. CADAPT_STRICT=ON treats compiler warnings and language extensions as errors. Add -DBUILD_TESTING=OFF to build the tool without Python. With older CMake, run cmake .. and ctest inside the build directory. Build against the appropriate GLIBC/sysroot when targeting older systems.
./build/cadapt -h # GLIBC ./build/cadapt -c /path/to/libc.so.6 -t /path/to/target_elf_or_directory # KMOD ./build/cadapt -m ./my_driver.ko -s ./Module.symvers \ -v "4.18.0-193.el8.x86_64 SMP mod_unload" # Mixed directory: 32-bit and 64-bit targets each match their own libc/interpreter ./build/cadapt -c /lib/libc.so.6 -c /lib64/libc.so.6 -t ./mixed_dir ./build/cadapt -i /lib/ld-linux.so.2 -i /lib64/ld-linux-x86-64.so.2 -t ./mixed_dir
- With
-s/--symvers, CRCs come exclusively from that file; missing symbols do not silently fall back to the running kernel. - Without
-sor-v, collect CRCs orvermagicfrom current system modules on demand. An explicitvermagicmust match the source of system CRCs. For another kernel, supply itsModule.symversandvermagic. - KMOD writes begin only after all validation passes; validation failures leave the target unchanged. Synchronization failures return failure, but do not guarantee rollback of written data.
- Directory scans skip symbolic links. Help returns
0; invalid arguments or adaptation failures return a nonzero exit code.
On 2026-10-12, OpenAI Codex assisted a round of code review, fixes and regression validation. The changes are recorded in the commit history, with 4af3cbc as the validation baseline.
- Strict GNU++11 builds passed locally with GCC 9.5 and GCC 15.2, and all eight CTest checks passed.
- Coverage includes CLI behavior, GLIBC version selection and hidden bits, KMOD CRC/source conflicts, malformed ELF files, scan/synchronization failures, logging and resource ownership.
- Regression scripts are in tests/; the CI workflow is in ci.yml. The badge above shows the remote workflow status.
This records AI-assisted review and observed test results; it is not an official OpenAI certification or a guarantee of compatibility with arbitrary files or ABIs.
- Supports 32-bit and 64-bit little-endian ELF with section headers. Big-endian files and extended section numbering are unsupported.
- Extended KMOD sections
__version_ext_names/__version_ext_crcsare explicitly rejected. - Files are modified in place: back them up first. Metadata changes cannot check or repair ABI differences; applications may still crash and incompatible kernel modules may cause Kernel Panic/Oops.
- Errors go to
cadaptErrlog.txtbeside the executable, or stderr if the log cannot be written.