Posts with the tag ELF:

From binary to main: How Linux starts your programs

Ever wondered what really happens between running a program and reaching main()? This article follows the entire startup process on Linux x86-64, from compilation and the ELF format to program loading, dynamic linking, memory mapping, and the final transfer of control to your code.

Why standard linux binaries crash on NixOS

An exploration of why standard Linux binaries crash on NixOS due to FHS and dynamic linking differences, and a comparative guide on how to run them using patchelf, nix-ld, and mount namespaces.

Deferred logging from scratch

As our machines become faster and faster, we generally don’t think anymore about the cost of printing and formatting strings. What if we defer the formatting work to the host ? The formatting code and the string messages no longer need to be stored on device. Thus, reducing the CPU, RAM and Flash requirements and increasing battery life.

The DWARF Debugging Information Format

The DWARF debugging Format Requirements For this article we will be using a few different programs to do some tests on the debugging format. To replicate the examples in this article you need: gcc or clang a nice and simple C program readelf and objdump During this article we will be using gcc and clang to compare and do a few experiments. To generate debugging information, you can use the -gdwarf flag in the two compilers to get an ELF file with the right DWARF debugging info in it. I recommend also using -O0 to avoid any problems with optimized out sections of code.