Create a TPI stream only when /debugpdb is given.
authorRui Ueyama <ruiu@google.com>
Sat, 10 Dec 2016 17:23:23 +0000 (17:23 +0000)
committerRui Ueyama <ruiu@google.com>
Sat, 10 Dec 2016 17:23:23 +0000 (17:23 +0000)
Adding type records to TPI stream is too time consuming.
It is reported that linking chrome_child.dll took 5 minutes.

llvm-svn: 289330

lld/COFF/Config.h
lld/COFF/Driver.cpp
lld/COFF/Options.td
lld/COFF/PDB.cpp
lld/test/COFF/pdb.test

index 56b2b51..0fa3338 100644 (file)
@@ -153,6 +153,7 @@ struct Configuration {
   bool HighEntropyVA = false;
 
   // This is for debugging.
+  bool DebugPdb = false;
   bool DumpPdb = false;
 };
 
index 63841a4..9d3e9d7 100644 (file)
@@ -540,6 +540,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
   if (Args.hasArg(OPT_nosymtab))
     Config->WriteSymtab = false;
   Config->DumpPdb = Args.hasArg(OPT_dumppdb);
+  Config->DebugPdb = Args.hasArg(OPT_debugpdb);
 
   // Create a list of input files. Files can be given as arguments
   // for /defaultlib option.
index 86a81f4..9dfbcc8 100644 (file)
@@ -94,6 +94,7 @@ def help_q : Flag<["/?", "-?"], "">, Alias<help>;
 def nosymtab : F<"nosymtab">;
 
 // Flags for debugging
+def debugpdb : F<"debugpdb">;
 def dumppdb : Joined<["/", "-"], "dumppdb">;
 def lldmap : F<"lldmap">;
 def lldmap_file : Joined<["/", "-"], "lldmap:">;
index 55fd867..56d5a36 100644 (file)
@@ -162,7 +162,8 @@ void coff::createPDB(StringRef Path, SymbolTable *Symtab,
   // Add an empty TPI stream.
   auto &TpiBuilder = Builder.getTpiBuilder();
   TpiBuilder.setVersionHeader(pdb::PdbTpiV80);
-  addTypeInfo(Symtab, TpiBuilder);
+  if (Config->DebugPdb)
+    addTypeInfo(Symtab, TpiBuilder);
 
   // Add an empty IPI stream.
   auto &IpiBuilder = Builder.getIpiBuilder();
index 14b9e00..af174b7 100644 (file)
@@ -1,5 +1,6 @@
 # RUN: yaml2obj %s > %t.obj
-# RUN: lld-link /debug /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib %t.obj
+# RUN: lld-link /debug /pdb:%t.pdb /dll /out:%t.dll /entry:main /nodefaultlib \
+# RUN:   /debugpdb %t.obj
 # RUN: llvm-pdbdump pdb2yaml -stream-metadata -stream-directory -pdb-stream \
 # RUN:   -dbi-stream -ipi-stream -tpi-stream %t.pdb | FileCheck %s