My Little Object File: How Linkers Implement C++
summary
Walks a C++ translation unit through actual object formats and tools, showing how ELF, MachO, COFF encode sections, symbols and relocations and how the linker turns many .o files into an executable. Demonstrates with objdump/readelf outputs, shows init_array concatenation, comdat/weak selection for inline/template dedupe, ICF and relaxation merging identical code, garbage collection of unused sections, and PLT/GOT lazy binding for dynamic loads. Uses readelf objdump nm llvm-readobj and compares LD/Gold/LLD; the small examples run and produce the expected outputs.
AI-written summary · about
chapters (6)
- 0:00Introduction to build pipelines
- 1:13Inside an object file
- 2:42Linking mechanisms and data
- 23:31Linker operation and optimization
- 30:56Dynamic linking basics
- 33:35Q&A and best practices
related talks
01h 26mWhat Does the Linker Actually Do for Us?
59m“C++ in Elvenland”
01h 02mHow symbols work and why we need them
01h 02mHow Linux Elf Symbols Work and How They Are Used in C++ and C Programming
01h 04mThe Bits Between the Bits: How We Get to main()
01mTalk Preview: How Symbols Work and Why We Need Them
31mAmong ELFs and DWARFs
01h 00mFrom Program to Process - What Happens After the Compiler
