[PATCH] D89921: [LLD] [COFF] Align all debug directories

Petr Penzin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 20:23:30 PDT 2020


penzn updated this revision to Diff 300156.
penzn added a comment.

Fix broken diff.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89921/new/

https://reviews.llvm.org/D89921

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);
   }
 
@@ -971,8 +970,12 @@
   }
 
   if (debugRecords.size() > 0) {
-    for (std::pair<COFF::DebugType, Chunk *> r : debugRecords)
+    for (std::pair<COFF::DebugType, Chunk *> r : debugRecords) {
+      // Ensure that every debug directory is aligned on 4 bytes
+      if (r.second->getAlignment() < 4)
+        r.second->setAlignment(4);
       debugInfoSec->addChunk(r.second);
+    }
   }
 
   // Create SEH table. x86-only.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89921.300156.patch
Type: text/x-patch
Size: 889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201023/13c4b09a/attachment.bin>


More information about the llvm-commits mailing list