-
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_codegen_llvm: Give each codegen unit a unique DWARF name on all platforms, not just Apple ones. #92024
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.
(rust-highfive has picked a reviewer for you, use r? to override) |
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 |
r? @davidtwco |
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.
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)).
@bors r+ |
📌 Commit c41fd76 has been approved by |
…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.
…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
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.