summaryrefslogtreecommitdiff
path: root/elfcpp/elfcpp_file.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2006-11-29 17:56:40 +0000
committerIan Lance Taylor <iant@google.com>2006-11-29 17:56:40 +0000
commit6621421174ec61b2f817af75cb3f6c9fa260b820 (patch)
tree772c34b4557f8338c312a4a50b6c6a1b0bd30a7f /elfcpp/elfcpp_file.h
parent25b7e9b6b58a7987daf1a6686dfce3fda8160ac8 (diff)
downloadbinutils-redhat-6621421174ec61b2f817af75cb3f6c9fa260b820.tar.gz
Hash tables, dynamic section, i386 PLT, gold_assert.
Diffstat (limited to 'elfcpp/elfcpp_file.h')
-rw-r--r--elfcpp/elfcpp_file.h23
1 files changed, 23 insertions, 0 deletions
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<size>::Elf_WXword
+ section_flags(unsigned int shndx);
+
private:
// Shared constructor code.
void
@@ -250,6 +254,25 @@ Elf_file<size, big_endian, 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<int size, bool big_endian, typename File>
+typename Elf_types<size>::Elf_WXword
+Elf_file<size, big_endian, 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)