[PATCH] PECOFF: Use the string table for long section names in EXEs/DLLs

Rui Ueyama ruiu at google.com
Mon Nov 3 16:37:21 PST 2014


LGTM with a few nits

================
Comment at: lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:203
@@ +202,3 @@
+    std::memcpy(buffer, _stringTable.data(), _stringTable.size());
+  }
+
----------------
Add blank lines between no one-liner methods.

================
Comment at: lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:793
@@ -755,4 +792,3 @@
 
-  // Section name must be equal to or less than 8 characters in the
-  // executable. Longer names will be truncated.
   StringRef sectionName = chunk->getSectionName();
+  if (uint32_t stringTableOffset = chunk->getStringTableOffset()) {
----------------
Please add a comment saying that we support long section name even in an executable, which is a GNU extension to PE/COFF. Also note that dumpbin cannot handle that at this moment.

================
Comment at: lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:797
@@ +796,3 @@
+  } else {
+    std::memset(header.Name, 0, llvm::COFF::NameSize);
+    std::strncpy(header.Name, sectionName.data(), sectionName.size());
----------------
Move this line before the previous if. I think we need to zero-pad after "/%u".

http://reviews.llvm.org/D6104






More information about the llvm-commits mailing list