diff options
| author | bors <bors@rust-lang.org> | 2022-05-18 12:45:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-18 12:45:44 +0000 |
| commit | 936eba3b348e65b658b60218cc9237f02abdbeb4 (patch) | |
| tree | 170ce02aaa1fca72948775fc8adaccf2952f82e7 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | e5732a21711e7cefa6eb22e1790406b269d6197a (diff) | |
| parent | 6411fef3aba5ba54a02b54b171b4e9bc83687ce9 (diff) | |
| download | rust-936eba3b348e65b658b60218cc9237f02abdbeb4.tar.gz rust-936eba3b348e65b658b60218cc9237f02abdbeb4.zip | |
Auto merge of #96867 - michaelwoerister:path-prefix-fixes-2, r=davidtwco
--remap-path-prefix: Fix duplicated path components in debuginfo This PR fixes an issue with `--remap-path-prefix` where path components could appear twice in the remapped version of the path (e.g. https://github.com/rust-lang/rust/issues/78479). The underlying problem was that `--remap-path-prefix` is often used to map an absolute path to something that looks like a relative path, e.g.: ``` --remap-path-prefix=/home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823=crates.io", ``` and relative paths in debuginfo are interpreted as being relative to the compilation directory. So if Cargo invokes the compiler with `/home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823/some_crate-0.1.0/src/lib.rs` as input and `/home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823/some_crate-0.1.0` as the compiler's working directory, then debuginfo will state that the working directory was `crates.io/some_crate-0.1.0` and the file is question was `crates.io/some_crate-0.1.0/src/lib.rs`, which combined gives the path: ``` crates.io/some_crate-0.1.0/crates.io/some_crate-0.1.0/src/lib.rs ``` With this PR the compiler will detect this situation and set up debuginfo in LLVM in a way that makes it strip the duplicated path components when emitting DWARF. The PR also extracts the logic for making remapped paths absolute into a common helper function that is now used by debuginfo too (instead of just during crate metadata generation).
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
