Linker script pure function plugins - TRANSFORM keyword
Proposes adding a TRANSFORM directive to linker scripts to allow plugins to transform section data.
This RFC proposes extending GNU ld and its plugin interface with a TRANSFORM directive. This directive would allow linker scripts to invoke pure, side-effect-free functions provided by plugins to manipulate section data. The goal is to enable use cases like firmware compression and integrity digests directly within the linker, avoiding complex out-of-band scripting and potential loss of debug information.
- proposer
Proposes adding a TRANSFORM directive to linker scripts to allow plugins to transform section data, referencing an RFC by Xiangfei Ding.
“We propose extending GNU ld and the shared plugin interface in include/plugin-api.h to support link-time data transformations in linker scripts via a new output section directive, `TRANSFORM`. We will coordinate this design with LLVM lld developers so that both linkers share an identical C ABI and matching linker script syntax. Linker scripts today cannot transform section data. When a build sy…”
In Details
This RFC introduces a TRANSFORM directive for GNU ld linker scripts, allowing plugins to perform data transformations on sections. This feature aims to integrate tasks like compression or integrity checking directly into the link-time process, reducing the need for external tooling and improving debugging information preservation, as seen in kernel and firmware build flows.