diff --git a/llvm/lib/ObjectYAML/COFFYAML.cpp b/llvm/lib/ObjectYAML/COFFYAML.cpp index 5a85e22e4f49..6e5cdce89060 100644 --- a/llvm/lib/ObjectYAML/COFFYAML.cpp +++ b/llvm/lib/ObjectYAML/COFFYAML.cpp @@ -448,24 +448,24 @@ void MappingTraits::mapping(IO &IO, MappingNormalization NDC( IO, PH.Header.DLLCharacteristics); - IO.mapRequired("AddressOfEntryPoint", PH.Header.AddressOfEntryPoint); - IO.mapRequired("ImageBase", PH.Header.ImageBase); - IO.mapRequired("SectionAlignment", PH.Header.SectionAlignment); - IO.mapRequired("FileAlignment", PH.Header.FileAlignment); - IO.mapRequired("MajorOperatingSystemVersion", + IO.mapOptional("AddressOfEntryPoint", PH.Header.AddressOfEntryPoint); + IO.mapOptional("ImageBase", PH.Header.ImageBase); + IO.mapOptional("SectionAlignment", PH.Header.SectionAlignment, 1); + IO.mapOptional("FileAlignment", PH.Header.FileAlignment, 1); + IO.mapOptional("MajorOperatingSystemVersion", PH.Header.MajorOperatingSystemVersion); - IO.mapRequired("MinorOperatingSystemVersion", + IO.mapOptional("MinorOperatingSystemVersion", PH.Header.MinorOperatingSystemVersion); - IO.mapRequired("MajorImageVersion", PH.Header.MajorImageVersion); - IO.mapRequired("MinorImageVersion", PH.Header.MinorImageVersion); - IO.mapRequired("MajorSubsystemVersion", PH.Header.MajorSubsystemVersion); - IO.mapRequired("MinorSubsystemVersion", PH.Header.MinorSubsystemVersion); - IO.mapRequired("Subsystem", NWS->Subsystem); - IO.mapRequired("DLLCharacteristics", NDC->Characteristics); - IO.mapRequired("SizeOfStackReserve", PH.Header.SizeOfStackReserve); - IO.mapRequired("SizeOfStackCommit", PH.Header.SizeOfStackCommit); - IO.mapRequired("SizeOfHeapReserve", PH.Header.SizeOfHeapReserve); - IO.mapRequired("SizeOfHeapCommit", PH.Header.SizeOfHeapCommit); + IO.mapOptional("MajorImageVersion", PH.Header.MajorImageVersion); + IO.mapOptional("MinorImageVersion", PH.Header.MinorImageVersion); + IO.mapOptional("MajorSubsystemVersion", PH.Header.MajorSubsystemVersion); + IO.mapOptional("MinorSubsystemVersion", PH.Header.MinorSubsystemVersion); + IO.mapOptional("Subsystem", NWS->Subsystem); + IO.mapOptional("DLLCharacteristics", NDC->Characteristics); + IO.mapOptional("SizeOfStackReserve", PH.Header.SizeOfStackReserve); + IO.mapOptional("SizeOfStackCommit", PH.Header.SizeOfStackCommit); + IO.mapOptional("SizeOfHeapReserve", PH.Header.SizeOfHeapReserve); + IO.mapOptional("SizeOfHeapCommit", PH.Header.SizeOfHeapCommit); IO.mapOptional("NumberOfRvaAndSize", PH.Header.NumberOfRvaAndSize, COFF::NUM_DATA_DIRECTORIES + 1);