diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp --- a/lld/COFF/Writer.cpp +++ b/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); }