diff options
author | Zachary Turner <zturner@google.com> | 2017-07-07 05:04:36 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-07-07 05:04:36 +0000 |
commit | 6c4bfba8f3e2f08f5b42f8a18c3ab0d5a3f5e23c (patch) | |
tree | 28248d3a8bf2dd6fcff2043da577e40166fc07e7 /llvm/include | |
parent | 41f02a9960c3bc36190dae149e9616d8a872a715 (diff) | |
download | bcm5719-llvm-6c4bfba8f3e2f08f5b42f8a18c3ab0d5a3f5e23c.tar.gz bcm5719-llvm-6c4bfba8f3e2f08f5b42f8a18c3ab0d5a3f5e23c.zip |
[PDB] Teach libpdb to write DBI Stream ECNames.
Based strictly on the name, this seems to have something to do
width edit & continue. The goal of this patch has nothing to do
with supporting edit and continue though. msvc link.exe writes
very basic information into this area even when *not* compiling
with support for E&C, and so the goal here is to bring lld-link
to parity. Since we cannot know what assumptions standard tools
make about the content of PDB files, we need to be as close as
possible.
This ECNames data structure is a standard PDB string hash table.
link.exe puts a single string into this hash table, which is the
full path to the PDB file on disk. It then references this string
from the module descriptor for the compiler generated `* Linker *`
module.
With this patch, lld-link will generate the exact same sequence of
bytes as MSVC link for this subsection for a given object file
input (as reported by `llvm-pdbutil bytes -ec`).
llvm-svn: 307356
Diffstat (limited to 'llvm/include')
3 files changed, 8 insertions, 0 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h b/llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h index 64b195034f5..c918a5d5e97 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h @@ -47,6 +47,7 @@ public: DbiModuleDescriptorBuilder & operator=(const DbiModuleDescriptorBuilder &) = delete; + void setPdbFilePathNI(uint32_t NI); void setObjFileName(StringRef Name); void addSymbol(codeview::CVSymbol Symbol); @@ -85,6 +86,7 @@ private: msf::MSFBuilder &MSF; uint32_t SymbolByteSize = 0; + uint32_t PdbFilePathNI = 0; std::string ModuleName; std::string ObjFileName; std::vector<std::string> SourceFiles; diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/DbiStream.h b/llvm/include/llvm/DebugInfo/PDB/Native/DbiStream.h index 3bf79072665..4be113f28d6 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/DbiStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/DbiStream.h @@ -83,6 +83,8 @@ public: FixedStreamArray<SecMapEntry> getSectionMap() const; void visitSectionContributions(ISectionContribVisitor &Visitor) const; + Expected<StringRef> getECName(uint32_t NI) const; + private: Error initializeSectionContributionData(); Error initializeSectionHeadersData(); diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h b/llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h index 74441185418..7d11cf3d6bb 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h @@ -15,6 +15,7 @@ #include "llvm/Support/Error.h" #include "llvm/DebugInfo/PDB/Native/PDBFile.h" +#include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h" #include "llvm/DebugInfo/PDB/Native/RawConstants.h" #include "llvm/DebugInfo/PDB/PDBTypes.h" #include "llvm/Support/BinaryByteStream.h" @@ -54,6 +55,8 @@ public: // Add given bytes as a new stream. Error addDbgStream(pdb::DbgHeaderType Type, ArrayRef<uint8_t> Data); + uint32_t addECName(StringRef Name); + uint32_t calculateSerializedLength() const; Expected<DbiModuleDescriptorBuilder &> addModuleInfo(StringRef ModuleName); @@ -108,6 +111,7 @@ private: StringMap<uint32_t> SourceFileNames; + PDBStringTableBuilder ECNamesBuilder; WritableBinaryStreamRef NamesBuffer; MutableBinaryByteStream FileInfoBuffer; std::vector<SectionContrib> SectionContribs; |