[PATCH] D43978: Write a hash of the binary as the PE Debug Directory Timestamp

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 18:25:08 PST 2018


zturner added a comment.

Apparently this *still* isn't quite right.  The scenario presented to me was this:

1. User does a clean build, hash X gets written into PDB, hash Y gets written into EXE.
2. User archives EXE and PDB on symbol store.  EXE is in some directory X, PDB is in some directory Y.
3. User adds some blank lines and rebuilds.  EXE doesn't change but PDB does.
4. User re-archives.  EXE is unchanged so doesn't get updated on the symbol store, but PDB does.  PDB now gets archived in directory Z.

So now there is only one EXE, Y, but there are two PDBs, X and Z.  If you have the new source code, you will run the EXE, it will find it under directory Y in the sym store, map to the old PDB X, and the source won't match.

I think the solution to this is:

a) Hash the PDB first.  Call it X, write this value into the PDB.
b) In the debug directories, write X for the time stamp.
c) Now hash the executable after you have written X in the debug directories, call this Y.
d) Write Y into the coff file header time stamp.


https://reviews.llvm.org/D43978





More information about the llvm-commits mailing list