airs-notes
Source
https://www.airs.com/blog/index.php?s=linkers+part
Authored and copyright by Ian Lance Taylor, collected here for easy lookup.
Index
Main series
- Linkers part 1: introduction
- Linkers part 2: technial introduction
- Linkers part 3: address spaces, object file formats
- Linkers part 4: shared libraries
- Linkers part 5: shared libraries redux, ELF symbols
- Linkers part 6: relocations, position-dependent libraries
- Linkers part 7: thread-local storage
- Linkers part 8: ELF segments and sections
- Linkers part 9: symbol versions, relaxation
- Linkers part 10: parallel linking
- Linkers part 11: archives
- Linkers part 12: symbol resolution
- Linkers part 13: symbol versions redux
- Linkers part 14: link-time optimization, initialization code
- Linkers part 15: COMDAT sections
- Linkers part 16: C++ template instantiation, exception frames
- Linkers part 17: warning symbols
- Linkers part 18: incremental linking
- Linkers part 19:
__start
and__stop
symbols, byte swapping - Linkers part 20: ending note
Other articles included as well
- GCC exception frames
- Linker combreloc
- Linker relro
- Combining versions
- Version scripts
- Protected symbols
.eh_frame
.eh_frame_hdr
.gcc_except_table
- Executable stack
- Piece of PIE
Even more articles, from MaskRay’s blog
- Stack unwinding
- All about symbol versioning
- C++ exception handling ABI
- LLD and GNU linker incompatibilities
- Copy relocations, canonical PLT entries and protected visibility
- GNU indirect function
- Everything I know about GNU toolchain
- Metadata sections, COhtmlAT and
SHF_LINK_ORDER
External links
Here’s a collection of links about the subject, I’m putting these here because people seem to find these useful.
elf(5)
manpage- unofficial ELF docs (has more than the manpage, also has extra links)
- glibc internals
- stuff about
.gnu.hash
- Linux Internals & Dynamic Linking Wizardy; Linux Internals: The Art of Symbol Resolution
- LWN article on the vDSO, the vDSO is a dynamic library automatically inserted into every process by the kernel, containing fast implementations of a few syscalls
- “The bits between the bits: how we get to
main()
”, a talk, mostly talks about process instantiation - Everything You Always Wanted to Know About “Hello, World”, another talk
- “How programs get run” (LWN), part 1, part 2, also talks about eg. initial stack layout
- Glibc startup procedure, technically hurd but mostly the same on Linux
- The difference between all the
crt*.o
files - Official x86-64 ELF ABI spec (PDF)
- Official ELF Auxiliary vector reference
- Glibc ld.so source code
- GNU ld source code
- Glibc How to debug ld.so
- Anatomy of a system call, LWN, part 1, part 2
- “Linkers and Loaders”, a book (PDF), more meant for general concepts than nitty ELF details. Also talks about Java for some reason.
- A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux
- The Quest for minimal ELF binaries
- Linux sizecoding wiki
- Rough transcriptions of a thread on Mastodon, my posts had some useful info in them, so I saved these in this document.