~/talk

What Happens After The Compiler in C++ (How Linking Works)

Talkat C++ on Sea 2023 · 2023-06-28..06-30· [c-and-cpp]
slides:none on file

Walks through real object files and executables produced by Compiler Explorer and inspects them with objdump and readelf, showing raw bytes, relocations (e.g. call E8 with a zero operand patched to -0x21), how the linker lays out .text/.data/.bss/.rodata, why -fPIC changes code shape, how writable globals use a per-process global offset table (GOT) and lazy function resolution uses the procedure linkage table (PLT) with the loader fixing addresses at runtime.

AI-written summary · about

  1. 0:00Linking in C++
  2. 1:25Simple C++ program example
  3. 3:10Refactoring and compiler output
  4. 5:37Inspecting object files
  5. 9:49Linker resolves addresses
  6. 11:34Understanding relocations
  7. 17:01Relocations for function calls
  8. 19:27Linking object files
  9. 22:57Data access in compiled code
  10. 27:31Global variables and static storage
  11. 31:41Static globals need relocations
  12. 33:10ELF global data sections
  13. 39:58Static vs dynamic linking
  14. 41:03Dynamic linking and relocations
  15. 42:29Shared libraries at load time
  16. 44:33Global Offset Table (GOT)
  17. 47:24Role of -fPIC
  18. 50:15Populating GOT at startup
  19. 52:21Function calls in shared libraries
  20. 53:46Lazy loading with PLT/GOT
  21. 57:37Summary of linking
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.