[PATCH] D89919: [LLD] [COFF] Align Extended DLL Characteristics

Petr Penzin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 18:28:08 PDT 2020


penzn created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
penzn requested review of this revision.

Match Extended DLL Characteristics alignment produced MSVC linker. This is required for CETCOMPAT setting to work in presence of other debug directories (CodeView, for example), otherwise it would not be recognizer by the Windows loader.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89919

Files:
  lld/COFF/Writer.cpp


Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/COFF/Writer.cpp
@@ -949,7 +949,6 @@
   OutputSection *debugInfoSec = config->mingw ? buildidSec : rdataSec;
   if (config->debug || config->repro || config->cetCompat) {
     debugDirectory = make<DebugDirectoryChunk>(debugRecords, config->repro);
-    debugDirectory->setAlignment(4);
     debugInfoSec->addChunk(debugDirectory);
   }
 
@@ -966,6 +965,7 @@
     ExtendedDllCharacteristicsChunk *extendedDllChars =
         make<ExtendedDllCharacteristicsChunk>(
             IMAGE_DLL_CHARACTERISTICS_EX_CET_COMPAT);
+    extendedDllChars->setAlignment(4);
     debugRecords.push_back(
         {COFF::IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS, extendedDllChars});
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89919.299832.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201022/aee27922/attachment.bin>


More information about the llvm-commits mailing list