[PATCH] D39891: [LLD] [COFF] Always include the size of the string table size field

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 01:57:50 PST 2017


mstorsjo created this revision.

Even if we don't actually write any string table contents, the 4 byte size for the string table will always be written. Make sure we accommodate for this in the file size. Since this size is aligned up, this would seldom be an issue in practice.


https://reviews.llvm.org/D39891

Files:
  COFF/Writer.cpp


Index: COFF/Writer.cpp
===================================================================
--- COFF/Writer.cpp
+++ COFF/Writer.cpp
@@ -563,8 +563,7 @@
     PointerToSymbolTable = FileOff;
     FileOff += OutputSymtab.size() * sizeof(coff_symbol16);
   }
-  if (!Strtab.empty())
-    FileOff += Strtab.size() + 4;
+  FileOff += Strtab.size() + 4;
   FileSize = alignTo(FileOff, SectorSize);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39891.122405.patch
Type: text/x-patch
Size: 395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171110/09514aae/attachment.bin>


More information about the llvm-commits mailing list