X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=elfcpp%2Felfcpp.h;h=305487f8bf03fb69b6bd8c03dc385cf25620fd8e;hb=144f4bc66dfb750983d5636340d46f7757cfe9d1;hp=afbd74d0751efb6d62526adcdf383bc16eb31c8a;hpb=c06b7b0ba3f6aaa4a3f9586689ef8bfdbd17454e;p=deliverable%2Fbinutils-gdb.git diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h index afbd74d075..305487f8bf 100644 --- a/elfcpp/elfcpp.h +++ b/elfcpp/elfcpp.h @@ -692,6 +692,11 @@ struct Elf_sizes static const int rela_size = sizeof(internal::Rela_data); // Size of ELF dynamic entry. static const int dyn_size = sizeof(internal::Dyn_data); + // Size of ELF version structures. + static const int verdef_size = sizeof(internal::Verdef_data); + static const int verdaux_size = sizeof(internal::Verdaux_data); + static const int verneed_size = sizeof(internal::Verneed_data); + static const int vernaux_size = sizeof(internal::Vernaux_data); }; // Accessor class for the ELF file header. @@ -1304,6 +1309,32 @@ class Dyn const internal::Dyn_data* p_; }; +// Write class for an entry in the SHT_DYNAMIC section. + +template +class Dyn_write +{ + public: + Dyn_write(unsigned char* p) + : p_(reinterpret_cast*>(p)) + { } + + void + put_d_tag(typename Elf_types::Elf_Swxword v) + { this->p_->d_tag = Convert::convert_host(v); } + + void + put_d_val(typename Elf_types::Elf_WXword v) + { this->p_->d_val = Convert::convert_host(v); } + + void + put_d_ptr(typename Elf_types::Elf_Addr v) + { this->p_->d_val = Convert::convert_host(v); } + + private: + internal::Dyn_data* p_; +}; + // Accessor classes for entries in the ELF SHT_GNU_verdef section. template @@ -1352,6 +1383,46 @@ class Verdef const internal::Verdef_data* p_; }; +template +class Verdef_write +{ + public: + Verdef_write(unsigned char* p) + : p_(reinterpret_cast(p)) + { } + + void + set_vd_version(Elf_Half v) + { this->p_->vd_version = Convert<16, big_endian>::convert_host(v); } + + void + set_vd_flags(Elf_Half v) + { this->p_->vd_flags = Convert<16, big_endian>::convert_host(v); } + + void + set_vd_ndx(Elf_Half v) + { this->p_->vd_ndx = Convert<16, big_endian>::convert_host(v); } + + void + set_vd_cnt(Elf_Half v) + { this->p_->vd_cnt = Convert<16, big_endian>::convert_host(v); } + + void + set_vd_hash(Elf_Word v) + { this->p_->vd_hash = Convert<32, big_endian>::convert_host(v); } + + void + set_vd_aux(Elf_Word v) + { this->p_->vd_aux = Convert<32, big_endian>::convert_host(v); } + + void + set_vd_next(Elf_Word v) + { this->p_->vd_next = Convert<32, big_endian>::convert_host(v); } + + private: + internal::Verdef_data* p_; +}; + // Accessor classes for auxiliary entries in the ELF SHT_GNU_verdef // section. @@ -1381,6 +1452,26 @@ class Verdaux const internal::Verdaux_data* p_; }; +template +class Verdaux_write +{ + public: + Verdaux_write(unsigned char* p) + : p_(reinterpret_cast(p)) + { } + + void + set_vda_name(Elf_Word v) + { this->p_->vda_name = Convert<32, big_endian>::convert_host(v); } + + void + set_vda_next(Elf_Word v) + { this->p_->vda_next = Convert<32, big_endian>::convert_host(v); } + + private: + internal::Verdaux_data* p_; +}; + // Accessor classes for entries in the ELF SHT_GNU_verneed section. template @@ -1421,6 +1512,38 @@ class Verneed const internal::Verneed_data* p_; }; +template +class Verneed_write +{ + public: + Verneed_write(unsigned char* p) + : p_(reinterpret_cast(p)) + { } + + void + set_vn_version(Elf_Half v) + { this->p_->vn_version = Convert<16, big_endian>::convert_host(v); } + + void + set_vn_cnt(Elf_Half v) + { this->p_->vn_cnt = Convert<16, big_endian>::convert_host(v); } + + void + set_vn_file(Elf_Word v) + { this->p_->vn_file = Convert<32, big_endian>::convert_host(v); } + + void + set_vn_aux(Elf_Word v) + { this->p_->vn_aux = Convert<32, big_endian>::convert_host(v); } + + void + set_vn_next(Elf_Word v) + { this->p_->vn_next = Convert<32, big_endian>::convert_host(v); } + + private: + internal::Verneed_data* p_; +}; + // Accessor classes for auxiliary entries in the ELF SHT_GNU_verneed // section. @@ -1462,6 +1585,37 @@ class Vernaux const internal::Vernaux_data* p_; }; +template +class Vernaux_write +{ + public: + Vernaux_write(unsigned char* p) + : p_(reinterpret_cast(p)) + { } + + void + set_vna_hash(Elf_Word v) + { this->p_->vna_hash = Convert<32, big_endian>::convert_host(v); } + + void + set_vna_flags(Elf_Half v) + { this->p_->vna_flags = Convert<16, big_endian>::convert_host(v); } + + void + set_vna_other(Elf_Half v) + { this->p_->vna_other = Convert<16, big_endian>::convert_host(v); } + + void + set_vna_name(Elf_Word v) + { this->p_->vna_name = Convert<32, big_endian>::convert_host(v); } + + void + set_vna_next(Elf_Word v) + { this->p_->vna_next = Convert<32, big_endian>::convert_host(v); } + + private: + internal::Vernaux_data* p_; +}; } // End namespace elfcpp.