[lld] r304484 - [CodeView] Properly align symbol records on read/write.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 14:52:42 PDT 2017


Author: zturner
Date: Thu Jun  1 16:52:41 2017
New Revision: 304484

URL: http://llvm.org/viewvc/llvm-project?rev=304484&view=rev
Log:
[CodeView] Properly align symbol records on read/write.

Object files have symbol records not aligned to any particular
boundary (e.g. 1-byte aligned), while PDB files have symbol
records padded to 4-byte aligned boundaries.  Since they share
the same reading / writing code, we have to provide an option to
specify the alignment and propagate it up to the producer or
consumer who knows what the alignment is supposed to be for the
given container type.

Added a test for this by modifying the existing PDB -> YAML -> PDB
round-tripping code to round trip symbol records as well as types.

Differential Revision: https://reviews.llvm.org/D33785

Modified:
    lld/trunk/COFF/PDB.cpp

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=304484&r1=304483&r2=304484&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Thu Jun  1 16:52:41 2017
@@ -157,7 +157,8 @@ static void dumpDebugS(ScopedPrinter &W,
     fatal(EC, "StreamReader.readArray<CVSymbolArray> failed");
 
   TypeDatabase TDB(0);
-  CVSymbolDumper SymbolDumper(W, TDB, nullptr, false);
+  CVSymbolDumper SymbolDumper(W, TDB, CodeViewContainer::ObjectFile, nullptr,
+                              false);
   if (auto EC = SymbolDumper.dump(Symbols))
     fatal(EC, "CVSymbolDumper::dump failed");
 }




More information about the llvm-commits mailing list