The Runtime Theory
Runtime & Execution

What Your Code Does Before main()

What Your Code Does Before main()

63:33#linker#loader#start-up#binary

Your program's first instruction is not in main. Between the kernel's execve and your entry point lies the entire boot machinery of the runtime: loading segments, relocations, dynamic linking, and the C runtime's _start. We trace it with strace, ldd, and a debugger.

Topics covered:

  • The ELF file and its segments
  • What the dynamic linker actually does
  • The strange first microseconds of every process
  • Why startup time is a systems problem, not a language problem

Related articles

More in Runtime & Execution

Depth, delivered weekly

One technical dispatch a week — articles and episode notes before they go public.

One technical dispatch per week. No noise.