summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML/ELFYAML.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ObjectYAML/ELFYAML.cpp')
-rw-r--r--llvm/lib/ObjectYAML/ELFYAML.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index c8de7a662fc..aa871af79b1 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1017,10 +1017,12 @@ static void commonSectionMapping(IO &IO, ELFYAML::Section &Section) {
// are producing YAML, because yaml2obj sets appropriate values for them
// automatically when they are not explicitly defined.
assert(!IO.outputting() ||
- (!Section.ShOffset.hasValue() && !Section.ShSize.hasValue()));
+ (!Section.ShOffset.hasValue() && !Section.ShSize.hasValue() &&
+ !Section.ShName.hasValue() && !Section.ShFlags.hasValue()));
IO.mapOptional("ShName", Section.ShName);
IO.mapOptional("ShOffset", Section.ShOffset);
IO.mapOptional("ShSize", Section.ShSize);
+ IO.mapOptional("ShFlags", Section.ShFlags);
}
static void sectionMapping(IO &IO, ELFYAML::DynamicSection &Section) {
@@ -1283,11 +1285,12 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
StringRef MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::validate(
IO &io, std::unique_ptr<ELFYAML::Chunk> &C) {
- if (const auto *RawSection =
- dyn_cast<ELFYAML::RawContentSection>(C.get())) {
+ if (const auto *RawSection = dyn_cast<ELFYAML::RawContentSection>(C.get())) {
if (RawSection->Size && RawSection->Content &&
(uint64_t)(*RawSection->Size) < RawSection->Content->binary_size())
return "Section size must be greater than or equal to the content size";
+ if (RawSection->Flags && RawSection->ShFlags)
+ return "ShFlags and Flags cannot be used together";
return {};
}
OpenPOWER on IntegriCloud