win: Pass /pdbaltpath:%_PDB% to the linker every time we pass /DEBUG.

The linker by defaults writes the absolute path to the corresponding pdb
into executables it creates (if /DEBUG is passed).

/pdbaltpath:%_PDB% tells it to instead just write the basename of the pdb
into the executable, which makes the build more reproducible:

1. Different build directories no longer cause the part of the exe that contains
   the pdb path to be different.

2. More subtly, the pdb file contains offsets into the executable, and if the
   pdb path has different lengths on different systems, the pdb file will be
   different due to the absolute pdb path in the executable.  lld-link sets the
   UUID of the pdb to the hash of the pdb file contents, and the UUID of the
   pdb is also stored in the executable.  So this is also one of the parts
   needed to make the pdb output deterministic.

(Note that while link.exe has supported /pdbaltpath:%_PDB% for a long time,
lld-link learned about %_PDB% only very recently, and this CL depends on the
clang roll https://chromium-review.googlesource.com/c/1271718.)

Bug: 330260
Change-Id: If4c505ababa46ed4f51330521ff09f12f6840a47
Reviewed-on: https://chromium-review.googlesource.com/c/1273475
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598940}
2 files changed