Skip to content

Add -Z embed-source (DWARFv5 source code embedding extension) #764

Closed
@Mrmaxmeier

Description

@Mrmaxmeier

Proposal

DWARFv5 has an extension for embedding program source code directly into the debug info sections: https://dwarfstd.org/issues/180201.1.html

LLVM implements this extension, though it currently uses a custom pre-standardization attribute opcode.

Clang supports it through a -gembed-source flag but Rust does not expose this feature at the moment.

Implementing this seems straight-forward (rust-lang/rust#126985) but I'm not entirely sure how to deal with unsupported platforms.

  • Should -Z embed-source=yes fail the build on non-DWARF or non-LLVM platforms?
  • Should -Z embed-source=yes automatically bump the DWARF version to v5 or should it require an explicit -Z dwarf-version=5? Clang currently defaults to v4 and requires setting the DWARF version explicitly.
  • Should -Z embed-source=yes fail the build if -g was not provided?

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustcmajor-change-acceptedA major change proposal that was accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions