IT lexicon › Programming › Linker plugin

Linker plugin

Programming På svenska → Updated: 2026-11-07

The interface that lets the linker hand object files full of intermediate code back to the compiler — what makes link-time optimization work with an ordinary system linker.

Google designed the interface for the gold linker around 2008, and GNU ld later adopted it. When the linker meets a file it does not understand, it asks the plugin whether it wants to claim it. The plugin replies with the symbols the file defines, so the linker can do its usual symbol resolution. Once every file has been read, the plugin compiles the intermediate code into real object files and hands them back. GCC's plugin is liblto_plugin.so; LLVM's is LLVMgold.so.

Without the plugin the linker sees only gibberish, and so do ar and nm. Hence the wrappers gcc-ar and gcc-nm, and hence the classic error "plugin needed to handle lto object", which almost always means a build calling the wrong ar. LLVM's own linker, lld, has the optimizer built in and needs no plugin at all.

← Back to the lexicon