[llvm] [llvm-readobj][COFF] Dump .modmeta section (PR #201695)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 01:04:22 PDT 2026


================
@@ -30,17 +30,25 @@ Expected<uint32_t> COFFCxxModuleMetadataReader::readModuleID() {
   switch (ModuleIndexWidth) {
   case 1: {
     uint8_t V = static_cast<uint8_t>(ModuleData[0]);
-    if (V != std::numeric_limits<uint8_t>::max())
+    // Extend the end sentinel to 32 bit, so it's the same regardless of module
+    // width.
+    if (V == std::numeric_limits<uint8_t>::max())
+      ID = std::numeric_limits<uint32_t>::max();
+    else
       ID = V;
   } break;
   case 2: {
     uint16_t V =
         support::endian::read<uint16_t>(ModuleData.data(), endianness::little);
-    if (V != std::numeric_limits<uint16_t>::max())
+    // Extend the end sentinel to 32 bit.
+    if (V == std::numeric_limits<uint16_t>::max())
+      ID = std::numeric_limits<uint32_t>::max();
+    else
       ID = V;
   } break;
   case 4: {
     ID = support::endian::read<uint32_t>(ModuleData.data(), endianness::little);
+    // No need to extend, it's already 32 bit.
----------------
jh7370 wrote:

You need to give context as to what this is on about, e.g. "No need to extend sentinel, as it's already 32 bit."

https://github.com/llvm/llvm-project/pull/201695


More information about the llvm-commits mailing list