summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/ELFYAML.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 49161623cd7..46c96f96778 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -911,6 +911,12 @@ static void commonSectionMapping(IO &IO, ELFYAML::Section &Section) {
IO.mapOptional("Link", Section.Link, StringRef());
IO.mapOptional("AddressAlign", Section.AddressAlign, Hex64(0));
IO.mapOptional("EntSize", Section.EntSize);
+
+ // obj2yaml does not dump this field. It is expected to be empty when we are
+ // producing YAML, because yaml2obj sets an appropriate value for sh_offset
+ // automatically when it is not explicitly defined.
+ assert(!IO.outputting() || !Section.ShOffset.hasValue());
+ IO.mapOptional("ShOffset", Section.ShOffset);
}
static void sectionMapping(IO &IO, ELFYAML::DynamicSection &Section) {
OpenPOWER on IntegriCloud