From 6621421174ec61b2f817af75cb3f6c9fa260b820 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 29 Nov 2006 17:56:40 +0000 Subject: Hash tables, dynamic section, i386 PLT, gold_assert. --- elfcpp/elfcpp_file.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'elfcpp/elfcpp_file.h') diff --git a/elfcpp/elfcpp_file.h b/elfcpp/elfcpp_file.h index 043c269014..c9563eeed7 100644 --- a/elfcpp/elfcpp_file.h +++ b/elfcpp/elfcpp_file.h @@ -102,6 +102,10 @@ class Elf_file typename File::Location section_contents(unsigned int shndx); + // Return the flags of section SHNDX. + typename Elf_types::Elf_WXword + section_flags(unsigned int shndx); + private: // Shared constructor code. void @@ -250,6 +254,25 @@ Elf_file::section_contents(unsigned int shndx) return typename File::Location(shdr.get_sh_offset(), shdr.get_sh_size()); } +// Return the section flags of section SHNDX. + +template +typename Elf_types::Elf_WXword +Elf_file::section_flags(unsigned int shndx) +{ + File* const file = this->file_; + + if (shndx >= this->shnum()) + file->error(_("section_flags: 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_flags(); +} + } // End namespace elfcpp. #endif // !defined(ELFCPP_FILE_H) -- cgit v1.2.1