Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/string for GCC, built memset.c with -fno-builtin. ...



details:   https://anonhg.NetBSD.org/src/rev/14cb264038a7
branches:  trunk
changeset: 982470:14cb264038a7
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Apr 14 08:07:49 2021 +0000

description:
for GCC, built memset.c with -fno-builtin.  this avoids GCC 10 compiling
memset() and emitting calls to memset() where it seems code that looks
like what memset() does, which ends up recursing and blowing the stack.

this makes mips userland with GCC 10 work.

diffstat:

 lib/libc/string/Makefile.inc |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 4e3d75b927d0 -r 14cb264038a7 lib/libc/string/Makefile.inc
--- a/lib/libc/string/Makefile.inc      Wed Apr 14 07:56:23 2021 +0000
+++ b/lib/libc/string/Makefile.inc      Wed Apr 14 08:07:49 2021 +0000
@@ -1,5 +1,5 @@
 #      from: @(#)Makefile.inc  8.1 (Berkeley) 6/4/93
-#      $NetBSD: Makefile.inc,v 1.84 2020/03/25 18:45:42 kre Exp $
+#      $NetBSD: Makefile.inc,v 1.85 2021/04/14 08:07:49 mrg Exp $
 
 # string sources
 .PATH: ${ARCHDIR}/string ${.CURDIR}/string
@@ -34,6 +34,12 @@
 CPPFLAGS.wcsncmp.c+=   -I${LIBCDIR}/locale
 CPPFLAGS.wmemcmp.c+=   -I${LIBCDIR}/locale
 
+# Avoid memset() compilation generating calls to memset() via code
+# that appears to implement memset()-like semantics (similar to how
+# printf("foo") may be converted to puts("foo")), since that tends
+# to recurse and blow the stack.
+COPTS.memset.c+=       ${${ACTIVE_CC} == "gcc":? -fno-builtin :}
+
 .include "${ARCHDIR}/string/Makefile.inc"
 
 MAN+=  bm.3 bcmp.3 bcopy.3 bstring.3 bzero.3 consttime_memequal.3 \



Home | Main Index | Thread Index | Old Index