[CodeView] Properly align symbol records on read/write.
authorZachary Turner <zturner@google.com>
Thu, 1 Jun 2017 21:52:41 +0000 (21:52 +0000)
committerZachary Turner <zturner@google.com>
Thu, 1 Jun 2017 21:52:41 +0000 (21:52 +0000)
commitebd3ae8371b4ca7b4c9c0bd62f28babaaf25a633
tree17fdc737dd47911abd76029d670ff96b10860285
parent678aa336fa8d0cfac176d3bd95ddb96f545bbe68
[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

llvm-svn: 304484
20 files changed:
lld/COFF/PDB.cpp
llvm/include/llvm/DebugInfo/CodeView/CodeView.h
llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
llvm/include/llvm/DebugInfo/CodeView/SymbolDumper.h
llvm/include/llvm/DebugInfo/CodeView/SymbolRecordMapping.h
llvm/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
llvm/include/llvm/ObjectYAML/CodeViewYAMLSymbols.h
llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp
llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
llvm/test/DebugInfo/PDB/pdbdump-write.test
llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
llvm/tools/llvm-readobj/COFFDumper.cpp