[PATCH] D116474: [lld] [coff] Fix the characteristics of some sections like ".voltbl".

gmh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 1 07:50:59 PST 2022


gmh5225 updated this revision to Diff 396861.
gmh5225 added a comment.

clang-foramt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116474

Files:
  lld/COFF/Writer.cpp


Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/COFF/Writer.cpp
@@ -1500,6 +1500,12 @@
 
   // Write section table
   for (OutputSection *sec : ctx.outputSections) {
+    // Fix the characteristics of some sections like ".voltbl".
+    // Or the program will be crash sometimes.
+    if (sec->header.Characteristics == 0 && sec->name.contains(".voltbl")) {
+      sec->header.Characteristics |= IMAGE_SCN_CNT_INITIALIZED_DATA |
+                                     IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE;
+    }
     sec->writeHeaderTo(buf);
     buf += sizeof(coff_section);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116474.396861.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220101/0bd10f4c/attachment.bin>


More information about the llvm-commits mailing list