-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
--remap-path-prefix behavior regression resulting in bad paths in 1.50.0 #82074
Comments
It took me a second to realize at first - the bug is that |
Bisection says the issue is in 2ba7ca2 which seems very plausible. cc @davidtwco |
So, after further investigation I can see exactly how this issue started, and why it happened. Warning: 3am rambling ahead. In particular there are a couple of issues here (I'm going to use LLVM-IR primarily here, because that's I think more convenient to demonstrate the causations, When we compile a !llvm.dbg.cu = !{!18}
!18 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !19, producer: "clang LLVM (rustc version 1.52.0-nightly (3f5aee2d5 2021-02-12))", isOptimized: false, runtimeVersion: 0, splitDebugFilename: "main.test.7rcbfp3g-cgu.0.rcgu.dwo", emissionKind: FullDebug, enums: !4, globals: !20)
!19 = !DIFile(filename: "/tmp/test.rs", directory: "outdir") Adding Now, as the issue is written (with the output path being relative), this does not necessarily present a reproducibility problem. rustc will encode a path that's "as given" to its !18 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !19, producer: "clang LLVM (rustc version 1.52.0-nightly (3f5aee2d5 2021-02-12))", isOptimized: false, runtimeVersion: 0, splitDebugFilename: "main.test.7rcbfp3g-cgu.0.rcgu.dwo", emissionKind: FullDebug, enums: !4, globals: !20)
!19 = !DIFile(filename: "test.rs", directory: "/tmp/outdir") Turns out this I have a solution in mind, I think, but I want to look at what clang does, exactly, first. |
So, this is what clang does:
With all these in mind, I see a couple of things to adjust on the rustc side, and we can probably |
@rustbot label -I-prioritize +P-high |
Assigning |
Set path of the compile unit to the source directory As part of the effort to implement split dwarf debug info, we ended up setting the compile unit location to the output directory rather than the source directory. Furthermore, it seems like we failed to remap the prefixes for this as well! The desired behaviour is to instead set the `DW_AT_GNU_dwo_name` to a path relative to compiler's working directory. This still allows debuggers to find the split dwarf files, while not changing the behaviour of the code that is compiling with regular debug info, and not changing the compiler's behaviour with regards to reproducibility. Fixes rust-lang#82074 cc `@alexcrichton` `@davidtwco`
On Rust 1.50.0 --remap-path-prefix is behaving weirdly
On 1.49.0 it works as expected and gives a path relative to what is passed
On 1.50.0 it does not work as expected, and gives a path to a non-existent file
In terms of prioritization of this issue, I'd like to make a plea for the importance of it, because at first glance it seems not a huge deal but it causes us huge problems.
We need this
--remap-path-prefix
to work so that the build artifacts are reproducible from machine to machine and for our distributed build cache to work successfully, and we also need the debugging-symbols paths to be correct so debuggers work correctly.The text was updated successfully, but these errors were encountered: