diff options
author | George Rimar <grimar@accesssoftek.com> | 2019-07-02 10:20:12 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2019-07-02 10:20:12 +0000 |
commit | 9df825f4297ff1cd716c8b5fc838166c99d3ee8c (patch) | |
tree | aff7c72e7e6dfeef72a62e2e3e4761c3baed6466 /llvm/lib/ObjectYAML | |
parent | 7928fea4a75da7e48d13e5b165a3388b9667df25 (diff) | |
download | bcm5719-llvm-9df825f4297ff1cd716c8b5fc838166c99d3ee8c.tar.gz bcm5719-llvm-9df825f4297ff1cd716c8b5fc838166c99d3ee8c.zip |
[yaml2obj] - Allow overriding sh_offset field from the YAML.
Some of our test cases are using objects which
has sections with a broken sh_offset field.
There was no way to set it from YAML until this patch.
Differential revision: https://reviews.llvm.org/D63879
llvm-svn: 364898
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r-- | llvm/lib/ObjectYAML/ELFYAML.cpp | 6 |
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) { |