-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustc: Add the ability to not run dsymutil #47784
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
/// Returns a boolean indicating whether we should preserve the object files on | ||
/// the filesystem for their debug information. This is often useful with | ||
/// split-dwarf like schemes. | ||
fn preserve_objects_for_their_debuginfo(sess: &Session) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sort of hoping that we can use a function like this to enable split dwarf on Linux over time as well!
Would |
A good question and one I forgot to verify! Looks like the answer is "no" though which is a bummer! @JohnColanduoni, out of curiosity, do you know if there's a way to get libbacktrace to relatively easily do the same logic that lldb is doing? (looking for object files in addition to the dSYM) |
@alexchrichton Not easily, it would probably make more sense to add this feature as part of a pure-Rust rewrite of libbacktrace. I didn’t know lldb had this functionality on Mac, I’ve had issues where lldb refuses to give me line numbers if Spotlight hasn’t yet indexed tbe dSYM. |
4bbc9c6
to
83c4363
Compare
Ah ok, thanks for the info @JohnColanduoni! In light of that I've now switched this to a |
src/librustc_trans/back/link.rs
Outdated
@@ -77,7 +77,7 @@ pub fn get_linker(sess: &Session) -> (PathBuf, Command, Vec<(OsString, OsString) | |||
Command::new(linker) | |||
}; | |||
|
|||
if let Some(ref linker) = sess.opts.cg.linker { | |||
if let Some(ref linker) = sess.opts.debugging_opts.linker { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you've changed the wrong variable...
[00:18:57] error[E0609]: no field `linker` on type `rustc::session::config::DebuggingOptions`
[00:18:57] --> librustc_trans/back/link.rs:80:56
[00:18:57] |
[00:18:57] 80 | if let Some(ref linker) = sess.opts.debugging_opts.linker {
[00:18:57] | ^^^^^^ unknown field
[00:18:57] |
[00:18:57] = note: available fields are: `codegen_backend`, `verbose`, `span_free_formats`, `identify_regions`, `emit_end_regions` ... and 89 others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
er oops!
src/librustc_trans/back/link.rs
Outdated
// *not* running dsymutil then the object files are the only source of truth | ||
// for debug information, so we must preserve them. | ||
if sess.target.target.options.is_like_osx { | ||
match sess.opts.cg.run_dsymutil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... the cg
↦ debugging_opts
should be applied here 😄
[00:18:57] error[E0609]: no field `run_dsymutil` on type `rustc::session::config::CodegenOptions`
[00:18:57] --> librustc_trans/back/link.rs:224:28
[00:18:57] |
[00:18:57] 224 | match sess.opts.cg.run_dsymutil {
[00:18:57] | ^^^^^^^^^^^^ unknown field
[00:18:57] |
[00:18:57] = note: available fields are: `ar`, `linker`, `link_arg`, `link_args`, `link_dead_code` ... and 28 others
83c4363
to
526feb6
Compare
@kennytm @alexcrichton Something seems odd here; GitHub isn't displaying the commits in which kennytm's review comments were resolved, if indeed they were resolved. What is the status on this? (Also, does @michaelwoerister still need to review, since kennytm already did?) |
Ah I think we're just waiting on review! @michaelwoerister I believe is on leave right now, but this isn't a particularly pressing PR so I'd be fine waiting. |
☔ The latest upstream changes (presumably #48053) made this pull request unmergeable. Please resolve the merge conflicts. |
526feb6
to
0d89143
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks, @alexcrichton!
src/librustc_trans/back/link.rs
Outdated
@@ -168,7 +168,9 @@ pub(crate) fn link_binary(sess: &Session, | |||
if !sess.opts.cg.save_temps { | |||
if sess.opts.output_types.should_trans() { | |||
for obj in trans.modules.iter().filter_map(|m| m.object.as_ref()) { | |||
remove(sess, obj); | |||
if !preserve_objects_for_their_debuginfo(sess) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that it makes much of a difference but this if
could be pulled out of the loop, I think.
0d89143
to
d83ddb9
Compare
This commit adds the ability for rustc to not run `dsymutil` by default on OSX. A new codegen option, `-Z run-dsymutil=no`, was added to specify that `dsymutil` should *not* run and instead the compiler should unconditionally keep the object files around in a compilation if necessary for debug information. cc rust-lang#47240
d83ddb9
to
0f16eee
Compare
@bors: r=michaelwoerister |
📌 Commit 0f16eee has been approved by |
@bors: rollup |
…elwoerister rustc: Add the ability to not run dsymutil This commit adds the ability for rustc to not run `dsymutil` by default on OSX. A new codegen option, `-Z run-dsymutil=no`, was added to specify that `dsymutil` should *not* run and instead the compiler should unconditionally keep the object files around in a compilation if necessary for debug information. cc rust-lang#47240
…elwoerister rustc: Add the ability to not run dsymutil This commit adds the ability for rustc to not run `dsymutil` by default on OSX. A new codegen option, `-Z run-dsymutil=no`, was added to specify that `dsymutil` should *not* run and instead the compiler should unconditionally keep the object files around in a compilation if necessary for debug information. cc rust-lang#47240
This commit adds the ability for rustc to not run
dsymutil
by defaulton OSX. A new codegen option,
-Z run-dsymutil=no
, was added to specifythat
dsymutil
should not run and instead the compiler shouldunconditionally keep the object files around in a compilation if
necessary for debug information.
cc #47240