riscv: Use memcpy to handle unaligned access when fixing R_RISCV_RELATIVE
authorKito Cheng <kito.cheng@sifive.com>
Tue, 28 Jun 2022 13:52:19 +0000 (21:52 +0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 30 Jun 2022 15:04:52 +0000 (08:04 -0700)
commitc22d2021a9f9bdea62398976eea4f0e6ef668b7d
tree31c84de370e090ad007b11e4d679a5eff94ab717
parente9dd3682963a7038d699430e3ece68045b6caafc
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>
sysdeps/riscv/dl-machine.h