}; // Accessor class for the ELF file header. template<int size, bool big_endian>class Ehdr{ public: Ehdr(const unsigned char* p) : p_(reinterpret_cast<const internal::Ehdr_data<size>*>(p)) { } template<typename File> Ehdr(File* file, typename File::Location loc) : p_(reinterpret_cast<const internal::Ehdr_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } const unsigned char* get_e_ident() const { return this->p_->e_ident; } Elf_Half get_e_type() const { return Convert<16, big_endian>::convert_host(this->p_->e_type); } Elf_Half get_e_machine() const { return Convert<16, big_endian>::convert_host(this->p_->e_machine); } Elf_Word get_e_version() const { return Convert<32, big_endian>::convert_host(this->p_->e_version); } typename Elf_types<size>::Elf_Addr get_e_entry() const { return Convert<size, big_endian>::convert_host(this->p_->e_entry); } typename Elf_types<size>::Elf_Off get_e_phoff() const { return Convert<size, big_endian>::convert_host(this->p_->e_phoff); } typename Elf_types<size>::Elf_Off get_e_shoff() const { return Convert<size, big_endian>::convert_host(this->p_->e_shoff); } Elf_Word get_e_flags() const { return Convert<32, big_endian>::convert_host(this->p_->e_flags); } Elf_Half get_e_ehsize() const { return Convert<16, big_endian>::convert_host(this->p_->e_ehsize); } Elf_Half get_e_phentsize() const { return Convert<16, big_endian>::convert_host(this->p_->e_phentsize); } Elf_Half get_e_phnum() const { return Convert<16, big_endian>::convert_host(this->p_->e_phnum); } Elf_Half get_e_shentsize() const { return Convert<16, big_endian>::convert_host(this->p_->e_shentsize); } Elf_Half get_e_shnum() const { return Convert<16, big_endian>::convert_host(this->p_->e_shnum); } Elf_Half get_e_shstrndx() const { return Convert<16, big_endian>::convert_host(this->p_->e_shstrndx); } private: const internal::Ehdr_data<size>* p_;}; // Write class for the ELF file header. template<int size, bool big_endian>class Ehdr_write{ public: Ehdr_write(unsigned char* p) : p_(reinterpret_cast<internal::Ehdr_data<size>*>(p)) { } void put_e_ident(const unsigned char v[EI_NIDENT]) const { memcpy(this->p_->e_ident, v, EI_NIDENT); } void put_e_type(Elf_Half v) { this->p_->e_type = Convert<16, big_endian>::convert_host(v); } void put_e_machine(Elf_Half v) { this->p_->e_machine = Convert<16, big_endian>::convert_host(v); } void put_e_version(Elf_Word v) { this->p_->e_version = Convert<32, big_endian>::convert_host(v); } void put_e_entry(typename Elf_types<size>::Elf_Addr v) { this->p_->e_entry = Convert<size, big_endian>::convert_host(v); } void put_e_phoff(typename Elf_types<size>::Elf_Off v) { this->p_->e_phoff = Convert<size, big_endian>::convert_host(v); } void put_e_shoff(typename Elf_types<size>::Elf_Off v) { this->p_->e_shoff = Convert<size, big_endian>::convert_host(v); } void put_e_flags(Elf_Word v) { this->p_->e_flags = Convert<32, big_endian>::convert_host(v); } void put_e_ehsize(Elf_Half v) { this->p_->e_ehsize = Convert<16, big_endian>::convert_host(v); } void put_e_phentsize(Elf_Half v) { this->p_->e_phentsize = Convert<16, big_endian>::convert_host(v); } void put_e_phnum(Elf_Half v) { this->p_->e_phnum = Convert<16, big_endian>::convert_host(v); } void put_e_shentsize(Elf_Half v) { this->p_->e_shentsize = Convert<16, big_endian>::convert_host(v); } void put_e_shnum(Elf_Half v) { this->p_->e_shnum = Convert<16, big_endian>::convert_host(v); } void put_e_shstrndx(Elf_Half v) { this->p_->e_shstrndx = Convert<16, big_endian>::convert_host(v); } private: internal::Ehdr_data<size>* p_;}; // Accessor class for an ELF section header. template<int size, bool big_endian>class Shdr{ public: Shdr(const unsigned char* p) : p_(reinterpret_cast<const internal::Shdr_data<size>*>(p)) { } template<typename File> Shdr(File* file, typename File::Location loc) : p_(reinterpret_cast<const internal::Shdr_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } Elf_Word get_sh_name() const { return Convert<32, big_endian>::convert_host(this->p_->sh_name); } Elf_Word get_sh_type() const { return Convert<32, big_endian>::convert_host(this->p_->sh_type); } typename Elf_types<size>::Elf_WXword get_sh_flags() const { return Convert<size, big_endian>::convert_host(this->p_->sh_flags); } typename Elf_types<size>::Elf_Addr get_sh_addr() const { return Convert<size, big_endian>::convert_host(this->p_->sh_addr); } typename Elf_types<size>::Elf_Off get_sh_offset() const { return Convert<size, big_endian>::convert_host(this->p_->sh_offset); } typename Elf_types<size>::Elf_WXword get_sh_size() const { return Convert<size, big_endian>::convert_host(this->p_->sh_size); } Elf_Word get_sh_link() const { return Convert<32, big_endian>::convert_host(this->p_->sh_link); } Elf_Word get_sh_info() const { return Convert<32, big_endian>::convert_host(this->p_->sh_info); } typename Elf_types<size>::Elf_WXword get_sh_addralign() const { return Convert<size, big_endian>::convert_host(this->p_->sh_addralign); } typename Elf_types<size>::Elf_WXword get_sh_entsize() const { return Convert<size, big_endian>::convert_host(this->p_->sh_entsize); } private: const internal::Shdr_data<size>* p_;}; // Write class for an ELF section header. template<int size, bool big_endian>class Shdr_write{ public: Shdr_write(unsigned char* p) : p_(reinterpret_cast<internal::Shdr_data<size>*>(p)) { } void put_sh_name(Elf_Word v) { this->p_->sh_name = Convert<32, big_endian>::convert_host(v); } void put_sh_type(Elf_Word v) { this->p_->sh_type = Convert<32, big_endian>::convert_host(v); } void put_sh_flags(typename Elf_types<size>::Elf_WXword v) { this->p_->sh_flags = Convert<size, big_endian>::convert_host(v); } void put_sh_addr(typename Elf_types<size>::Elf_Addr v) { this->p_->sh_addr = Convert<size, big_endian>::convert_host(v); } void put_sh_offset(typename Elf_types<size>::Elf_Off v) { this->p_->sh_offset = Convert<size, big_endian>::convert_host(v); } void put_sh_size(typename Elf_types<size>::Elf_WXword v) { this->p_->sh_size = Convert<size, big_endian>::convert_host(v); } void put_sh_link(Elf_Word v) { this->p_->sh_link = Convert<32, big_endian>::convert_host(v); } void put_sh_info(Elf_Word v) { this->p_->sh_info = Convert<32, big_endian>::convert_host(v); } void put_sh_addralign(typename Elf_types<size>::Elf_WXword v) { this->p_->sh_addralign = Convert<size, big_endian>::convert_host(v); } void put_sh_entsize(typename Elf_types<size>::Elf_WXword v) { this->p_->sh_entsize = Convert<size, big_endian>::convert_host(v); } private: internal::Shdr_data<size>* p_;}; // Accessor class for an ELF segment header. template<int size, bool big_endian>class Phdr{ public: Phdr(const unsigned char* p) : p_(reinterpret_cast<const internal::Phdr_data<size>*>(p)) { } template<typename File> Phdr(File* file, typename File::Location loc) : p_(reinterpret_cast<internal::Phdr_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } Elf_Word get_p_type() const { return Convert<32, big_endian>::convert_host(this->p_->p_type); } typename Elf_types<size>::Elf_Off get_p_offset() const { return Convert<size, big_endian>::convert_host(this->p_->p_offset); } typename Elf_types<size>::Elf_Addr get_p_vaddr() const { return Convert<size, big_endian>::convert_host(this->p_->p_vaddr); } typename Elf_types<size>::Elf_Addr get_p_paddr() const { return Convert<size, big_endian>::convert_host(this->p_->p_paddr); } typename Elf_types<size>::Elf_WXword get_p_filesz() const { return Convert<size, big_endian>::convert_host(this->p_->p_filesz); } typename Elf_types<size>::Elf_WXword get_p_memsz() const { return Convert<size, big_endian>::convert_host(this->p_->p_memsz); } Elf_Word get_p_flags() const { return Convert<32, big_endian>::convert_host(this->p_->p_flags); } typename Elf_types<size>::Elf_WXword get_p_align() const { return Convert<size, big_endian>::convert_host(this->p_->p_align); } private: const internal::Phdr_data<size>* p_;}; // Write class for an ELF segment header. template<int size, bool big_endian>class Phdr_write{ public: Phdr_write(unsigned char* p) : p_(reinterpret_cast<internal::Phdr_data<size>*>(p)) { } void put_p_type(Elf_Word v) { this->p_->p_type = Convert<32, big_endian>::convert_host(v); } void put_p_offset(typename Elf_types<size>::Elf_Off v) { this->p_->p_offset = Convert<size, big_endian>::convert_host(v); } void put_p_vaddr(typename Elf_types<size>::Elf_Addr v) { this->p_->p_vaddr = Convert<size, big_endian>::convert_host(v); } void put_p_paddr(typename Elf_types<size>::Elf_Addr v) { this->p_->p_paddr = Convert<size, big_endian>::convert_host(v); } void put_p_filesz(typename Elf_types<size>::Elf_WXword v) { this->p_->p_filesz = Convert<size, big_endian>::convert_host(v); } void put_p_memsz(typename Elf_types<size>::Elf_WXword v) { this->p_->p_memsz = Convert<size, big_endian>::convert_host(v); } void put_p_flags(Elf_Word v) { this->p_->p_flags = Convert<32, big_endian>::convert_host(v); } void put_p_align(typename Elf_types<size>::Elf_WXword v) { this->p_->p_align = Convert<size, big_endian>::convert_host(v); } private: internal::Phdr_data<size>* p_;}; // Accessor class for an ELF symbol table entry. template<int size, bool big_endian>class Sym{ public: Sym(const unsigned char* p) : p_(reinterpret_cast<const internal::Sym_data<size>*>(p)) { } template<typename File> Sym(File* file, typename File::Location loc) : p_(reinterpret_cast<const internal::Sym_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } Elf_Word get_st_name() const { return Convert<32, big_endian>::convert_host(this->p_->st_name); } typename Elf_types<size>::Elf_Addr get_st_value() const { return Convert<size, big_endian>::convert_host(this->p_->st_value); } typename Elf_types<size>::Elf_WXword get_st_size() const { return Convert<size, big_endian>::convert_host(this->p_->st_size); } unsigned char get_st_info() const { return this->p_->st_info; } STB get_st_bind() const { return elf_st_bind(this->get_st_info()); } STT get_st_type() const { return elf_st_type(this->get_st_info()); } unsigned char get_st_other() const { return this->p_->st_other; } STV get_st_visibility() const { return elf_st_visibility(this->get_st_other()); } unsigned char get_st_nonvis() const { return elf_st_nonvis(this->get_st_other()); } Elf_Half get_st_shndx() const { return Convert<16, big_endian>::convert_host(this->p_->st_shndx); } private: const internal::Sym_data<size>* p_;}; // Writer class for an ELF symbol table entry. template<int size, bool big_endian>class Sym_write{ public: Sym_write(unsigned char* p) : p_(reinterpret_cast<internal::Sym_data<size>*>(p)) { } void put_st_name(Elf_Word v) { this->p_->st_name = Convert<32, big_endian>::convert_host(v); } void put_st_value(typename Elf_types<size>::Elf_Addr v) { this->p_->st_value = Convert<size, big_endian>::convert_host(v); } void put_st_size(typename Elf_types<size>::Elf_WXword v) { this->p_->st_size = Convert<size, big_endian>::convert_host(v); } void put_st_info(unsigned char v) { this->p_->st_info = v; } void put_st_info(STB bind, STT type) { this->p_->st_info = elf_st_info(bind, type); } void put_st_other(unsigned char v) { this->p_->st_other = v; } void put_st_other(STV vis, unsigned char nonvis) { this->p_->st_other = elf_st_other(vis, nonvis); } void put_st_shndx(Elf_Half v) { this->p_->st_shndx = Convert<16, big_endian>::convert_host(v); } Sym<size, big_endian> sym() { return Sym<size, big_endian>(reinterpret_cast<unsigned char*>(this->p_)); } private: internal::Sym_data<size>* p_;}; // Accessor classes for an ELF REL relocation entry. template<int size, bool big_endian>class Rel{ public: Rel(const unsigned char* p) : p_(reinterpret_cast<const internal::Rel_data<size>*>(p)) { } template<typename File> Rel(File* file, typename File::Location loc) : p_(reinterpret_cast<const internal::Rel_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } typename Elf_types<size>::Elf_Addr get_r_offset() const { return Convert<size, big_endian>::convert_host(this->p_->r_offset); } typename Elf_types<size>::Elf_WXword get_r_info() const { return Convert<size, big_endian>::convert_host(this->p_->r_info); } private: const internal::Rel_data<size>* p_;}; // Writer class for an ELF Rel relocation.Lines 1001–1500 of 1923. Previous lines Load more
}; // Accessor class for the ELF file header. template<int size, bool big_endian> class Ehdr { public: Ehdr(const unsigned char* p) : p_(reinterpret_cast<const internal::Ehdr_data<size>*>(p)) { } template<typename File> Ehdr(File* file, typename File::Location loc) : p_(reinterpret_cast<const internal::Ehdr_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } const unsigned char* get_e_ident() const { return this->p_->e_ident; } Elf_Half get_e_type() const { return Convert<16, big_endian>::convert_host(this->p_->e_type); } Elf_Half get_e_machine() const { return Convert<16, big_endian>::convert_host(this->p_->e_machine); } Elf_Word get_e_version() const { return Convert<32, big_endian>::convert_host(this->p_->e_version); } typename Elf_types<size>::Elf_Addr get_e_entry() const { return Convert<size, big_endian>::convert_host(this->p_->e_entry); } typename Elf_types<size>::Elf_Off get_e_phoff() const { return Convert<size, big_endian>::convert_host(this->p_->e_phoff); } typename Elf_types<size>::Elf_Off get_e_shoff() const { return Convert<size, big_endian>::convert_host(this->p_->e_shoff); } Elf_Word get_e_flags() const { return Convert<32, big_endian>::convert_host(this->p_->e_flags); } Elf_Half get_e_ehsize() const { return Convert<16, big_endian>::convert_host(this->p_->e_ehsize); } Elf_Half get_e_phentsize() const { return Convert<16, big_endian>::convert_host(this->p_->e_phentsize); } Elf_Half get_e_phnum() const { return Convert<16, big_endian>::convert_host(this->p_->e_phnum); } Elf_Half get_e_shentsize() const { return Convert<16, big_endian>::convert_host(this->p_->e_shentsize); } Elf_Half get_e_shnum() const { return Convert<16, big_endian>::convert_host(this->p_->e_shnum); } Elf_Half get_e_shstrndx() const { return Convert<16, big_endian>::convert_host(this->p_->e_shstrndx); } private: const internal::Ehdr_data<size>* p_; }; // Write class for the ELF file header. template<int size, bool big_endian> class Ehdr_write { public: Ehdr_write(unsigned char* p) : p_(reinterpret_cast<internal::Ehdr_data<size>*>(p)) { } void put_e_ident(const unsigned char v[EI_NIDENT]) const { memcpy(this->p_->e_ident, v, EI_NIDENT); } void put_e_type(Elf_Half v) { this->p_->e_type = Convert<16, big_endian>::convert_host(v); } void put_e_machine(Elf_Half v) { this->p_->e_machine = Convert<16, big_endian>::convert_host(v); } void put_e_version(Elf_Word v) { this->p_->e_version = Convert<32, big_endian>::convert_host(v); } void put_e_entry(typename Elf_types<size>::Elf_Addr v) { this->p_->e_entry = Convert<size, big_endian>::convert_host(v); } void put_e_phoff(typename Elf_types<size>::Elf_Off v) { this->p_->e_phoff = Convert<size, big_endian>::convert_host(v); } void put_e_shoff(typename Elf_types<size>::Elf_Off v) { this->p_->e_shoff = Convert<size, big_endian>::convert_host(v); } void put_e_flags(Elf_Word v) { this->p_->e_flags = Convert<32, big_endian>::convert_host(v); } void put_e_ehsize(Elf_Half v) { this->p_->e_ehsize = Convert<16, big_endian>::convert_host(v); } void put_e_phentsize(Elf_Half v) { this->p_->e_phentsize = Convert<16, big_endian>::convert_host(v); } void put_e_phnum(Elf_Half v) { this->p_->e_phnum = Convert<16, big_endian>::convert_host(v); } void put_e_shentsize(Elf_Half v) { this->p_->e_shentsize = Convert<16, big_endian>::convert_host(v); } void put_e_shnum(Elf_Half v) { this->p_->e_shnum = Convert<16, big_endian>::convert_host(v); } void put_e_shstrndx(Elf_Half v) { this->p_->e_shstrndx = Convert<16, big_endian>::convert_host(v); } private: internal::Ehdr_data<size>* p_; }; // Accessor class for an ELF section header. template<int size, bool big_endian> class Shdr { public: Shdr(const unsigned char* p) : p_(reinterpret_cast<const internal::Shdr_data<size>*>(p)) { } template<typename File> Shdr(File* file, typename File::Location loc) : p_(reinterpret_cast<const internal::Shdr_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } Elf_Word get_sh_name() const { return Convert<32, big_endian>::convert_host(this->p_->sh_name); } Elf_Word get_sh_type() const { return Convert<32, big_endian>::convert_host(this->p_->sh_type); } typename Elf_types<size>::Elf_WXword get_sh_flags() const { return Convert<size, big_endian>::convert_host(this->p_->sh_flags); } typename Elf_types<size>::Elf_Addr get_sh_addr() const { return Convert<size, big_endian>::convert_host(this->p_->sh_addr); } typename Elf_types<size>::Elf_Off get_sh_offset() const { return Convert<size, big_endian>::convert_host(this->p_->sh_offset); } typename Elf_types<size>::Elf_WXword get_sh_size() const { return Convert<size, big_endian>::convert_host(this->p_->sh_size); } Elf_Word get_sh_link() const { return Convert<32, big_endian>::convert_host(this->p_->sh_link); } Elf_Word get_sh_info() const { return Convert<32, big_endian>::convert_host(this->p_->sh_info); } typename Elf_types<size>::Elf_WXword get_sh_addralign() const { return Convert<size, big_endian>::convert_host(this->p_->sh_addralign); } typename Elf_types<size>::Elf_WXword get_sh_entsize() const { return Convert<size, big_endian>::convert_host(this->p_->sh_entsize); } private: const internal::Shdr_data<size>* p_; }; // Write class for an ELF section header. template<int size, bool big_endian> class Shdr_write { public: Shdr_write(unsigned char* p) : p_(reinterpret_cast<internal::Shdr_data<size>*>(p)) { } void put_sh_name(Elf_Word v) { this->p_->sh_name = Convert<32, big_endian>::convert_host(v); } void put_sh_type(Elf_Word v) { this->p_->sh_type = Convert<32, big_endian>::convert_host(v); } void put_sh_flags(typename Elf_types<size>::Elf_WXword v) { this->p_->sh_flags = Convert<size, big_endian>::convert_host(v); } void put_sh_addr(typename Elf_types<size>::Elf_Addr v) { this->p_->sh_addr = Convert<size, big_endian>::convert_host(v); } void put_sh_offset(typename Elf_types<size>::Elf_Off v) { this->p_->sh_offset = Convert<size, big_endian>::convert_host(v); } void put_sh_size(typename Elf_types<size>::Elf_WXword v) { this->p_->sh_size = Convert<size, big_endian>::convert_host(v); } void put_sh_link(Elf_Word v) { this->p_->sh_link = Convert<32, big_endian>::convert_host(v); } void put_sh_info(Elf_Word v) { this->p_->sh_info = Convert<32, big_endian>::convert_host(v); } void put_sh_addralign(typename Elf_types<size>::Elf_WXword v) { this->p_->sh_addralign = Convert<size, big_endian>::convert_host(v); } void put_sh_entsize(typename Elf_types<size>::Elf_WXword v) { this->p_->sh_entsize = Convert<size, big_endian>::convert_host(v); } private: internal::Shdr_data<size>* p_; }; // Accessor class for an ELF segment header. template<int size, bool big_endian> class Phdr { public: Phdr(const unsigned char* p) : p_(reinterpret_cast<const internal::Phdr_data<size>*>(p)) { } template<typename File> Phdr(File* file, typename File::Location loc) : p_(reinterpret_cast<internal::Phdr_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } Elf_Word get_p_type() const { return Convert<32, big_endian>::convert_host(this->p_->p_type); } typename Elf_types<size>::Elf_Off get_p_offset() const { return Convert<size, big_endian>::convert_host(this->p_->p_offset); } typename Elf_types<size>::Elf_Addr get_p_vaddr() const { return Convert<size, big_endian>::convert_host(this->p_->p_vaddr); } typename Elf_types<size>::Elf_Addr get_p_paddr() const { return Convert<size, big_endian>::convert_host(this->p_->p_paddr); } typename Elf_types<size>::Elf_WXword get_p_filesz() const { return Convert<size, big_endian>::convert_host(this->p_->p_filesz); } typename Elf_types<size>::Elf_WXword get_p_memsz() const { return Convert<size, big_endian>::convert_host(this->p_->p_memsz); } Elf_Word get_p_flags() const { return Convert<32, big_endian>::convert_host(this->p_->p_flags); } typename Elf_types<size>::Elf_WXword get_p_align() const { return Convert<size, big_endian>::convert_host(this->p_->p_align); } private: const internal::Phdr_data<size>* p_; }; // Write class for an ELF segment header. template<int size, bool big_endian> class Phdr_write { public: Phdr_write(unsigned char* p) : p_(reinterpret_cast<internal::Phdr_data<size>*>(p)) { } void put_p_type(Elf_Word v) { this->p_->p_type = Convert<32, big_endian>::convert_host(v); } void put_p_offset(typename Elf_types<size>::Elf_Off v) { this->p_->p_offset = Convert<size, big_endian>::convert_host(v); } void put_p_vaddr(typename Elf_types<size>::Elf_Addr v) { this->p_->p_vaddr = Convert<size, big_endian>::convert_host(v); } void put_p_paddr(typename Elf_types<size>::Elf_Addr v) { this->p_->p_paddr = Convert<size, big_endian>::convert_host(v); } void put_p_filesz(typename Elf_types<size>::Elf_WXword v) { this->p_->p_filesz = Convert<size, big_endian>::convert_host(v); } void put_p_memsz(typename Elf_types<size>::Elf_WXword v) { this->p_->p_memsz = Convert<size, big_endian>::convert_host(v); } void put_p_flags(Elf_Word v) { this->p_->p_flags = Convert<32, big_endian>::convert_host(v); } void put_p_align(typename Elf_types<size>::Elf_WXword v) { this->p_->p_align = Convert<size, big_endian>::convert_host(v); } private: internal::Phdr_data<size>* p_; }; // Accessor class for an ELF symbol table entry. template<int size, bool big_endian> class Sym { public: Sym(const unsigned char* p) : p_(reinterpret_cast<const internal::Sym_data<size>*>(p)) { } template<typename File> Sym(File* file, typename File::Location loc) : p_(reinterpret_cast<const internal::Sym_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } Elf_Word get_st_name() const { return Convert<32, big_endian>::convert_host(this->p_->st_name); } typename Elf_types<size>::Elf_Addr get_st_value() const { return Convert<size, big_endian>::convert_host(this->p_->st_value); } typename Elf_types<size>::Elf_WXword get_st_size() const { return Convert<size, big_endian>::convert_host(this->p_->st_size); } unsigned char get_st_info() const { return this->p_->st_info; } STB get_st_bind() const { return elf_st_bind(this->get_st_info()); } STT get_st_type() const { return elf_st_type(this->get_st_info()); } unsigned char get_st_other() const { return this->p_->st_other; } STV get_st_visibility() const { return elf_st_visibility(this->get_st_other()); } unsigned char get_st_nonvis() const { return elf_st_nonvis(this->get_st_other()); } Elf_Half get_st_shndx() const { return Convert<16, big_endian>::convert_host(this->p_->st_shndx); } private: const internal::Sym_data<size>* p_; }; // Writer class for an ELF symbol table entry. template<int size, bool big_endian> class Sym_write { public: Sym_write(unsigned char* p) : p_(reinterpret_cast<internal::Sym_data<size>*>(p)) { } void put_st_name(Elf_Word v) { this->p_->st_name = Convert<32, big_endian>::convert_host(v); } void put_st_value(typename Elf_types<size>::Elf_Addr v) { this->p_->st_value = Convert<size, big_endian>::convert_host(v); } void put_st_size(typename Elf_types<size>::Elf_WXword v) { this->p_->st_size = Convert<size, big_endian>::convert_host(v); } void put_st_info(unsigned char v) { this->p_->st_info = v; } void put_st_info(STB bind, STT type) { this->p_->st_info = elf_st_info(bind, type); } void put_st_other(unsigned char v) { this->p_->st_other = v; } void put_st_other(STV vis, unsigned char nonvis) { this->p_->st_other = elf_st_other(vis, nonvis); } void put_st_shndx(Elf_Half v) { this->p_->st_shndx = Convert<16, big_endian>::convert_host(v); } Sym<size, big_endian> sym() { return Sym<size, big_endian>(reinterpret_cast<unsigned char*>(this->p_)); } private: internal::Sym_data<size>* p_; }; // Accessor classes for an ELF REL relocation entry. template<int size, bool big_endian> class Rel { public: Rel(const unsigned char* p) : p_(reinterpret_cast<const internal::Rel_data<size>*>(p)) { } template<typename File> Rel(File* file, typename File::Location loc) : p_(reinterpret_cast<const internal::Rel_data<size>*>( file->view(loc.file_offset, loc.data_size).data())) { } typename Elf_types<size>::Elf_Addr get_r_offset() const { return Convert<size, big_endian>::convert_host(this->p_->r_offset); } typename Elf_types<size>::Elf_WXword get_r_info() const { return Convert<size, big_endian>::convert_host(this->p_->r_info); } private: const internal::Rel_data<size>* p_; }; // Writer class for an ELF Rel relocation.