[PATCH] D93209: [libObject, llvm-readobj] - Reimplement `ELFFile<ELFT>::getEntry`.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 05:26:45 PST 2020


grimar added a comment.

In D93209#2454183 <https://reviews.llvm.org/D93209#2454183>, @jhenderson wrote:

> Does this change impact reading a dynamic symbol table for an object with no section header table? In such a case, the size is derived from the hash table, so I imagine it'll work the same, but ideally it should be tested.

Nope, this patch is unrelated to dynamic symbols. I am changing `getEntry(const Elf_Shdr &Section, uint32_t Entry)`, it accepts the `Elf_Shdr`.
We print dynamic relocations with the use of `DynRegionInfo::getAsArrayRef()` to get entries.

  template <class ELFT> void DumpStyle<ELFT>::printDynamicRelocationsHelper() {
    const bool IsMips64EL = this->Obj.isMips64EL();
    const DynRegionInfo &DynRelaRegion = this->dumper().getDynRelaRegion();
    if (DynRelaRegion.Size > 0) {
      printDynamicRelocHeader(ELF::SHT_RELA, "RELA", DynRelaRegion);
      for (const Elf_Rela &Rela : this->dumper().dyn_relas())
        printDynamicReloc(Relocation<ELFT>(Rela, IsMips64EL));
    }
  ...
  
  
  template <typename ELFT>
  typename ELFDumper<ELFT>::Elf_Rela_Range ELFDumper<ELFT>::dyn_relas() const {
    return DynRelaRegion.getAsArrayRef<Elf_Rela>();
  }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93209/new/

https://reviews.llvm.org/D93209



More information about the llvm-commits mailing list