summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2015-07-03 14:07:06 +0000
committerSimon Atanasyan <simon@atanasyan.com>2015-07-03 14:07:06 +0000
commitb776eaed2e604d1b16041178ded4e74ab83a3555 (patch)
treeb4f24290b9698669f69572ad855fa62ebe62ef39 /llvm/lib/Object
parent3b25b479bf8156ad340bec1e7ee287791bda240e (diff)
downloadbcm5719-llvm-b776eaed2e604d1b16041178ded4e74ab83a3555.tar.gz
bcm5719-llvm-b776eaed2e604d1b16041178ded4e74ab83a3555.zip
[ELFYAML] Fix handling SHT_NOBITS sections by obj2yaml/yaml2obj tools
SHT_NOBITS sections do not have content in an object file. Now yaml2obj tool does not accept `Content` field for such sections, and obj2yaml tool does not attempt to read the section content from a file. llvm-svn: 241350
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/ELFYAML.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Object/ELFYAML.cpp b/llvm/lib/Object/ELFYAML.cpp
index ecdd468305b..56eb374af23 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.mapRequired("Size", Section.Size);
+}
+
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());
OpenPOWER on IntegriCloud