diff options
| author | Georgii Rymar <grimar@accesssoftek.com> | 2020-01-15 14:16:03 +0300 |
|---|---|---|
| committer | Georgii Rymar <grimar@accesssoftek.com> | 2020-01-15 14:19:00 +0300 |
| commit | ca6f616532780b236556fc129cda3243d31cb01a (patch) | |
| tree | a93395095b2c375f8804a8eb002ca2d555ae67cf /llvm/lib/ObjectYAML | |
| parent | 884a65af5ceebce76519749ed6eb9a86d0596771 (diff) | |
| download | bcm5719-llvm-ca6f616532780b236556fc129cda3243d31cb01a.tar.gz bcm5719-llvm-ca6f616532780b236556fc129cda3243d31cb01a.zip | |
Revert "[yaml2obj/obj2yaml] - Add support for SHT_RELR sections."
This reverts commit 46d11e30ee807accefd14e0b7f306647963a39b5.
It broke bots. E.g. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/60744
Diffstat (limited to 'llvm/lib/ObjectYAML')
| -rw-r--r-- | llvm/lib/ObjectYAML/ELFEmitter.cpp | 37 | ||||
| -rw-r--r-- | llvm/lib/ObjectYAML/ELFYAML.cpp | 17 |
2 files changed, 7 insertions, 47 deletions
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp index e7f82986ca1..69f5510fc7f 100644 --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -110,7 +110,6 @@ template <class ELFT> class ELFState { typedef typename ELFT::Rela Elf_Rela; typedef typename ELFT::Relr Elf_Relr; typedef typename ELFT::Dyn Elf_Dyn; - typedef typename ELFT::uint uintX_t; enum class SymtabType { Static, Dynamic }; @@ -166,9 +165,6 @@ template <class ELFT> class ELFState { void writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::RelocationSection &Section, ContiguousBlobAccumulator &CBA); - void writeSectionContent(Elf_Shdr &SHeader, - const ELFYAML::RelrSection &Section, - ContiguousBlobAccumulator &CBA); void writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::Group &Group, ContiguousBlobAccumulator &CBA); void writeSectionContent(Elf_Shdr &SHeader, @@ -458,8 +454,6 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders, writeSectionContent(SHeader, *S, CBA); } else if (auto S = dyn_cast<ELFYAML::RelocationSection>(Sec)) { writeSectionContent(SHeader, *S, CBA); - } else if (auto S = dyn_cast<ELFYAML::RelrSection>(Sec)) { - writeSectionContent(SHeader, *S, CBA); } else if (auto S = dyn_cast<ELFYAML::Group>(Sec)) { writeSectionContent(SHeader, *S, CBA); } else if (auto S = dyn_cast<ELFYAML::MipsABIFlags>(Sec)) { @@ -776,6 +770,10 @@ void ELFState<ELFT>::writeSectionContent( if (Section.EntSize) SHeader.sh_entsize = *Section.EntSize; + else if (Section.Type == llvm::ELF::SHT_RELR) + SHeader.sh_entsize = sizeof(Elf_Relr); + else + SHeader.sh_entsize = 0; if (Section.Info) SHeader.sh_info = *Section.Info; @@ -830,30 +828,6 @@ void ELFState<ELFT>::writeSectionContent( } template <class ELFT> -void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader, - const ELFYAML::RelrSection &Section, - ContiguousBlobAccumulator &CBA) { - raw_ostream &OS = - CBA.getOSAndAlignedOffset(SHeader.sh_offset, SHeader.sh_addralign); - SHeader.sh_entsize = - Section.EntSize ? uint64_t(*Section.EntSize) : sizeof(Elf_Relr); - - if (Section.Content) { - SHeader.sh_size = writeContent(OS, Section.Content, None); - return; - } - - for (llvm::yaml::Hex64 E : *Section.Entries) { - if (!ELFT::Is64Bits && E > UINT32_MAX) - reportError(Section.Name + ": the value is too large for 32-bits: 0x" + - Twine::utohexstr(E)); - support::endian::write<uintX_t>(OS, E, ELFT::TargetEndianness); - } - - SHeader.sh_size = sizeof(uintX_t) * Section.Entries->size(); -} - -template <class ELFT> void ELFState<ELFT>::writeSectionContent( Elf_Shdr &SHeader, const ELFYAML::SymtabShndxSection &Shndx, ContiguousBlobAccumulator &CBA) { @@ -915,6 +889,7 @@ template <class ELFT> void ELFState<ELFT>::writeSectionContent( Elf_Shdr &SHeader, const ELFYAML::StackSizesSection &Section, ContiguousBlobAccumulator &CBA) { + using uintX_t = typename ELFT::uint; raw_ostream &OS = CBA.getOSAndAlignedOffset(SHeader.sh_offset, SHeader.sh_addralign); @@ -1140,6 +1115,8 @@ template <class ELFT> void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::DynamicSection &Section, ContiguousBlobAccumulator &CBA) { + typedef typename ELFT::uint uintX_t; + assert(Section.Type == llvm::ELF::SHT_DYNAMIC && "Section type is not SHT_DYNAMIC"); diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp index efa7ecb4728..21ae85022c2 100644 --- a/llvm/lib/ObjectYAML/ELFYAML.cpp +++ b/llvm/lib/ObjectYAML/ELFYAML.cpp @@ -1101,12 +1101,6 @@ static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) { IO.mapOptional("Relocations", Section.Relocations); } -static void sectionMapping(IO &IO, ELFYAML::RelrSection &Section) { - commonSectionMapping(IO, Section); - IO.mapOptional("Entries", Section.Entries); - IO.mapOptional("Content", Section.Content); -} - static void groupSectionMapping(IO &IO, ELFYAML::Group &Group) { commonSectionMapping(IO, Group); IO.mapOptional("Info", Group.Signature); @@ -1206,11 +1200,6 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping( Section.reset(new ELFYAML::RelocationSection()); sectionMapping(IO, *cast<ELFYAML::RelocationSection>(Section.get())); break; - case ELF::SHT_RELR: - if (!IO.outputting()) - Section.reset(new ELFYAML::RelrSection()); - sectionMapping(IO, *cast<ELFYAML::RelrSection>(Section.get())); - break; case ELF::SHT_GROUP: if (!IO.outputting()) Section.reset(new ELFYAML::Group()); @@ -1452,12 +1441,6 @@ StringRef MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::validate( return {}; } - if (const auto *RS = dyn_cast<ELFYAML::RelrSection>(C.get())) { - if (RS->Entries && RS->Content) - return "\"Entries\" and \"Content\" can't be used together"; - return {}; - } - return {}; } |

