glibc/sysdeps/unix/sysv/linux/riscv
Adhemerval Zanella 2149da3683 riscv: Fix alignment-ignorant memcpy implementation
The memcpy optimization (commit 587a1290a1) has a series
of mistakes:

  - The implementation is wrong: the chunk size calculation is wrong
    leading to invalid memory access.

  - It adds ifunc supports as default, so --disable-multi-arch does
    not work as expected for riscv.

  - It mixes Linux files (memcpy ifunc selection which requires the
    vDSO/syscall mechanism)  with generic support (the memcpy
    optimization itself).

  - There is no __libc_ifunc_impl_list, which makes testing only
    check the selected implementation instead of all supported
    by the system.

This patch also simplifies the required bits to enable ifunc: there
is no need to memcopy.h; nor to add Linux-specific files.

The __memcpy_noalignment tail handling now uses a branchless strategy
similar to aarch64 (overlap 32-bits copies for sizes 4..7 and byte
copies for size 1..3).

Checked on riscv64 and riscv32 by explicitly enabling the function
on __libc_ifunc_impl_list on qemu-system.

Changes from v1:
* Implement the memcpy in assembly to correctly handle RISCV
  strict-alignment.
Reviewed-by: Evan Green <evan@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
2024-03-12 14:38:08 -03:00
..
bits Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
include/sys riscv: Fix alignment-ignorant memcpy implementation 2024-03-12 14:38:08 -03:00
multiarch riscv: Fix alignment-ignorant memcpy implementation 2024-03-12 14:38:08 -03:00
rv32 riscv: Add Linux hwprobe syscall support 2024-03-01 07:14:55 -08:00
rv64 riscv: Add Linux hwprobe syscall support 2024-03-01 07:14:55 -08:00
sys riscv: Add ifunc helper method to hwprobe.h 2024-03-01 07:15:00 -08:00
Implies
Makefile riscv: Fix alignment-ignorant memcpy implementation 2024-03-12 14:38:08 -03:00
Versions riscv: Add Linux hwprobe syscall support 2024-03-01 07:14:55 -08:00
atomic-machine.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
clone.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
clone3.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
configure configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
configure.ac
dl-cache.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
flush-icache.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
getcontext.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hwprobe.c riscv: Fix alignment-ignorant memcpy implementation 2024-03-12 14:38:08 -03:00
kernel-features.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ldd-rewrite.sed
localplt.data elf: Rework exception handling in the dynamic loader [BZ #25486] 2022-11-03 09:39:31 +01:00
makecontext.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
readelflib.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
setcontext.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
shlib-versions
sigcontextinfo.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
swapcontext.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
syscall.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sysconf.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sysdep.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sysdep.h riscv: Add hwprobe vdso call support 2024-03-01 07:14:57 -08:00
ucontext-macros.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ucontext_i.sym
vfork.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00