diff options
author | Ian Lance Taylor <iant@google.com> | 2006-11-16 00:38:25 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2006-11-16 00:38:25 +0000 |
commit | 0468de001cf096f21419373d7577b58d9b5977e0 (patch) | |
tree | 2ef13984d4c121ba39f97cb72b79eb77e00a338a /elfcpp | |
parent | 6580ee5353cd78f4b7e8bc7fe1c84fc3b622300e (diff) | |
download | binutils-redhat-0468de001cf096f21419373d7577b58d9b5977e0.tar.gz |
Snapshot. Includes first cut at output relocation sections.
Diffstat (limited to 'elfcpp')
-rw-r--r-- | elfcpp/elfcpp.h | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h index e106fabbb1..afbd74d075 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. |