This is an archive of the discontinued LLVM Phabricator instance.

Add the ability to stamp a PDB / EXE with a given GUID / Age, and use it to test LLD reproducibility
AcceptedPublic

Authored by zturner on Mar 8 2018, 2:30 PM.

Details

Reviewers
ruiu
rnk
Summary

The idea here is that we want to test

a) That we write a valid timestamp (i.e. hash) into the PE file
and
b) That this doesn't affect determinism,

but it's difficult because the generated PDB GUID is currently not deterministic, so this non-deterministic value gets written into the PE. There's ideas to fix this, but for now we would still like to be able to test that this is the *only* source of non determinism. To deal with this, this patch introduces a subcommand to llvm-pdbutil which will stamp either an EXE or PDB with a specified GUID and age, then recompute the hash of the executable and update the various timestamp fields.

Two tests are introduced, one which verifies that two identical links without /DEBUG generate the same binary, and another which verifies that two identical links with /DEBUG generate the same binary provided they are stamped with the same GUID and Age.

Diff Detail

Event Timeline

zturner created this revision.Mar 8 2018, 2:30 PM
rnk accepted this revision.Mar 14 2018, 11:30 AM

lgtm

Sorry for the delay

llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
1174

Needs wrapping, here and elsewhere. I'm assuming clang-format will happen at some point.

This revision is now accepted and ready to land.Mar 14 2018, 11:30 AM