// Relocate the field with the PC relative offset of the pair of
// GOT entries.
- RelocFuncs::pcrel32(view, got_entry, address);
+ RelocFuncs::pcrel32_unaligned(view, got_entry, address);
return ArmRelocFuncs::STATUS_OKAY;
}
}
// Relocate the field with the PC relative offset of the pair of
// GOT entries.
- RelocFuncs::pcrel32(view, got_entry, address);
+ RelocFuncs::pcrel32_unaligned(view, got_entry, address);
return ArmRelocFuncs::STATUS_OKAY;
}
break;
case elfcpp::R_ARM_TLS_LDO32: // Alternate local-dynamic
- RelocFuncs::rel32(view, value);
+ RelocFuncs::rel32_unaligned(view, value);
return ArmRelocFuncs::STATUS_OKAY;
case elfcpp::R_ARM_TLS_IE32: // Initial-exec
target->got_plt_section()->address() + got_offset;
// Relocate the field with the PC relative offset of the GOT entry.
- RelocFuncs::pcrel32(view, got_entry, address);
+ RelocFuncs::pcrel32_unaligned(view, got_entry, address);
return ArmRelocFuncs::STATUS_OKAY;
}
break;
// need to add TCB size to the offset.
Arm_address aligned_tcb_size =
align_address(ARM_TCB_SIZE, tls_segment->maximum_alignment());
- RelocFuncs::rel32(view, value + aligned_tcb_size);
+ RelocFuncs::rel32_unaligned(view, value + aligned_tcb_size);
}
return ArmRelocFuncs::STATUS_OKAY;
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
// the section contents. VALSIZE is the size of the value to
// relocate.
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
// addend in the section contents. VALSIZE is the size of the
// value.
rel32(unsigned char* view, elfcpp::Elf_Word 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
rel32(unsigned char* view,
const Sized_relobj_file<size, big_endian>* object,
typename elfcpp::Elf_types<size>::Elf_Addr 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
pcrel32(unsigned char* view,
const Sized_relobj_file<size, big_endian>* object,