Skip to content

rustc: Stabilize -Zrun-dsymutil as -Csplit-debuginfo#79570

Merged
bors merged 1 commit intorust-lang:masterfrom
alexcrichton:split-debuginfo
Jan 29, 2021
Merged

rustc: Stabilize -Zrun-dsymutil as -Csplit-debuginfo#79570
bors merged 1 commit intorust-lang:masterfrom
alexcrichton:split-debuginfo

Conversation

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Nov 30, 2020

This commit adds a new stable codegen option to rustc,
-Csplit-debuginfo. The old -Zrun-dsymutil flag is deleted and now
subsumed by this stable flag. Additionally -Zsplit-dwarf is also
subsumed by this flag but still requires -Zunstable-options to
actually activate. The -Csplit-debuginfo flag takes one of
three values:

  • off - This indicates that split-debuginfo from the final artifact is
    not desired. This is not supported on Windows and is the default on
    Unix platforms except macOS. On macOS this means that dsymutil is
    not executed.

  • packed - This means that debuginfo is desired in one location
    separate from the main executable. This is the default on Windows
    (*.pdb) and macOS (*.dSYM). On other Unix platforms this subsumes
    -Zsplit-dwarf=single and produces a *.dwp file.

  • unpacked - This means that debuginfo will be roughly equivalent to
    object files, meaning that it's throughout the build directory
    rather than in one location (often the fastest for local development).
    This is not the default on any platform and is not supported on Windows.

Each target can indicate its own default preference for how debuginfo is
handled. Almost all platforms default to off except for Windows and
macOS which default to packed for historical reasons.

Some equivalencies for previous unstable flags with the new flags are:

  • -Zrun-dsymutil=yes -> -Csplit-debuginfo=packed
  • -Zrun-dsymutil=no -> -Csplit-debuginfo=unpacked
  • -Zsplit-dwarf=single -> -Csplit-debuginfo=packed
  • -Zsplit-dwarf=split -> -Csplit-debuginfo=unpacked

Note that -Csplit-debuginfo still requires -Zunstable-options for
non-macOS platforms since split-dwarf support was just implemented in
rustc.

There's some more rationale listed on #79361, but the main gist of the
motivation for this commit is that dsymutil can take quite a long time
to execute in debug builds and provides little benefit. This means that
incremental compile times appear that much worse on macOS because the
compiler is constantly running dsymutil over every single binary it
produces during cargo build (even build scripts!). Ideally rustc would
switch to not running dsymutil by default, but that's a problem left
to get tackled another day.

Closes #79361

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking issue for -Zrun-dsymutil