Line 245... |
Line 245... |
// bytes in the addend in the section contents.
|
// bytes in the addend in the section contents.
|
RELOC_ADJUST_FOR_SECTION_1,
|
RELOC_ADJUST_FOR_SECTION_1,
|
RELOC_ADJUST_FOR_SECTION_2,
|
RELOC_ADJUST_FOR_SECTION_2,
|
RELOC_ADJUST_FOR_SECTION_4,
|
RELOC_ADJUST_FOR_SECTION_4,
|
RELOC_ADJUST_FOR_SECTION_8,
|
RELOC_ADJUST_FOR_SECTION_8,
|
|
// Like RELOC_ADJUST_FOR_SECTION_4 but for unaligned relocs.
|
|
RELOC_ADJUST_FOR_SECTION_4_UNALIGNED,
|
// Discard the input reloc--process it completely when relocating
|
// Discard the input reloc--process it completely when relocating
|
// the data section contents.
|
// the data section contents.
|
RELOC_DISCARD,
|
RELOC_DISCARD,
|
// An input reloc which is not discarded, but which requires
|
// An input reloc which is not discarded, but which requires
|
// target specific processing in order to update it.
|
// target specific processing in order to update it.
|
Line 329... |
Line 331... |
Valtype* wv = reinterpret_cast<Valtype*>(view);
|
Valtype* wv = reinterpret_cast<Valtype*>(view);
|
Valtype x = elfcpp::Swap<valsize, big_endian>::readval(wv);
|
Valtype x = elfcpp::Swap<valsize, big_endian>::readval(wv);
|
elfcpp::Swap<valsize, big_endian>::writeval(wv, x + value);
|
elfcpp::Swap<valsize, big_endian>::writeval(wv, x + value);
|
}
|
}
|
|
|
|
// Like the above but for relocs at unaligned addresses.
|
|
template<int valsize>
|
|
static inline void
|
|
rel_unaligned(unsigned char* view,
|
|
typename elfcpp::Swap<valsize, big_endian>::Valtype value)
|
|
{
|
|
typedef typename elfcpp::Swap_unaligned<valsize, big_endian>::Valtype
|
|
Valtype;
|
|
Valtype x = elfcpp::Swap_unaligned<valsize, big_endian>::readval(view);
|
|
elfcpp::Swap_unaligned<valsize, big_endian>::writeval(view, x + value);
|
|
}
|
|
|
// Do a simple relocation using a Symbol_value with the addend in
|
// Do a simple relocation using a Symbol_value with the addend in
|
// the section contents. VALSIZE is the size of the value to
|
// the section contents. VALSIZE is the size of the value to
|
// relocate.
|
// relocate.
|
template<int valsize>
|
template<int valsize>
|
static inline void
|
static inline void
|
Line 345... |
Line 359... |
Valtype x = elfcpp::Swap<valsize, big_endian>::readval(wv);
|
Valtype x = elfcpp::Swap<valsize, big_endian>::readval(wv);
|
x = psymval->value(object, x);
|
x = psymval->value(object, x);
|
elfcpp::Swap<valsize, big_endian>::writeval(wv, x);
|
elfcpp::Swap<valsize, big_endian>::writeval(wv, x);
|
}
|
}
|
|
|
|
// Like the above but for relocs at unaligned addresses.
|
|
template<int valsize>
|
|
static inline void
|
|
rel_unaligned(unsigned char* view,
|
|
const Sized_relobj_file<size, big_endian>* object,
|
|
const Symbol_value<size>* psymval)
|
|
{
|
|
typedef typename elfcpp::Swap_unaligned<valsize, big_endian>::Valtype
|
|
Valtype;
|
|
Valtype x = elfcpp::Swap_unaligned<valsize, big_endian>::readval(view);
|
|
x = psymval->value(object, x);
|
|
elfcpp::Swap_unaligned<valsize, big_endian>::writeval(view, x);
|
|
}
|
|
|
// Do a simple relocation with the addend in the relocation.
|
// Do a simple relocation with the addend in the relocation.
|
// VALSIZE is the size of the value.
|
// VALSIZE is the size of the value.
|
template<int valsize>
|
template<int valsize>
|
static inline void
|
static inline void
|
rela(unsigned char* view,
|
rela(unsigned char* view,
|
Line 387... |
Line 415... |
Valtype* wv = reinterpret_cast<Valtype*>(view);
|
Valtype* wv = reinterpret_cast<Valtype*>(view);
|
Valtype x = elfcpp::Swap<valsize, big_endian>::readval(wv);
|
Valtype x = elfcpp::Swap<valsize, big_endian>::readval(wv);
|
elfcpp::Swap<valsize, big_endian>::writeval(wv, x + value - address);
|
elfcpp::Swap<valsize, big_endian>::writeval(wv, x + value - address);
|
}
|
}
|
|
|
|
// Like the above but for relocs at unaligned addresses.
|
|
template<int valsize>
|
|
static inline void
|
|
pcrel_unaligned(unsigned char* view,
|
|
typename elfcpp::Swap<valsize, big_endian>::Valtype value,
|
|
typename elfcpp::Elf_types<size>::Elf_Addr address)
|
|
{
|
|
typedef typename elfcpp::Swap<valsize, big_endian>::Valtype Valtype;
|
|
Valtype x = elfcpp::Swap_unaligned<valsize, big_endian>::readval(view);
|
|
elfcpp::Swap_unaligned<valsize, big_endian>::writeval(view,
|
|
x + value - address);
|
|
}
|
|
|
// Do a simple PC relative relocation with a Symbol_value with the
|
// Do a simple PC relative relocation with a Symbol_value with the
|
// addend in the section contents. VALSIZE is the size of the
|
// addend in the section contents. VALSIZE is the size of the
|
// value.
|
// value.
|
template<int valsize>
|
template<int valsize>
|
static inline void
|
static inline void
|
Line 550... |
Line 591... |
// contents.
|
// contents.
|
static inline void
|
static inline void
|
rel32(unsigned char* view, elfcpp::Elf_Word value)
|
rel32(unsigned char* view, elfcpp::Elf_Word value)
|
{ This::template rel<32>(view, value); }
|
{ This::template rel<32>(view, value); }
|
|
|
|
// Like above but for relocs at unaligned addresses.
|
|
static inline void
|
|
rel32_unaligned(unsigned char* view, elfcpp::Elf_Word value)
|
|
{ This::template rel_unaligned<32>(view, value); }
|
|
|
static inline void
|
static inline void
|
rel32(unsigned char* view,
|
rel32(unsigned char* view,
|
const Sized_relobj_file<size, big_endian>* object,
|
const Sized_relobj_file<size, big_endian>* object,
|
const Symbol_value<size>* psymval)
|
const Symbol_value<size>* psymval)
|
{ This::template rel<32>(view, object, psymval); }
|
{ This::template rel<32>(view, object, psymval); }
|
|
|
|
// Like above but for relocs at unaligned addresses.
|
|
static inline void
|
|
rel32_unaligned(unsigned char* view,
|
|
const Sized_relobj_file<size, big_endian>* object,
|
|
const Symbol_value<size>* psymval)
|
|
{ This::template rel_unaligned<32>(view, object, psymval); }
|
|
|
// Do an 32-bit RELA relocation with the addend in the relocation.
|
// Do an 32-bit RELA relocation with the addend in the relocation.
|
static inline void
|
static inline void
|
rela32(unsigned char* view, elfcpp::Elf_Word value, elfcpp::Elf_Word addend)
|
rela32(unsigned char* view, elfcpp::Elf_Word value, elfcpp::Elf_Word addend)
|
{ This::template rela<32>(view, value, addend); }
|
{ This::template rela<32>(view, value, addend); }
|
|
|
Line 575... |
Line 628... |
static inline void
|
static inline void
|
pcrel32(unsigned char* view, elfcpp::Elf_Word value,
|
pcrel32(unsigned char* view, elfcpp::Elf_Word value,
|
typename elfcpp::Elf_types<size>::Elf_Addr address)
|
typename elfcpp::Elf_types<size>::Elf_Addr address)
|
{ This::template pcrel<32>(view, value, address); }
|
{ This::template pcrel<32>(view, value, address); }
|
|
|
|
// Unaligned version of the above.
|
|
static inline void
|
|
pcrel32_unaligned(unsigned char* view, elfcpp::Elf_Word value,
|
|
typename elfcpp::Elf_types<size>::Elf_Addr address)
|
|
{ This::template pcrel_unaligned<32>(view, value, address); }
|
|
|
static inline void
|
static inline void
|
pcrel32(unsigned char* view,
|
pcrel32(unsigned char* view,
|
const Sized_relobj_file<size, big_endian>* object,
|
const Sized_relobj_file<size, big_endian>* object,
|
const Symbol_value<size>* psymval,
|
const Symbol_value<size>* psymval,
|
typename elfcpp::Elf_types<size>::Elf_Addr address)
|
typename elfcpp::Elf_types<size>::Elf_Addr address)
|