aboutsummaryrefslogtreecommitdiff
path: root/elfcpp/elfcpp_file.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-02-07 01:51:25 +0000
committerIan Lance Taylor <iant@google.com>2008-02-07 01:51:25 +0000
commit88dd47ac00ee5a932bca9abbd2245c429dfd8f5b (patch)
tree494b3493adc0f1449c5a33f48002692a9e74ab17 /elfcpp/elfcpp_file.h
parent2e444beaa07a2428b6409225840ce12d437d7805 (diff)
downloadgdb-88dd47ac00ee5a932bca9abbd2245c429dfd8f5b.zip
gdb-88dd47ac00ee5a932bca9abbd2245c429dfd8f5b.tar.gz
gdb-88dd47ac00ee5a932bca9abbd2245c429dfd8f5b.tar.bz2
Implement --just-symbols, including -R FILE. Fix symbol values when
doing a relocatable link.
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 f9f28ef..431f8ef 100644
--- a/elfcpp/elfcpp_file.h
+++ b/elfcpp/elfcpp_file.h
@@ -139,6 +139,10 @@ class Elf_file
typename Elf_types<size>::Elf_WXword
section_flags(unsigned int shndx);
+ // Return the address of section SHNDX.
+ typename Elf_types<size>::Elf_Addr
+ section_addr(unsigned int shndx);
+
// Return the type of section SHNDX.
Elf_Word
section_type(unsigned int shndx);
@@ -341,6 +345,25 @@ Elf_file<size, big_endian, File>::section_flags(unsigned int shndx)
return shdr.get_sh_flags();
}
+// Return the address of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+typename Elf_types<size>::Elf_Addr
+Elf_file<size, big_endian, File>::section_addr(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_addr();
+}
+
// Return the type of section SHNDX.
template<int size, bool big_endian, typename File>