This is an archive of the discontinued LLVM Phabricator instance.

Use native path syntax when writing PDB module name.
ClosedPublic

Authored by zturner on Jul 6 2017, 2:54 PM.

Details

Summary

Previously lld-link would write module names containing forward slashes, even on Windows. This differs from what link does, which makes sure all paths are Windows-ized. This may or may not be necessary for Windows tools to work with clang-cl generated PDBs, but since we don't know, we need to do the same thing. This issue was also causing diff to think these were two different modules and not comparing their fields, so we now get better output from diff.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner created this revision.Jul 6 2017, 2:54 PM
rnk added inline comments.Jul 7 2017, 9:51 AM
lld/COFF/PDB.cpp
248–249 ↗(On Diff #105545)

We should explicitly pass sys::fs::style::windows to get the same behavior on Linux, right? Otherwise the test won't pass there.

lld/test/COFF/pdb-diff.test
175 ↗(On Diff #105545)

This absolute path won't be the same on other people's systems.

zturner added inline comments.Jul 7 2017, 9:58 AM
lld/COFF/PDB.cpp
248–249 ↗(On Diff #105545)

I actually think we should use native path syntax. We're already in uncharted waters dealing with cross-compilation because we'll be the first ones that have ever tried to do it, but since semantically the PDB file is supposed to contain "absolute path to the module on the file system where it was compiled", it seems like we need it to be a real path. A windows tool isn't going to understand a path to a different machine anyway (even if it uses windows path syntax), so we might as well write it in a way that at least *some* system can make sense of the path. We can fix the test by using a regex like `{{.*pdb-diff.obj}}

lld/test/COFF/pdb-diff.test
175 ↗(On Diff #105545)

Fixed offline.

This revision was automatically updated to reflect the committed changes.