aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/ObjectYAML/COFFYAML.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/ObjectYAML/COFFYAML.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/ObjectYAML/COFFYAML.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/ObjectYAML/COFFYAML.cpp b/contrib/llvm-project/llvm/lib/ObjectYAML/COFFYAML.cpp
index 3fe2ea5af08f..cd1db24f0d5d 100644
--- a/contrib/llvm-project/llvm/lib/ObjectYAML/COFFYAML.cpp
+++ b/contrib/llvm-project/llvm/lib/ObjectYAML/COFFYAML.cpp
@@ -689,11 +689,12 @@ void MappingTraits<COFFYAML::Section>::mapping(IO &IO, COFFYAML::Section &Sec) {
return;
}
- // Uninitialized sections, such as .bss, typically have no data, but the size
- // is carried in SizeOfRawData, even though PointerToRawData is zero.
- if (Sec.SectionData.binary_size() == 0 && Sec.StructuredData.empty() &&
- NC->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)
- IO.mapOptional("SizeOfRawData", Sec.Header.SizeOfRawData);
+ IO.mapOptional("SizeOfRawData", Sec.Header.SizeOfRawData, 0U);
+
+ if (!Sec.StructuredData.empty() && Sec.Header.SizeOfRawData) {
+ IO.setError("StructuredData and SizeOfRawData can't be used together");
+ return;
+ }
IO.mapOptional("Relocations", Sec.Relocations);
}