# 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-1.html)
* [Linkers part 2: technial introduction](linkers-2.html)
* [Linkers part 3: address spaces, object file formats](linkers-3.html)
* [Linkers part 4: shared libraries](linkers-4.html)
* [Linkers part 5: shared libraries redux, ELF symbols](linkers-5.html)
* [Linkers part 6: relocations, position-dependent libraries](linkers-6.html)
* [Linkers part 7: thread-local storage](linkers-7.html)
* [Linkers part 8: ELF segments and sections](linkers-8.html)
* [Linkers part 9: symbol versions, relaxation](linkers-9.html)
* [Linkers part 10: parallel linking](linkers-10.html)
* [Linkers part 11: archives](linkers-11.html)
* [Linkers part 12: symbol resolution](linkers-12.html)
* [Linkers part 13: symbol versions redux](linkers-13.html)
* [Linkers part 14: link-time optimization, initialization code](linkers-14.html)
* [Linkers part 15: COMDAT sections](linkers-15.html)
* [Linkers part 16: C++ template instantiation, exception frames](linkers-16.html)
* [Linkers part 17: warning symbols](linkers-17.html)
* [Linkers part 18: incremental linking](linkers-18.html)
* [Linkers part 19: `__start` and `__stop` symbols, byte swapping](linkers-19.html)
* [Linkers part 20: ending note](linkers-20.html)

### Other articles included as well

* [GCC exception frames](gcc-exception-frames.html)
* [Linker combreloc](linker-combreloc.html)
* [Linker relro](linker-relro.html)
* [Combining versions](combining-versions.html)
* [Version scripts](version-scripts.html)
* [Protected symbols](protected-symbols.html)
* [`.eh_frame`](eh_frame.html)
* [`.eh_frame_hdr`](eh_frame_hdr.html)
* [`.gcc_except_table`](gcc_except_table.html)
* [Executable stack](executable-stack.html)
* [Piece of PIE](piece-of-pie.html)

### Even more articles, from [MaskRay's blog](https://maskray.me/blog/)

* [Stack unwinding](maskray-1.html)
* [All about symbol versioning](maskray-2.html)
* [C++ exception handling ABI](maskray-3.html)
* [LLD and GNU linker incompatibilities](maskray-4.html)
* [Copy relocations, canonical PLT entries and protected visibility](maskray-5.html)
* [GNU indirect function](maskray-6.html)
* [Everything I know about GNU toolchain](maskray-7.html)
* [Metadata sections, COhtmlAT and `SHF_LINK_ORDER`](maskray-8.html)

## 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](https://linux.die.net/man/5/elf)
* [unofficial ELF docs](elf.html) (has
  more than the manpage, also has extra links)
* [glibc internals](http://s.eresi-project.org/inc/articles/elf-rtld.txt)
* [stuff about `.gnu.hash`](https://web.archive.org/web/20111022202443/http://blogs.oracle.com/ali/entry/gnu_hash_elf_sections)
* [Linux Internals &amp; Dynamic Linking Wizardy](https://0x00sec.org/t/linux-internals-dynamic-linking-wizardry/1082);
  [Linux Internals: The Art of Symbol Resolution](https://0x00sec.org/t/linux-internals-the-art-of-symbol-resolution/1488)
* [LWN article on the vDSO](https://lwn.net/Articles/446528/), 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()`"](https://invidious.snopyta.org/watch?v=dOfucXtyEsU),
  a talk, mostly talks about process instantiation
* [Everything You Always Wanted to Know About "Hello, World"](https://archive.fosdem.org/2017/schedule/event/hello_world/),
  another talk
* "How programs get run" (LWN), [part 1](https://lwn.net/Articles/630727/),
  [part 2](https://lwn.net/Articles/631631/), also talks about eg. initial
  stack layout
* [Glibc startup procedure](https://www.gnu.org/software/hurd/glibc/startup.html),
  technically hurd but mostly the same on Linux
* [The difference between all the `crt*.o` files](https://dev.gentoo.org/%7Evapier/crt.txt)
* [Official x86-64 ELF ABI spec](https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf) (PDF)
* [Official ELF Auxiliary vector reference](https://refspecs.linuxfoundation.org/LSB_1.3.0/IA64/spec/auxiliaryvector.html)
  * Lots of useful stuff can be found on this website as well, see eg.
    [here](https://refspecs.linuxfoundation.org/) and [here](https://refspecs.linuxfoundation.org/LSB_1.3.0/)
* [Glibc ld.so source code](https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=elf/dl-lookup.c)
* [GNU ld source code](https://sourceware.org/git/?p=binutils.git;a=blob_plain;f=bfd/elf.c)
* [Glibc How to debug ld.so](https://sourceware.org/glibc/wiki/Debugging/Loader_Debugging)
* Anatomy of a system call, LWN, [part 1](https://lwn.net/Articles/604287/),
  [part 2](https://lwn.net/Articles/604515/)
* ["Linkers and Loaders"](http://becbapatla.ac.in/cse/naveenv/docs/LL1.pdf),
  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](http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html)
* [The Quest for minimal ELF binaries](https://github.com/faemiyah/dnload/blob/master/README.rst#the-quest-for-minimal-elf-binaries)
* [Linux sizecoding wiki](https://linux.weeaboo.software/explain-dot-md)
* [Rough transcriptions of a thread on Mastodon](masto-thread.html), my posts had
  some useful info in them, so I saved these in this document.

