glibc/sysdeps/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 Refer to C23 in place of C2X in glibc 2024-02-01 11:02:01 +00:00
multiarch riscv: Fix alignment-ignorant memcpy implementation 2024-03-12 14:38:08 -03:00
nofpu Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
nptl Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
rv32 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
rv64 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
rvd Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
rvf Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sys Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
__longjmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
bsd-_setjmp.c RISC-V: ABI Implementation 2018-01-29 10:25:29 -08:00
bsd-setjmp.c RISC-V: ABI Implementation 2018-01-29 10:25:29 -08:00
configure RISC-V: Enable static-pie. 2024-01-12 15:11:45 -03:00
configure.ac RISC-V: Enable static-pie. 2024-01-12 15:11:45 -03:00
dl-irel.h riscv: Add __riscv_hwprobe pointer to ifunc calls 2024-03-01 07:14:58 -08:00
dl-link.sym RISC-V: Add support for dl_runtime_profile (BZ #31151) 2023-12-30 11:00:10 +01:00
dl-machine.h RISC-V: Enable static-pie. 2024-01-12 15:11:45 -03:00
dl-relocate-ld.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-tls.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dl-trampoline.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
e_sqrtl.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
fpu_control.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
gccframe.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Implies Introduce <elf-initfini.h> and ELF_INITFINI for all architectures 2020-02-18 15:12:25 +01:00
jmpbuf-offsets.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
jmpbuf-unwind.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ldsodefs.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
libc-tls.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
linkmap.h RISC-V: ABI Implementation 2018-01-29 10:25:29 -08:00
machine-gmon.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Makefile RISC-V: Add support for dl_runtime_profile (BZ #31151) 2023-12-30 11:00:10 +01:00
math-tests-snan-payload.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
math-tests-trap.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
preconfigure configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
preconfigure.ac RISC-V: Use an autoconf template to produce `preconfigure' 2022-05-13 17:07:23 +01:00
riscv-ifunc.h riscv: Enable multi-arg ifunc resolvers 2024-03-01 07:14:59 -08:00
setjmp.S Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sfp-machine.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sotruss-lib.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
stackinfo.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
start.S riscv: add support for static PIE 2024-01-22 14:58:23 +01:00
string-fza.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
string-fzi.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
tininess.h RISC-V: Generic <math.h> and soft-fp Routines 2018-01-29 10:26:35 -08:00
tst-audit.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00