[LLD] [COFF] Align all debug directories

Match MSVC linker output - align all debug directories on four bytes,
while removing debug directory alignment. This would have the same
effect on CETCOMPAT support as D89919.

Chromium bug: https://crbug.com/1136664

Differential Revision: https://reviews.llvm.org/D89921
This commit is contained in:
Peter Penzin 2020-10-29 15:50:40 -07:00 committed by Reid Kleckner
parent 31a3aca7f9
commit e59726220f
1 changed files with 7 additions and 8 deletions

View File

@ -978,16 +978,15 @@ void Writer::createMiscChunks() {
}
if (config->cetCompat) {
ExtendedDllCharacteristicsChunk *extendedDllChars =
make<ExtendedDllCharacteristicsChunk>(
IMAGE_DLL_CHARACTERISTICS_EX_CET_COMPAT);
debugRecords.push_back(
{COFF::IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS, extendedDllChars});
debugRecords.push_back({COFF::IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS,
make<ExtendedDllCharacteristicsChunk>(
IMAGE_DLL_CHARACTERISTICS_EX_CET_COMPAT)});
}
if (debugRecords.size() > 0) {
for (std::pair<COFF::DebugType, Chunk *> r : debugRecords)
debugInfoSec->addChunk(r.second);
// Align and add each chunk referenced by the debug data directory.
for (std::pair<COFF::DebugType, Chunk *> r : debugRecords) {
r.second->setAlignment(4);
debugInfoSec->addChunk(r.second);
}
// Create SEH table. x86-only.