llvm.org GIT mirror llvm / 7450907
Split getStringTableForSymtab. For use in cases where we already have the section table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285903 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 3 years ago
1 changed file(s) with 15 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
7878
7979 ErrorOr getStringTable(const Elf_Shdr *Section) const;
8080 ErrorOr getStringTableForSymtab(const Elf_Shdr &Section) const;
81 ErrorOr getStringTableForSymtab(const Elf_Shdr &Section,
82 Elf_Shdr_Range Sections) const;
8183
8284 ErrorOr> getSHNDXTable(const Elf_Shdr &Section) const;
8385 ErrorOr> getSHNDXTable(const Elf_Shdr &Section,
455457 template
456458 ErrorOr
457459 ELFFile::getStringTableForSymtab(const Elf_Shdr &Sec) const {
460 auto SectionsOrErr = sections();
461 if (std::error_code EC = SectionsOrErr.getError())
462 return EC;
463 return getStringTableForSymtab(Sec, *SectionsOrErr);
464 }
465
466 template
467 ErrorOr
468 ELFFile::getStringTableForSymtab(const Elf_Shdr &Sec,
469 Elf_Shdr_Range Sections) const {
470
458471 if (Sec.sh_type != ELF::SHT_SYMTAB && Sec.sh_type != ELF::SHT_DYNSYM)
459472 return object_error::parse_failed;
460 ErrorOr SectionOrErr = getSection(Sec.sh_link);
473 ErrorOr SectionOrErr =
474 object::getSection(Sections, Sec.sh_link);
461475 if (std::error_code EC = SectionOrErr.getError())
462476 return EC;
463477 return getStringTable(*SectionOrErr);