aboutsummaryrefslogtreecommitdiff
path: root/elfcpp
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2006-11-16 00:38:25 +0000
committerIan Lance Taylor <iant@google.com>2006-11-16 00:38:25 +0000
commitc06b7b0ba3f6aaa4a3f9586689ef8bfdbd17454e (patch)
tree732f3a1719d66e1fd993872ecd58ca282d2858f8 /elfcpp
parent7495b3afc0d28e2d64995f383e2436a35aa14e6d (diff)
downloadgdb-c06b7b0ba3f6aaa4a3f9586689ef8bfdbd17454e.zip
gdb-c06b7b0ba3f6aaa4a3f9586689ef8bfdbd17454e.tar.gz
gdb-c06b7b0ba3f6aaa4a3f9586689ef8bfdbd17454e.tar.bz2
Snapshot. Includes first cut at output relocation sections.
Diffstat (limited to 'elfcpp')
-rw-r--r--elfcpp/elfcpp.h52
1 files changed, 51 insertions, 1 deletions
diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h
index e106fab..afbd74d 100644
--- a/elfcpp/elfcpp.h
+++ b/elfcpp/elfcpp.h
@@ -1163,7 +1163,7 @@ class Sym_write
internal::Sym_data<size>* p_;
};
-// Accessor classes for Elf relocation table entries.
+// Accessor classes for an ELF REL relocation entry.
template<int size, bool big_endian>
class Rel
@@ -1191,6 +1191,30 @@ class Rel
const internal::Rel_data<size>* p_;
};
+// Writer class for an ELF Rel relocation.
+
+template<int size, bool big_endian>
+class Rel_write
+{
+ public:
+ Rel_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Rel_data<size>*>(p))
+ { }
+
+ void
+ put_r_offset(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->r_offset = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_r_info(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->r_info = Convert<size, big_endian>::convert_host(v); }
+
+ private:
+ internal::Rel_data<size>* p_;
+};
+
+// Accessor class for an ELF Rela relocation.
+
template<int size, bool big_endian>
class Rela
{
@@ -1221,6 +1245,32 @@ class Rela
const internal::Rela_data<size>* p_;
};
+// Writer class for an ELF Rela relocation.
+
+template<int size, bool big_endian>
+class Rela_write
+{
+ public:
+ Rela_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Rela_data<size>*>(p))
+ { }
+
+ void
+ put_r_offset(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->r_offset = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_r_info(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->r_info = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_r_addend(typename Elf_types<size>::Elf_Swxword v)
+ { this->p_->r_addend = Convert<size, big_endian>::convert_host(v); }
+
+ private:
+ internal::Rela_data<size>* p_;
+};
+
// Accessor classes for entries in the ELF SHT_DYNAMIC section aka
// PT_DYNAMIC segment.