summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-02-12 09:08:59 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-02-12 09:08:59 +0000
commitb87ea73706257147b9af5a4a693ff22071c22fe9 (patch)
tree999cd2ff8c7f7b15657e695169a0fb99ac9f3979 /llvm/lib/ObjectYAML
parentbe4c0ff00a61d89b2801bac45c74c9877aa83beb (diff)
downloadbcm5719-llvm-b87ea73706257147b9af5a4a693ff22071c22fe9.tar.gz
bcm5719-llvm-b87ea73706257147b9af5a4a693ff22071c22fe9.zip
[yaml2obj/obj2yaml] - Move `Info` field out from `Section` class.
ELFYAML.h contains a `Section` class which is a base for a few other sections classes that are used for mapping different section types. `Section` has a `StringRef Info` field used for storing sh_info. At the same time, sh_info has very different meanings for sections and cannot be processed in a similar way generally, for example ELFDumper does not handle it in `dumpCommonSection` but do that in `dumpGroup` and `dumpCommonRelocationSection` respectively. At this moment, we have and handle it as a string, because that was possible for the current use case. But also it can simply be a number: For SHT_GNU_verdef is "The number of version definitions within the section." The patch moves `Info` field out to be able to have it as a number. With that change, each class will be able to decide what type and purpose of the sh_info field it wants to use. I also had to edit 2 test cases. This is because patch fixes a bug. Previously we accepted yaml files with Info fields for all sections (for example, for SHT_DYNSYM too). But we do not handle it and the resulting objects had zero sh_info fields set for such sections. Now it is accepted only for sections that supports it. Differential revision: https://reviews.llvm.org/D58054 llvm-svn: 353810
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/ELFYAML.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 339f080337a..cec56771e1d 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -854,7 +854,6 @@ 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);
- IO.mapOptional("Info", Section.Info, StringRef());
}
static void sectionMapping(IO &IO, ELFYAML::DynamicSection &Section) {
@@ -875,12 +874,14 @@ static void sectionMapping(IO &IO, ELFYAML::NoBitsSection &Section) {
static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) {
commonSectionMapping(IO, Section);
+ IO.mapOptional("Info", Section.RelocatableSec, StringRef());
IO.mapOptional("Relocations", Section.Relocations);
}
-static void groupSectionMapping(IO &IO, ELFYAML::Group &group) {
- commonSectionMapping(IO, group);
- IO.mapRequired("Members", group.Members);
+static void groupSectionMapping(IO &IO, ELFYAML::Group &Group) {
+ commonSectionMapping(IO, Group);
+ IO.mapOptional("Info", Group.Signature, StringRef());
+ IO.mapRequired("Members", Group.Members);
}
void MappingTraits<ELFYAML::SectionOrType>::mapping(
OpenPOWER on IntegriCloud