[lld] r307436 - [PDB] More changes to bring lld PDBs to parity with MSVC.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 7 13:25:39 PDT 2017
Author: zturner
Date: Fri Jul 7 13:25:39 2017
New Revision: 307436
URL: http://llvm.org/viewvc/llvm-project?rev=307436&view=rev
Log:
[PDB] More changes to bring lld PDBs to parity with MSVC.
1) Don't write a /src/headerblock stream. This appears to be
written conditionally by MSVC, but it's not clear what the
condition is. For now, just remove it since we dont' know
what it is anyway and the particular pdb we've checked in
for the test doesn't have one.
2) Write a valid timestamp for the PDB file signature. This
leads to non-reproducible builds, but it matches the default
behavior of link, so it should be out default as well. If
we need reproducibility, we should add a separate command
line option for it that is off by default.
3) Write an empty FPO stream. MSVC seems to always write an
FPO stream. This change makes the stream directory match
up, although we still need to make the contents of the FPO
stream match.
Modified:
lld/trunk/COFF/PDB.cpp
lld/trunk/test/COFF/pdb-diff.test
lld/trunk/test/COFF/pdb-none.test
lld/trunk/test/COFF/pdb.test
Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=307436&r1=307435&r2=307436&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Fri Jul 7 13:25:39 2017
@@ -412,7 +412,6 @@ void coff::createPDB(StringRef Path, Sym
// Add an Info stream.
auto &InfoBuilder = Builder.getInfoBuilder();
InfoBuilder.setAge(DI ? DI->PDB70.Age : 0);
- InfoBuilder.setSignature(time(nullptr));
llvm::SmallString<128> NativePath(Path.begin(), Path.end());
llvm::sys::fs::make_absolute(NativePath);
@@ -422,13 +421,13 @@ void coff::createPDB(StringRef Path, Sym
if (DI)
memcpy(&uuid, &DI->PDB70.Signature, sizeof(uuid));
InfoBuilder.setGuid(uuid);
- // Should be the current time, but set 0 for reproducibilty.
- InfoBuilder.setSignature(0);
+ InfoBuilder.setSignature(time(nullptr));
InfoBuilder.setVersion(pdb::PdbRaw_ImplVer::PdbImplVC70);
// Add an empty DBI stream.
pdb::DbiStreamBuilder &DbiBuilder = Builder.getDbiBuilder();
DbiBuilder.setVersionHeader(pdb::PdbDbiV70);
+ ExitOnErr(DbiBuilder.addDbgStream(pdb::DbgHeaderType::NewFPO, {}));
// It's not entirely clear what this is, but the * Linker * module uses it.
uint32_t PdbFilePathNI = DbiBuilder.addECName(NativePath);
Modified: lld/trunk/test/COFF/pdb-diff.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb-diff.test?rev=307436&r1=307435&r2=307436&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb-diff.test (original)
+++ lld/trunk/test/COFF/pdb-diff.test Fri Jul 7 13:25:39 2017
@@ -37,14 +37,14 @@ CHECK-NEXT: | DBI St
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | IPI Stream | I |
CHECK-NEXT: |------------------------------+---|
+CHECK-NEXT: | New FPO Data | {{[EI]}} |
+CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Section Header Data | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Named Stream "/names" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Named Stream "/LinkInfo" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
-CHECK-NEXT: | Named Stream "/src/heade..." | D |
-CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Module "{{.*}}\pdb-diff.obj" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Module "* Linker *" | {{[EI]}} |
@@ -59,8 +59,6 @@ CHECK-NEXT: | Public Symbol
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Public Symbol Records | D |
CHECK-NEXT: |------------------------------+---|
-CHECK-NEXT: | New FPO Data | D |
-CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: ------------------------------------
CHECK-NEXT: | String Table |
CHECK-NEXT: |------------------------------+---|
@@ -101,15 +99,13 @@ CHECK-NEXT: | Features (set) | I
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Feature | I |
CHECK-NEXT: |----------------------+---|
-CHECK-NEXT: | Named Stream Size | D |
-CHECK-NEXT: |----------------------+---|
-CHECK-NEXT: | Named Streams (map) | D |
+CHECK-NEXT: | Named Stream Size |
CHECK-NEXT: |----------------------+---|
-CHECK-NEXT: | /names | I |
+CHECK-NEXT: | Named Streams (map) | {{[EI]}} |
CHECK-NEXT: |----------------------+---|
-CHECK-NEXT: | /LinkInfo | E |
+CHECK-NEXT: | /names | {{[EI]}} |
CHECK-NEXT: |----------------------+---|
-CHECK-NEXT: | /src/headerblock | D |
+CHECK-NEXT: | /LinkInfo | {{[EI]}} |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: ----------------------------------------------
CHECK-NEXT: | DBI Stream |
@@ -152,7 +148,7 @@ CHECK-NEXT: |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Pdata) | I |
CHECK-NEXT: |----------------------------------------+---|
-CHECK-NEXT: | DBG (NewFPO) | D |
+CHECK-NEXT: | DBG (NewFPO) | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (SectionHdrOrig) | I |
CHECK-NEXT: |----------------------------------------+---|
Modified: lld/trunk/test/COFF/pdb-none.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb-none.test?rev=307436&r1=307435&r2=307436&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb-none.test (original)
+++ lld/trunk/test/COFF/pdb-none.test Fri Jul 7 13:25:39 2017
@@ -7,8 +7,8 @@
# CHECK: PdbStream:
# CHECK-NEXT: Age: 0
-# CHECK-NEXT: Guid: '{00000000-0000-0000-0000-000000000000}'
-# CHECK-NEXT: Signature: 0
+# CHECK-NEXT: Guid:
+# CHECK-NEXT: Signature:
# CHECK-NEXT: Features: [ VC140 ]
# CHECK-NEXT: Version: VC70
Modified: lld/trunk/test/COFF/pdb.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb.test?rev=307436&r1=307435&r2=307436&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb.test (original)
+++ lld/trunk/test/COFF/pdb.test Fri Jul 7 13:25:39 2017
@@ -26,7 +26,7 @@
# CHECK: PdbStream:
# CHECK-NEXT: Age: 1
# CHECK-NEXT: Guid:
-# CHECK-NEXT: Signature: 0
+# CHECK-NEXT: Signature:
# CHECK-NEXT: Features: [ VC140 ]
# CHECK-NEXT: Version: VC70
# CHECK-NEXT: DbiStream:
@@ -186,17 +186,17 @@ RAW-NEXT: IMAGE_SCN_MEM_READ
RAW: Section Map
RAW-NEXT: ============================================================
RAW-NEXT: Section 0000 | ovl = 0, group = 0, frame = 0, name = 1
-RAW-NEXT: class = 65535, offset = 0, size =
+RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0001 | ovl = 1, group = 0, frame = 0, name = 2
-RAW-NEXT: class = 65535, offset = 0, size =
+RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: flags = read | execute | 32 bit addr | selector
RAW-NEXT: Section 0002 | ovl = 2, group = 0, frame = 0, name = 3
-RAW-NEXT: class = 65535, offset = 0, size =
+RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0003 | ovl = 3, group = 0, frame = 0, name = 4
-RAW-NEXT: class = 65535, offset = 0, size =
+RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0004 | ovl = 4, group = 0, frame = 0, name = 5
-RAW-NEXT: class = 65535, offset = 0, size =
+RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: flags = 32 bit addr | absolute addr
More information about the llvm-commits
mailing list