mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 17:53:37 +08:00
riscv: Use memcpy to handle unaligned access when fixing R_RISCV_RELATIVE
Although RISC-V Linux will enable the unaligned memory access handler by default, that is quite expensive in general, using memcpy will be much cheaper - just break down that into several load/store byte instructions. ARM and MIPS has similar issue: ARM: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51456 MIPS: https://gcc.gnu.org/legacy-ml/gcc-help/2005-07/msg00325.html Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
e9dd368296
commit
c22d2021a9
@ -157,7 +157,10 @@ __attribute__ ((always_inline))
|
||||
elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
|
||||
void *const reloc_addr)
|
||||
{
|
||||
*(ElfW(Addr) *) reloc_addr = l_addr + reloc->r_addend;
|
||||
/* R_RISCV_RELATIVE might located in debug info section which might not
|
||||
aligned to XLEN bytes. Also support relocations on unaligned offsets. */
|
||||
ElfW(Addr) value = l_addr + reloc->r_addend;
|
||||
memcpy (reloc_addr, &value, sizeof value);
|
||||
}
|
||||
|
||||
/* Perform a relocation described by R_INFO at the location pointed to
|
||||
|
Loading…
Reference in New Issue
Block a user