GCC Newspaper
OCTOBER 6, 2026
gcc — Proposed

Exclude -fplugin and -fplugin-arg from DW_AT_producer recording

RFC to prevent absolute plugin paths and arguments from being embedded in DWARF debug info, improving build reproducibility.

This RFC proposes excluding GCC plugin-related options (-fplugin= and -fplugin-arg-*) from being recorded in the DW_AT_producer DWARF attribute when -grecord-gcc-switches is enabled. The current behavior embeds absolute host-specific paths, which negatively impacts build reproducibility. The patch modifies gcc/common.opt to mark these options with NoDWARFRecord, addressing the issue without affecting plugin functionality.

In the Thread 2 participants
  1. Jaihind Yadav proposer

    Noticed that absolute plugin paths are embedded in DW_AT_producer due to -fplugin and -fplugin-arg options, which harms reproducibility. Experimentally marked these options with NoDWARFRecord and observed no functional impact.

    “-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. This introduces host-specific path information into the generated artifact and may negatively affect reproducibility. As an experiment, I modified: gcc/common.opt and marked: -fplugin= -fplugin-…”
  2. Richard Biener reviewer

    Acknowledged the proposal to exclude plugin options from DW_AT_producer recording, which aligns with existing mechanisms for handling reproducibility concerns.

    “The plugin is still loaded correctly, plugin arguments are still passed, and generated code/debug information remain unchanged. The only observed difference is that plugin-related command-line options are no longer recorded in DW_AT_producer.”

Technical Tradeoffs

  • Improved build reproducibility vs. potentially losing detailed plugin invocation information in debug data.

In Details

This RFC addresses the embedding of absolute paths for GCC plugins (specified via -fplugin and -fplugin-arg-*) into the DW_AT_producer DWARF attribute when -grecord-gcc-switches is active. The proposal leverages the existing NoDWARFRecord mechanism in gcc/common.opt to prevent these host-specific paths from being recorded, thereby enhancing the reproducibility of builds.

For Context
DW_AT_producer
A DWARF debugging information attribute that stores a string identifying the toolchain that produced the compilation unit, including compiler version and command-line options.
DWARF
A standardized debugging data format used by many compilers and debuggers, containing information about variables, types, and code structure.
-grecord-gcc-switches
A GCC command-line option that instructs the compiler to record all command-line switches used for compilation in the DWARF debug information.
NoDWARFRecord
A mechanism within GCC's option handling that specifies certain command-line options should not be recorded in the DW_AT_producer string.
Reproducibility
The ability to reliably produce the exact same build output from the same source code and build environment, which is crucial for security auditing and debugging.
Filed Under: dwarfdebug inforeproducibilitycompilergcc