Snapshot. Includes first cut at output relocation sections.

This commit is contained in:
Ian Lance Taylor 2006-11-16 00:38:25 +00:00
parent 7495b3afc0
commit c06b7b0ba3
17 changed files with 885 additions and 179 deletions

View file

@ -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.