diff options
author | Mike McLaughlin <mikem@microsoft.com> | 2017-07-11 09:58:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 09:58:49 -0700 |
commit | 065a5216c1d16ff519bf18c5b559c8eda276f580 (patch) | |
tree | ccecb982fe8e55dea7a361c8f2f271b14c8f1579 /src/zap | |
parent | 6fba4442f146a38e0874e43917d6f9d5eb9d581a (diff) | |
download | coreclr-065a5216c1d16ff519bf18c5b559c8eda276f580.tar.gz coreclr-065a5216c1d16ff519bf18c5b559c8eda276f580.tar.bz2 coreclr-065a5216c1d16ff519bf18c5b559c8eda276f580.zip |
Fix crossgen debug directory generation problems. (#12715)
* Fix crossgen debug directory generation problems.
The first problem was that when the existing/incoming PDB debug
directory entry was a portable PDB (MinorVersion == 0x504d), the
ngen/native PDB added had the same MinorVersion indicating that
it was a portable PDB (but it never can be).
This was fixed by setting MinorVersion to 0 when creating the
ngen PDB debug directory entry.
The second problem was that the ngen PDB entry was being created
even when crossgen was run on linux/mac, etc.
The fix was to ifdef NO_NGENPDB the save ngen PDB entry code.
Diffstat (limited to 'src/zap')
-rw-r--r-- | src/zap/zapheaders.cpp | 6 | ||||
-rw-r--r-- | src/zap/zapheaders.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/zap/zapheaders.cpp b/src/zap/zapheaders.cpp index 8960798981..f3dab63683 100644 --- a/src/zap/zapheaders.cpp +++ b/src/zap/zapheaders.cpp @@ -282,6 +282,7 @@ void ZapDebugDirectory::SaveOriginalDebugDirectoryEntry(ZapWriter *pZapWriter) void ZapDebugDirectory::SaveNGenDebugDirectoryEntry(ZapWriter *pZapWriter) { +#if !defined(NO_NGENPDB) _ASSERTE(pZapWriter); IMAGE_DEBUG_DIRECTORY debugDirectory = {0}; @@ -292,6 +293,10 @@ void ZapDebugDirectory::SaveNGenDebugDirectoryEntry(ZapWriter *pZapWriter) debugDirectory.Type = IMAGE_DEBUG_TYPE_CODEVIEW; debugDirectory.SizeOfData = m_pNGenPdbDebugData->GetSize(); debugDirectory.AddressOfRawData = m_pNGenPdbDebugData->GetRVA(); + // Make sure the "is portable pdb" indicator (MinorVersion == 0x504d) is clear + // for the NGen debug directory entry since this debug directory is copied + // from an existing entry which could be a portable pdb. + debugDirectory.MinorVersion = 0; { ZapPhysicalSection *pPhysicalSection = ZapImage::GetImage(pZapWriter)->m_pTextSection; DWORD dwOffset = m_pNGenPdbDebugData->GetRVA() - pPhysicalSection->GetRVA(); @@ -299,6 +304,7 @@ void ZapDebugDirectory::SaveNGenDebugDirectoryEntry(ZapWriter *pZapWriter) debugDirectory.PointerToRawData = pPhysicalSection->GetFilePos() + dwOffset; } pZapWriter->Write(&debugDirectory, sizeof(debugDirectory)); +#endif // NO_NGENPDB } void ZapDebugDirectory::Save(ZapWriter * pZapWriter) diff --git a/src/zap/zapheaders.h b/src/zap/zapheaders.h index 0755c0ed2d..f966ced1b1 100644 --- a/src/zap/zapheaders.h +++ b/src/zap/zapheaders.h @@ -249,7 +249,12 @@ public: virtual DWORD GetSize() { +#if defined(NO_NGENPDB) + return sizeof(IMAGE_DEBUG_DIRECTORY) * m_nDebugDirectory; +#else + // Add one for NGen PDB debug directory entry return sizeof(IMAGE_DEBUG_DIRECTORY) * (m_nDebugDirectory + 1); +#endif // NO_NGENPDB } virtual UINT GetAlignment() |