[PATCH] D43913: Delay writing the PDB build id until just before file commit.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 14:51:06 PST 2018


ruiu added inline comments.


================
Comment at: lld/COFF/PDB.cpp:1124
 
-void PDBLinker::commit() {
+void PDBLinker::commit(const llvm::codeview::DebugInfo &BuildId) {
   // Write to a file.
----------------
Remove `llvm::`.


================
Comment at: lld/COFF/PDB.cpp:1128-1136
+  // Set the build id in the pdb file.
+  // FIXME: Set Signature here to the timestamp of the executable.  For
+  //        reproducible builds, we will probably want to go further and set
+  //        this field to a hash of the PDB file, then set the timestamp of
+  //        the executable to be the same hash.
+  Result.IdPtr->Age = BuildId.PDB70.Age;
+  ::memcpy(&Result.IdPtr->Guid, &BuildId.PDB70.Signature,
----------------
Does this unconditionally set `time(nullptr)` to the build id? If so, can't you pass it as an argument to Builder ctor or something?


================
Comment at: llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp:30
+      NamedStreams(NamedStreams) {
+  ::memset(Guid.Guid, 0, sizeof(Guid));
+}
----------------
This is suspicious -- is sizeof(Guid) == sizeof(Guid.Guid)?


https://reviews.llvm.org/D43913





More information about the llvm-commits mailing list