[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241350 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Atanasyan
2015-07-03 14:07:06 +00:00
parent 68a8b9f792
commit c97046c6e6
6 changed files with 50 additions and 4 deletions

View File

@@ -85,7 +85,13 @@ struct SectionOrType {
};
struct Section {
enum class SectionKind { Group, RawContent, Relocation, MipsABIFlags };
enum class SectionKind {
Group,
RawContent,
Relocation,
NoBits,
MipsABIFlags
};
SectionKind Kind;
StringRef Name;
ELF_SHT Type;
@@ -106,6 +112,14 @@ struct RawContentSection : Section {
}
};
struct NoBitsSection : Section {
llvm::yaml::Hex64 Size;
NoBitsSection() : Section(SectionKind::NoBits) {}
static bool classof(const Section *S) {
return S->Kind == SectionKind::NoBits;
}
};
struct Group : Section {
// Members of a group contain a flag and a list of section indices
// that are part of the group.