RFC: Exclude -fplugin options from DW_AT_producer
Proposes excluding absolute plugin paths from DW_AT_producer debug metadata to improve build reproducibility.
This RFC proposes excluding GCC’s -fplugin and -fplugin-arg options from being recorded in the DW_AT_producer debug metadata. Currently, absolute paths to plugins can be embedded, potentially compromising build reproducibility. The suggested change uses GCC’s existing NoDWARFRecord mechanism, which has previously been employed for similar reproducibility concerns.
- proposer
Suggests excluding -fplugin and -fplugin-arg from DW_AT_producer to prevent host-specific paths from being embedded in debug metadata.
“As an experiment, I modified: gcc/common.opt and marked: -fplugin= -fplugin-arg-* with NoDWARFRecord.”
- reviewer
Acknowledges the proposal and the issue of build-path leakage via plugin paths in DW_AT_producer.
“On Wed, Aug 12, 2026 at 12:40 PM Jaihind Yadav <jaihindy@qti.qualcomm.com> wrote: > > Hi, > > > > While investigating a build-path leakage issue, I noticed that > > -fplugin=<path> and -fplugin-arg-* options are currently recorded in > > DW_AT_producer when -grecord-gcc-switches is enabled. > > > > As a result, an absolute plugin path may become embedded in debug > > metadata.”
- contributor
Initially identified the issue where absolute plugin paths are recorded in DW_AT_producer, impacting reproducibility.
“This introduces host-specific path information into the generated artifact and may negatively affect reproducibility.”
Technical Tradeoffs
- Excluding plugin paths enhances reproducibility but removes potentially useful information from DW_AT_producer.
- Relying on the `NoDWARFRecord` mechanism requires careful maintenance as compiler options evolve.
In Details
This discussion concerns the DW_AT_producer attribute in DWARF debug information, which records the compiler invocation. The proposal is to prevent absolute paths specified via -fplugin and -fplugin-arg-* from being included in this string. This is to avoid embedding host-specific build environment details, thereby improving the reproducibility of builds, a goal that has informed previous NoDWARFRecord additions.
- DW_AT_producer
- A DWARF debugging information attribute that stores a string identifying the compiler and its version, along with some command-line options used during compilation.
- DWARF
- A debugging data format used by many compilers and debuggers to represent information about program variables, types, and code locations.
- Reproducibility
- The ability to reliably produce the same output (e.g., executable binary) from the same source code and build environment across different times and systems.
- GCC plugin
- A mechanism allowing external code to hook into the GCC compiler's optimization passes and front-end processing.
- NoDWARFRecord
- A GCC internal mechanism to mark compiler options that should not be recorded in the DWARF DW_AT_producer attribute.
- Build-path leakage
- The unintentional inclusion of host-specific directory paths from the build environment into the compiled artifact, which can hinder reproducibility.