win: Pass a fake fixed /pdbsourcepath: for (non-sanitizer) symbol_level=1 builds.

/pdbsourcepath: before this change here was used to tell lld-link about the
build directory. The setup was that the compiler can produce debug info
with relative paths in its output (to make them build-dir independent, which
helps goma cache obj files), and then at link time those relative paths were
made absolute.

In symbol_level=1 builds, the obj files don't contain any debug info, the
linker just adds enough debug info at link time to get symbolized stacks
(without line numbers). So we don't need to pass a real build directory in that
case and can pass a fake fixed path. (sanitizer builds do pass
-gline-tables-only and hence have some debug info in the obj files even with
symbol_level=1, do don't do this there).

After http://reviews.llvm.org/rL344061, /pdbsourcepath: is also used as the
base path in all other places that contain absolute paths:

- The "cwd" stored in the env block in the pdb is /pdbsourcepath: if present
- The "exe" stored in the env block in the pdb is made absolute relative to
  /pdbsourcepath: instead of the cwd
- The "pdb" stored in the env block in the pdb is made absolute relative to
  /pdbsourcepath: instead of the cwd
- For making absolute paths to .obj files referenced from the pdb

This makes PDBs independent of the build dir in symbol_level=1 builds, and since
the hash of the PDB contents are copied as PDB UUID into the executable,
it makes executables reproducibe in symbol_level=1 builds too.

Bug: 330260
Change-Id: Iaf0bd9f8259b3c97b5c6cff497d31d6043faa807
Reviewed-on: https://chromium-review.googlesource.com/c/1273479
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600599}
1 file changed