From f2f3f783381d38edadb126e8d9f79a7dc4a8847f Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 9 Nov 2007 23:18:16 +0000 Subject: [PATCH] From Craig Silverstein: Implement section_info. --- elfcpp/elfcpp_file.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/elfcpp/elfcpp_file.h b/elfcpp/elfcpp_file.h index 7462bb85368..3228332b835 100644 --- a/elfcpp/elfcpp_file.h +++ b/elfcpp/elfcpp_file.h @@ -143,6 +143,11 @@ class Elf_file Elf_Word section_link(unsigned int shndx); + // Return the info field of section SHNDX. + Elf_Word + section_info(unsigned int shndx); + + private: // Shared constructor code. void @@ -348,6 +353,25 @@ Elf_file::section_link(unsigned int shndx) return shdr.get_sh_link(); } +// Return the sh_info field of section SHNDX. + +template +Elf_Word +Elf_file::section_info(unsigned int shndx) +{ + File* const file = this->file_; + + if (shndx >= this->shnum()) + file->error(_("section_info: bad shndx %u >= %u"), + shndx, this->shnum()); + + typename File::View v(file->view(this->section_header_offset(shndx), + This::shdr_size)); + + Ef_shdr shdr(v.data()); + return shdr.get_sh_info(); +} + } // End namespace elfcpp. #endif // !defined(ELFCPP_FILE_H) -- 2.30.2