diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 1fddf40f5b22..f3afb1c34562 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -857,8 +857,8 @@ template void BinaryFile::parse() { StringRef EndName = Saver.save(Twine(Filename) + "_end"); StringRef SizeName = Saver.save(Twine(Filename) + "_size"); - auto *Section = - make>(SHF_ALLOC, SHT_PROGBITS, 8, Data, ".data"); + auto *Section = make>(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS, + 8, Data, ".data"); Sections.push_back(Section); elf::Symtab::X->addRegular(StartName, STV_DEFAULT, STT_OBJECT, 0, 0, diff --git a/lld/test/ELF/format-binary.test b/lld/test/ELF/format-binary.test index 586f5f963dfa..94b9b51afe78 100644 --- a/lld/test/ELF/format-binary.test +++ b/lld/test/ELF/format-binary.test @@ -15,6 +15,7 @@ # CHECK-NEXT: Type: SHT_PROGBITS # CHECK-NEXT: Flags [ # CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_WRITE # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 # CHECK-NEXT: Offset: