You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DWARF information does not contain absolute file locations for generics #54408
Dump DWARF info llvm-dwarfdump hey -debug-info -debug-line > hey.txt
Notice that hey.txt contains such entries as DW_AT_decl_file ("/home/yury/liballoc/vec.rs"), possibly produced by the fact that "liballoc/vec.rs" is a relative path and DW_AT_comp_dir is set to "/home/yury".
It is expected for core files to have absolute path e.g. "/rustc/20dc0c50704ba1fc8c56a88ae2bf05ddb3e419bc/src/liballoc/raw_vec.rs"
FWIW, rustc +nightly hey.rs --crate-type=cdylib -g --emit=llvm-ir -o hey.ll produces hey.ll that shows that !DIFile entries has the directory field empty (and the filename is relative)
It is a regression, since +stable has absolute locations, e.g. !47 = !DIFile(filename: "/Users/travis/build/rust-lang/rust/src/libcore/ptr.rs", directory: "")
It appears that if upstream crates (like libstd) use --remap-path-prefix then their filename is listed as the original relative source file instead of the absolute path name that it had previous to #53829 when it wasn't compiled with --remap-path-prefix.
So somehow using --remap-path-prefix to compile libstd is affecting downstream crates to have relative path names instead of old absolute path names. It makes sense to me that the absolute path name goes away with --remap-path-prefix (that is the whole point after all) but ideally it'd still be an absolute path, just applying the mapping.
@michaelwoerister would you be able to help point me in the direction of where this change in logic might happen? If so I can test out a patch!
Activity
eddyb commentedon Sep 25, 2018
cc @michaelwoerister @tromey I wonder what interaction (path rewriting?) causes this result.
yurydelendik commentedon Sep 25, 2018
FWIW,
rustc +nightly hey.rs --crate-type=cdylib -g --emit=llvm-ir -o hey.llproduces hey.ll that shows that !DIFile entries has the directory field empty (and the filename is relative)yurydelendik commentedon Sep 25, 2018
It is a regression, since +stable has absolute locations, e.g.
!47 = !DIFile(filename: "/Users/travis/build/rust-lang/rust/src/libcore/ptr.rs", directory: "")michaelwoerister commentedon Sep 25, 2018
@alexcrichton, could this have to do with #53829?
alexcrichton commentedon Sep 26, 2018
Likely so! I'll try to look into this in the near future
alexcrichton commentedon Sep 26, 2018
Ok so the change here can be exhibited with this script:
If you execute that script you see:
but if you remove
--remap-path-prefixyou see:It appears that if upstream crates (like libstd) use
--remap-path-prefixthen their filename is listed as the original relative source file instead of the absolute path name that it had previous to #53829 when it wasn't compiled with--remap-path-prefix.So somehow using
--remap-path-prefixto compile libstd is affecting downstream crates to have relative path names instead of old absolute path names. It makes sense to me that the absolute path name goes away with--remap-path-prefix(that is the whole point after all) but ideally it'd still be an absolute path, just applying the mapping.@michaelwoerister would you be able to help point me in the direction of where this change in logic might happen? If so I can test out a patch!
michaelwoerister commentedon Sep 27, 2018
@alexcrichton This should be what you're looking for:
rust/src/librustc_metadata/encoder.rs
Lines 352 to 358 in e999ebd
One solution would be to compile libstd with absolute paths and apply proper remapping to those.
alexcrichton commentedon Sep 27, 2018
Ah that's perfect! I'll see if I can work up a solution to that soon
rustc: Tweak filenames encoded into metadata
Rollup merge of rust-lang#54626 - alexcrichton:dwarf-generics, r=mich…
Rollup merge of rust-lang#54626 - alexcrichton:dwarf-generics, r=mich…
Rollup merge of rust-lang#54626 - alexcrichton:dwarf-generics, r=mich…
Auto merge of #54626 - alexcrichton:dwarf-generics, r=michaelwoerister