Module Name:    src
Committed By:   kamil
Date:           Thu Aug 15 08:46:09 UTC 2019

Modified Files:
        src/tests/kernel: Makefile

Log Message:
Adapt tests/kernel/t_subr_prf for MKSANITIZER

Allow to rename snprintf-like functions to avoid clashes with a sanitizer.

This tests needs a fixup to remove 'undef symbol' from the test code
generator.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/tests/kernel/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.60 src/tests/kernel/Makefile:1.61
--- src/tests/kernel/Makefile:1.60	Fri Jun  7 21:18:16 2019
+++ src/tests/kernel/Makefile	Thu Aug 15 08:46:09 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.60 2019/06/07 21:18:16 christos Exp $
+# $NetBSD: Makefile,v 1.61 2019/08/15 08:46:09 kamil Exp $
 
 NOMAN=		# defined
 
@@ -66,6 +66,11 @@ CPPFLAGS.subr_extent.c=	-D_EXTENT_TESTIN
 
 t_subr_prf.c: gen_t_subr_prf ${NETBSDSRCDIR}/sys/kern/subr_prf.c
 	${HOST_SH} ${.ALLSRC} ${.TARGET}
+.if ${MKSANITIZER:Uno} == "yes"
+	# These symbols will be redefined by MKSANITIZER
+	${TOOL_SED} -i '/undef .*printf/d' ${.TARGET}
+.endif
+
 CPPFLAGS.t_subr_prf.c=	-Wno-pointer-sign	# XXX platform vs kernel SHA2
 
 .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
@@ -73,6 +78,14 @@ CPPFLAGS.t_subr_prf.c=	-Wno-pointer-sign
 CPPFLAGS.t_subr_prf.c+=	-Wno-error=format-truncation
 .endif
 
+SANITIZER_RENAME_CLASSES+=		t_subr_prf
+SANITIZER_RENAME_FILES.t_subr_prf+=	t_subr_prf.c
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=	snprintf
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=	vsnprintf
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=	sprintf
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=	vsnprintf
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=	vasprintf
+
 CLEANFILES+=	t_subr_prf.c
 
 LDADD.h_segv+=	-lm

Reply via email to