rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all platforms, not just Apple ones.#92024
Merged
bors merged 1 commit intorust-lang:masterfrom Dec 18, 2021
Merged
Conversation
platforms, not just Apple ones.
To avoid breaking split DWARF, we need to ensure that each codegen unit has a
unique `DW_AT_name`. This is because there's a remote chance that different
codegen units for the same module will have entirely identical DWARF entries
for the purpose of the DWO ID, which would violate Appendix F ("Split Dwarf
Object Files") of the DWARF 5 specification. LLVM uses the algorithm specified
in section 7.32 "Type Signature Computation" to compute the DWO ID, which does
not include any fields that would distinguish compilation units. So we must
embed the codegen unit name into the `DW_AT_name`.
Closes rust-lang#88521.
Contributor
|
(rust-highfive has picked a reviewer for you, use r? to override) |
Contributor
Author
|
Note that this only causes a problem in practice if an external (non-rustc) linker is used, because rustc contains some logic to merge DWARF compilation unit entries that has the side effect of working around this bug. That logic, however, is itself a workaround for some other LLVM bugs, so I think it's more appropriate to work around the problem here in rustc instead of adding Rust-specific logic to |
Contributor
|
r? @davidtwco |
davidtwco
approved these changes
Dec 17, 2021
Member
davidtwco
left a comment
There was a problem hiding this comment.
Thanks for fixing this, I hadn't noticed #88521 but this explains the issue I ran into when trying to bootstrap rustc with Split DWARF (#89819 (comment)).
Member
|
@bors r+ |
Collaborator
|
📌 Commit c41fd76 has been approved by |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 17, 2021
…davidtwco
rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all platforms, not just Apple ones.
To avoid breaking split DWARF, we need to ensure that each codegen unit has a
unique `DW_AT_name`. This is because there's a remote chance that different
codegen units for the same module will have entirely identical DWARF entries
for the purpose of the DWO ID, which would violate Appendix F ("Split Dwarf
Object Files") of the DWARF 5 specification. LLVM uses the algorithm specified
in section 7.32 "Type Signature Computation" to compute the DWO ID, which does
not include any fields that would distinguish compilation units. So we must
embed the codegen unit name into the `DW_AT_name`.
Closes rust-lang#88521.
This was referenced Dec 17, 2021
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 18, 2021
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#91566 (Apply path remapping to DW_AT_GNU_dwo_name when producing split DWARF) - rust-lang#91926 (Remove `in_band_lifetimes` from `rustc_metadata`) - rust-lang#91931 (Remove `in_band_lifetimes` from `rustc_codegen_llvm`) - rust-lang#92024 (rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all platforms, not just Apple ones.) - rust-lang#92037 (Use a const ParamEnv when in default_method_body_is_const) - rust-lang#92047 (Set `RUST_BACKTRACE=0` when running location-detail tests) - rust-lang#92050 (Add a space and 2 grave accents ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To avoid breaking split DWARF, we need to ensure that each codegen unit has a
unique
DW_AT_name. This is because there's a remote chance that differentcodegen units for the same module will have entirely identical DWARF entries
for the purpose of the DWO ID, which would violate Appendix F ("Split Dwarf
Object Files") of the DWARF 5 specification. LLVM uses the algorithm specified
in section 7.32 "Type Signature Computation" to compute the DWO ID, which does
not include any fields that would distinguish compilation units. So we must
embed the codegen unit name into the
DW_AT_name.Closes #88521.