mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[obj2yaml] - Rename Group
to GroupSection
. NFC.
The `Group` class represents a group section and it is named inconsistently with other sections which all has the "Section" suffix. It is sometimes confusing, this patch addresses the issue. Differential revision: https://reviews.llvm.org/D88892
This commit is contained in:
parent
67f382cd89
commit
331305b3b2
@ -444,13 +444,13 @@ struct VerdefSection : Section {
|
|||||||
static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Verdef; }
|
static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Verdef; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Group : Section {
|
struct GroupSection : Section {
|
||||||
// Members of a group contain a flag and a list of section indices
|
// Members of a group contain a flag and a list of section indices
|
||||||
// that are part of the group.
|
// that are part of the group.
|
||||||
std::vector<SectionOrType> Members;
|
std::vector<SectionOrType> Members;
|
||||||
Optional<StringRef> Signature; /* Info */
|
Optional<StringRef> Signature; /* Info */
|
||||||
|
|
||||||
Group() : Section(ChunkKind::Group) {}
|
GroupSection() : Section(ChunkKind::Group) {}
|
||||||
|
|
||||||
static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Group; }
|
static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Group; }
|
||||||
};
|
};
|
||||||
|
@ -245,7 +245,8 @@ template <class ELFT> class ELFState {
|
|||||||
void writeSectionContent(Elf_Shdr &SHeader,
|
void writeSectionContent(Elf_Shdr &SHeader,
|
||||||
const ELFYAML::RelrSection &Section,
|
const ELFYAML::RelrSection &Section,
|
||||||
ContiguousBlobAccumulator &CBA);
|
ContiguousBlobAccumulator &CBA);
|
||||||
void writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::Group &Group,
|
void writeSectionContent(Elf_Shdr &SHeader,
|
||||||
|
const ELFYAML::GroupSection &Group,
|
||||||
ContiguousBlobAccumulator &CBA);
|
ContiguousBlobAccumulator &CBA);
|
||||||
void writeSectionContent(Elf_Shdr &SHeader,
|
void writeSectionContent(Elf_Shdr &SHeader,
|
||||||
const ELFYAML::SymtabShndxSection &Shndx,
|
const ELFYAML::SymtabShndxSection &Shndx,
|
||||||
@ -697,7 +698,7 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders,
|
|||||||
writeSectionContent(SHeader, *S, CBA);
|
writeSectionContent(SHeader, *S, CBA);
|
||||||
} else if (auto S = dyn_cast<ELFYAML::RelrSection>(Sec)) {
|
} else if (auto S = dyn_cast<ELFYAML::RelrSection>(Sec)) {
|
||||||
writeSectionContent(SHeader, *S, CBA);
|
writeSectionContent(SHeader, *S, CBA);
|
||||||
} else if (auto S = dyn_cast<ELFYAML::Group>(Sec)) {
|
} else if (auto S = dyn_cast<ELFYAML::GroupSection>(Sec)) {
|
||||||
writeSectionContent(SHeader, *S, CBA);
|
writeSectionContent(SHeader, *S, CBA);
|
||||||
} else if (auto S = dyn_cast<ELFYAML::ARMIndexTableSection>(Sec)) {
|
} else if (auto S = dyn_cast<ELFYAML::ARMIndexTableSection>(Sec)) {
|
||||||
writeSectionContent(SHeader, *S, CBA);
|
writeSectionContent(SHeader, *S, CBA);
|
||||||
@ -1237,7 +1238,7 @@ void ELFState<ELFT>::writeSectionContent(
|
|||||||
|
|
||||||
template <class ELFT>
|
template <class ELFT>
|
||||||
void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader,
|
void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader,
|
||||||
const ELFYAML::Group &Section,
|
const ELFYAML::GroupSection &Section,
|
||||||
ContiguousBlobAccumulator &CBA) {
|
ContiguousBlobAccumulator &CBA) {
|
||||||
assert(Section.Type == llvm::ELF::SHT_GROUP &&
|
assert(Section.Type == llvm::ELF::SHT_GROUP &&
|
||||||
"Section type is not SHT_GROUP");
|
"Section type is not SHT_GROUP");
|
||||||
|
@ -1214,7 +1214,7 @@ static void sectionMapping(IO &IO, ELFYAML::RelrSection &Section) {
|
|||||||
IO.mapOptional("Content", Section.Content);
|
IO.mapOptional("Content", Section.Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void groupSectionMapping(IO &IO, ELFYAML::Group &Group) {
|
static void groupSectionMapping(IO &IO, ELFYAML::GroupSection &Group) {
|
||||||
commonSectionMapping(IO, Group);
|
commonSectionMapping(IO, Group);
|
||||||
IO.mapOptional("Info", Group.Signature);
|
IO.mapOptional("Info", Group.Signature);
|
||||||
IO.mapRequired("Members", Group.Members);
|
IO.mapRequired("Members", Group.Members);
|
||||||
@ -1353,8 +1353,8 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
|
|||||||
break;
|
break;
|
||||||
case ELF::SHT_GROUP:
|
case ELF::SHT_GROUP:
|
||||||
if (!IO.outputting())
|
if (!IO.outputting())
|
||||||
Section.reset(new ELFYAML::Group());
|
Section.reset(new ELFYAML::GroupSection());
|
||||||
groupSectionMapping(IO, *cast<ELFYAML::Group>(Section.get()));
|
groupSectionMapping(IO, *cast<ELFYAML::GroupSection>(Section.get()));
|
||||||
break;
|
break;
|
||||||
case ELF::SHT_NOBITS:
|
case ELF::SHT_NOBITS:
|
||||||
if (!IO.outputting())
|
if (!IO.outputting())
|
||||||
|
@ -94,7 +94,7 @@ class ELFDumper {
|
|||||||
Expected<ELFYAML::VerdefSection *> dumpVerdefSection(const Elf_Shdr *Shdr);
|
Expected<ELFYAML::VerdefSection *> dumpVerdefSection(const Elf_Shdr *Shdr);
|
||||||
Expected<ELFYAML::SymverSection *> dumpSymverSection(const Elf_Shdr *Shdr);
|
Expected<ELFYAML::SymverSection *> dumpSymverSection(const Elf_Shdr *Shdr);
|
||||||
Expected<ELFYAML::VerneedSection *> dumpVerneedSection(const Elf_Shdr *Shdr);
|
Expected<ELFYAML::VerneedSection *> dumpVerneedSection(const Elf_Shdr *Shdr);
|
||||||
Expected<ELFYAML::Group *> dumpGroup(const Elf_Shdr *Shdr);
|
Expected<ELFYAML::GroupSection *> dumpGroupSection(const Elf_Shdr *Shdr);
|
||||||
Expected<ELFYAML::ARMIndexTableSection *>
|
Expected<ELFYAML::ARMIndexTableSection *>
|
||||||
dumpARMIndexTableSection(const Elf_Shdr *Shdr);
|
dumpARMIndexTableSection(const Elf_Shdr *Shdr);
|
||||||
Expected<ELFYAML::MipsABIFlags *> dumpMipsABIFlags(const Elf_Shdr *Shdr);
|
Expected<ELFYAML::MipsABIFlags *> dumpMipsABIFlags(const Elf_Shdr *Shdr);
|
||||||
@ -480,7 +480,7 @@ ELFDumper<ELFT>::dumpSections() {
|
|||||||
case ELF::SHT_RELR:
|
case ELF::SHT_RELR:
|
||||||
return [this](const Elf_Shdr *S) { return dumpRelrSection(S); };
|
return [this](const Elf_Shdr *S) { return dumpRelrSection(S); };
|
||||||
case ELF::SHT_GROUP:
|
case ELF::SHT_GROUP:
|
||||||
return [this](const Elf_Shdr *S) { return dumpGroup(S); };
|
return [this](const Elf_Shdr *S) { return dumpGroupSection(S); };
|
||||||
case ELF::SHT_NOBITS:
|
case ELF::SHT_NOBITS:
|
||||||
return [this](const Elf_Shdr *S) { return dumpNoBitsSection(S); };
|
return [this](const Elf_Shdr *S) { return dumpNoBitsSection(S); };
|
||||||
case ELF::SHT_NOTE:
|
case ELF::SHT_NOTE:
|
||||||
@ -1323,8 +1323,9 @@ Expected<StringRef> ELFDumper<ELFT>::getSymbolName(uint32_t SymtabNdx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class ELFT>
|
template <class ELFT>
|
||||||
Expected<ELFYAML::Group *> ELFDumper<ELFT>::dumpGroup(const Elf_Shdr *Shdr) {
|
Expected<ELFYAML::GroupSection *>
|
||||||
auto S = std::make_unique<ELFYAML::Group>();
|
ELFDumper<ELFT>::dumpGroupSection(const Elf_Shdr *Shdr) {
|
||||||
|
auto S = std::make_unique<ELFYAML::GroupSection>();
|
||||||
if (Error E = dumpCommonSection(Shdr, *S))
|
if (Error E = dumpCommonSection(Shdr, *S))
|
||||||
return std::move(E);
|
return std::move(E);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user