diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2015-07-03 23:00:54 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2015-07-03 23:00:54 +0000 |
commit | 5db02769257a76eec6eccc3dc6336b0962cfda2f (patch) | |
tree | 4b48a2d95c7d8a65aa19feb5753519fcb8adf57f /llvm/lib/Object/ELFYAML.cpp | |
parent | da2f094bbba0e18e856bcc5449b3d2d77efd3e2a (diff) | |
download | bcm5719-llvm-5db02769257a76eec6eccc3dc6336b0962cfda2f.tar.gz bcm5719-llvm-5db02769257a76eec6eccc3dc6336b0962cfda2f.zip |
[ELFYAML] Fix handling SHT_NOBITS sections by obj2yaml/yaml2obj tools
SHT_NOBITS sections do not have content in an object file. Now the yaml2obj
tool does not accept `Content` field for such sections, and the obj2yaml
tool does not attempt to read the section content from a file.
Restore r241350 and r241352.
llvm-svn: 241377
Diffstat (limited to 'llvm/lib/Object/ELFYAML.cpp')
-rw-r--r-- | llvm/lib/Object/ELFYAML.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Object/ELFYAML.cpp b/llvm/lib/Object/ELFYAML.cpp index ecdd468305b..72c232c3287 100644 --- a/llvm/lib/Object/ELFYAML.cpp +++ b/llvm/lib/Object/ELFYAML.cpp @@ -627,6 +627,11 @@ static void sectionMapping(IO &IO, ELFYAML::RawContentSection &Section) { IO.mapOptional("Size", Section.Size, Hex64(Section.Content.binary_size())); } +static void sectionMapping(IO &IO, ELFYAML::NoBitsSection &Section) { + commonSectionMapping(IO, Section); + IO.mapOptional("Size", Section.Size, Hex64(0)); +} + static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) { commonSectionMapping(IO, Section); IO.mapOptional("Relocations", Section.Relocations); @@ -682,6 +687,11 @@ void MappingTraits<std::unique_ptr<ELFYAML::Section>>::mapping( Section.reset(new ELFYAML::Group()); groupSectionMapping(IO, *cast<ELFYAML::Group>(Section.get())); break; + case ELF::SHT_NOBITS: + if (!IO.outputting()) + Section.reset(new ELFYAML::NoBitsSection()); + sectionMapping(IO, *cast<ELFYAML::NoBitsSection>(Section.get())); + break; case ELF::SHT_MIPS_ABIFLAGS: if (!IO.outputting()) Section.reset(new ELFYAML::MipsABIFlags()); |