-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
cg: split dwarf for crate dependencies #89819
cg: split dwarf for crate dependencies #89819
Conversation
|
I think I'm probably missing something, but could you reiterate why a new compiler option is needed? Dealing with the matrix of |
C++ compilers provide both split and single modes for their split dwarf implementations (and don't provide packed/unpacked option equivalents as it doesn't make as much sense for the compiler to do that for those languages), but I'm not sure if there are distinct use cases that each of these variants cater to, or particular reasons why you'd want one over the other. I don't think that it's too complicated to maintain both All of that said, it isn't strictly necessary, and it's unlikely to be an option that most users of split debuginfo will need. I don't think it makes sense or is intuitive for packed/unpacked to affect where the split debuginfo goes for split dwarf though (as it does now), that option feels like it should only change the packed-ness of the debuginfo, so we could alternatively just use split mode in both packed/unpacked. |
Hm so I was under the impression that the 4 options for dwarf were:
That corresponds to |
As I understand it, it would be:
I've described this in an earlier comment which phrases it differently, that might help. I don't know what the specific use-cases for single vs split mode are for split dwarf, I just noticed that these were the variants provided by C++ compilers and so implemented both in rustc. |
Oof that's a lot of modes. Well in that case seems like we do need a flag or more options! |
Noticed there's still a bug in this somewhere, trying to build rustc with packed split dwarf will fail with an error about a duplicate DWO ID, should work fine for smaller crates, haven't been able to produce a small reproduction but I didn't spend too much time on it. |
This seems reasonable to me, though I would like to see a description of a use-case before we stabilize the option. r=me with or without the nit about exhaustive matches and whatever other bugs that you see fixed. |
260b924
to
2935c95
Compare
Looks like the motivation is primarily to retain compatability with tools that only understand object files (source):
|
This comment has been minimized.
This comment has been minimized.
2935c95
to
f05a938
Compare
@bors r=nagisa |
📌 Commit f05a938581b609c0636474b2c8f8e6f0d89d42a4 has been approved by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Looks like an apple runner issue ? let's @bors retry |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
In rust-lang#79570, `-Z split-dwarf-kind={none,single,split}` was replaced by `-C split-debuginfo={off,packed,unpacked}`. `-C split-debuginfo`'s packed and unpacked aren't exact parallels to single and split, respectively. On Unix, `-C split-debuginfo=packed` will put debuginfo into object files and package debuginfo into a DWARF package file (`.dwp`) and `-C split-debuginfo=unpacked` will put debuginfo into dwarf object files and won't package it. In the initial implementation of Split DWARF, split mode wrote sections which did not require relocation into a DWARF object (`.dwo`) file which was ignored by the linker and then packaged those DWARF objects into DWARF packages (`.dwp`). In single mode, sections which did not require relocation were written into object files but ignored by the linker and were not packaged. However, both split and single modes could be packaged or not, the primary difference in behaviour was where the debuginfo sections that did not require link-time relocation were written (in a DWARF object or the object file). This commit re-introduces a `-Z split-dwarf-kind` flag, which can be used to pick between split and single modes when `-C split-debuginfo` is used to enable Split DWARF (either packed or unpacked). Signed-off-by: David Wood <david.wood@huawei.com>
`thorin` is a Rust implementation of a DWARF packaging utility that supports reading DWARF objects from archive files (i.e. rlibs) and therefore is better suited for integration into rustc. Signed-off-by: David Wood <david.wood@huawei.com>
This reverts commit 241160d.
f88572b
to
7ecdc89
Compare
@bors r=nagisa |
📌 Commit 7ecdc89 has been approved by |
@bors rollup=never |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a77cc64): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Fixes #81024.
In rustc: Stabilize
-Zrun-dsymutil
as-Csplit-debuginfo
#79570,-Z split-dwarf-kind={none,single,split}
was replaced by-C split-debuginfo={off,packed,unpacked}
.-C split-debuginfo
's packed and unpacked aren't exact parallels to single and split, respectively.On Unix,
-C split-debuginfo=packed
will put debuginfo in object files and package debuginfo into a DWARF package file (.dwp
) and-C split-debuginfo=unpacked
will put debuginfo in dwarf object files and won't package it.In the initial implementation of Split DWARF, split mode wrote sections which did not require relocation into a DWARF object (
.dwo
) file which was ignored by the linker and then packaged those DWARF objects into DWARF packages (.dwp
). In single mode, sections which did not require relocation were written into object files but ignored by the linker and were not packaged. However, both split and single modes could be packaged or not, the primary difference in behaviour was where the debuginfo sections that did not require link-time relocation were written (in a DWARF object or the object file).In the first commit of this PR, I re-introduce a
-Z split-dwarf-kind
flag, which can be used to pick between split and single modes when-C split-debuginfo
is used to enable Split DWARF (either packed or unpacked).Split DWARF packaging requires all of the object files to exist, including those in dependencies.
Therefore, the second commit of this PR makes rustc keep all objects or dwarf objects for unpacked mode and if the crate is a dependency in packed mode (determined by heuristic: if no linking is taking place), then objects or dwarf objects are kept. Objects are kept if-Z split-dwarf-kind
isSplitDwarfKind::Single
, and dwarf objects ifSplitDwarfKind::Split
.There are other approaches that could be taken to supporting packed Split DWARF with crate dependencies but this seemed like the least complicated and was contained to only rustc. Other potential approaches are described in split dwarf doesn't work with crate dependencies #81024 (comment), I'm happy to change the approach I've taken here if it isn't what we're looking for.See cg: split dwarf for crate dependencies #89819 (comment) for the current approach.There's still a dependency onSee cg: split dwarf for crate dependencies #89819 (comment).llvm-dwp
after this change, which we probably want to move away from but that seems out-of-scope for this PR. Ideally, Split DWARF (in packed or unpacked modes) will be usable on nightly after this lands. If there aren't any bugs reported then it's possible we could allow Split DWARF to be used on stable after this change, it depends whether or not switching away fromllvm-dwp
later would break any guarantees, or whether we'd want to change how we handle this cross-crate case in future.r? @nagisa
cc @alexcrichton