Documentation
README
Linkers and LTO
Purpose
Guide agents through linker selection, common linker flags, link-order issues, LTO setup, and symbol-visibility management.
Triggers
- "I'm getting
undefined referenceat link time" - "How do I enable LTO for a real project?"
- "Which linker should I use: ld, gold, or lld?"
- "How do I reduce binary size with
--gc-sections?" - "How do I write or understand a linker script?"
- "I have duplicate symbol or weak symbol issues"
Workflow
1. Linker selection
| Linker | Invocation | Strengths |
|---|---|---|
| GNU ld (BFD) | default on Linux | Universal, stable |
| gold | -fuse-ld=gold |
Faster than ld for C++; supports LTO plugins |
| lld (LLVM) | -fuse-ld=lld |
Fastest, parallel, required for Clang LTO |
This is the opening of the README. Read the full README on GitHub.