[PATCH v1 1/1] riscv: Nop out memcpy_noalignment if !IS_IN(libc)

Yao Zihong zihong.plct@isrc.iscas.ac.cn
Mon Jan 19 07:01:40 GMT 2026


This patch nop out memcpy_noalignment if !IS_IN(libc) since ld.so
can only use the generic implmentation.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
---
 sysdeps/riscv/multiarch/memcpy_noalignment.S | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sysdeps/riscv/multiarch/memcpy_noalignment.S b/sysdeps/riscv/multiarch/memcpy_noalignment.S
index b912abe6d1..559e2b21e2 100644
--- a/sysdeps/riscv/multiarch/memcpy_noalignment.S
+++ b/sysdeps/riscv/multiarch/memcpy_noalignment.S
@@ -19,6 +19,7 @@
 #include <sysdep.h>
 #include <sys/asm.h>
 
+#if IS_IN(libc)
 /* memcpy optimization for CPUs with fast unaligned support
    (RISCV_HWPROBE_MISALIGNED_FAST).
 
@@ -31,7 +32,7 @@
 
    The tail is handled with branchless copies.  */
 
-#define BLOCK_SIZE (16 * SZREG)
+# define BLOCK_SIZE (16 * SZREG)
 
 	.attribute unaligned_access, 1
 ENTRY (__memcpy_noalignment)
@@ -156,3 +157,5 @@ L(word_copy_adjust):
 	mv	a3, a5
 	j	L(word_copy)
 END (__memcpy_noalignment)
+
+#endif
-- 
2.47.2



More information about the Libc-alpha mailing list