ELF

2 Posts

Using readelf, objdump, and Exception State to Debug Binary Architecture Problems

8 minute

Architecture problems are hard to debug by intuition.

A program reports Exec format error, and someone suspects permissions. A file exists but execution says not found, and someone suspects the path. A program hits an illegal instruction, and the compiler is blamed. A device faults immediately after reset, and application code is changed. Much later, the actual cause turns out to be a wrong ELF machine, missing dynamic linker, floating-point ABI mismatch, unsupported ISA extension, or a PC that was never inside the expected code section.

Read More

Why ABI, Calling Conventions, and Cross-Compilation Can Produce Binaries That Build but Do Not Run

8 minute

Cross-compilation creates an easy illusion: if the program built successfully, it should run on the board.

In practice, that often fails. The executable is copied to the device and reports Exec format error. The file exists, but execution says not found. Linking succeeds, but the program crashes when calling a library function. Both targets are ARM, but changing toolchains breaks floating-point arguments. Both targets are RISC-V, but the generated program uses instructions the board does not support.

Read More