[PATCH 11/11] Prevent turning memset into self-recursion
Aleksandar Rakic
rakicaleksandar1999@gmail.com
Thu Jan 23 13:43:07 GMT 2025
Prevent GCC 11 from turning memset into self-recursion.
GCC11 transforms byte-by-byte set loop pattern in memset.c into
a memset call, causing runtime failures. Apply -fno-builtin for
both the memset.c and memcpy.c to prevent similar bugs in future.
Cherry-picked 31906b3556bc18cfdb7a3d84a669d95486450704
from https://github.com/MIPS/glibc
Signed-off-by: Dragan Mladjenovic <dragan.mladjenovic@syrmia.com>
Signed-off-by: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>
---
sysdeps/mips/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
index 17ddc2a97c..4464d73902 100644
--- a/sysdeps/mips/Makefile
+++ b/sysdeps/mips/Makefile
@@ -24,6 +24,9 @@ ASFLAGS-.o += $(pie-default)
ASFLAGS-.op += $(pie-default)
ASFLAGS += -O2
+CFLAGS-memset.c += -fno-builtin
+CFLAGS-memcpy.c += -fno-builtin
+
ifeq ($(subdir),elf)
# These tests fail on all mips configurations (BZ 29404)
--
2.34.1
More information about the Libc-alpha
mailing list