
Linkers Lto
Solid reference for when you're wrestling with undefined references, trying to enable LTO without breaking your build, or figuring out why your binary is bloated. Covers GNU ld, gold, and lld selection, the left-to-right link order gotcha that bites everyone, and the full LTO setup for both GCC and Clang including ThinLTO. The symbol visibility and --gc-sections sections are especially practical. It won't teach you linker theory, but if you need to know whether to use --start-group or how to generate a map file to debug where your symbols went, it's all here in working examples.
- skills.sh installs
- 663
- GitHub stars
- 279
- last updated
- Aug 21, 2026
Install
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill linkers-lto --agent claude-codeInstalls into .claude/skills of the current project.
Files
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 |
# Use lld with GCC or Clang
gcc -fuse-ld=lld -o prog ...
clang -fuse-ld=lld -o prog ...
# Check which linker is used
gcc -v -o prog main.c 2>&1 | grep 'Invoking'
2. Essential linker flags
# Pass linker flags via compiler driver:
# -Wl,flag1,flag2 (comma-separated, no spaces)
# -Wl,flag1 -Wl,flag2 (separate -Wl options)
Sponsors
Details
- Repository
- github.com/mohitmishra786/low-level-dev-skills
- First seen
- Jun 3, 2026
More from mohitmishra786/low-level-dev-skills
All 54- Conan Vcpkg659
- Dynamic Linking650
- Rust Security624
- Rust Ffi613
- Rust Unsafe611
- Pgo610
- Interpreters609
- Cargo Workflows608
- Rust Sanitizers Miri604
- Meson603
- Cpp Modules597
- Rust Debugging597
- Hardware Counters590
- Debug Optimized Builds579
- Cpp Templates574
- Rustc Basics567
- Rust Cross565
- Wasm Emscripten559
- Zig Debugging555
- Zig Build System552
- Zig Cross536
- Wasm Wasmtime532
- Zig Cinterop524
- Cmake1.8K