Makefile revision 1.10
1# $NetBSD: Makefile,v 1.10 2025/11/13 18:49:19 nia Exp $ 2 3.include <bsd.own.mk> 4 5TESTSDIR= ${TESTSBASE}/lib/libc/misc 6 7TESTS_C+= t_ubsan 8TESTS_CXX+= t_ubsanxx 9 10.if ${MACHINE_ARCH} == "sparc64" 11TESTS_C+= t_vis 12COPTS.t_vis.c+= -mvis 13.endif 14 15.PATH: ${NETBSDSRCDIR}/common/lib/libc/misc 16SRCS.t_ubsan= t_ubsan.c 17SRCS.t_ubsanxx= t_ubsanxx.cpp 18 19.if ${MKSANITIZER:Uno} != "yes" && ${MKLIBCSANITIZER:Uno} != "yes" 20# These tests are designed to be used against micro-UBSan only. 21# micro-UBSan is used in these tests as a standalone library only. 22CPPFLAGS+= -DENABLE_TESTS 23SRCS.t_ubsan+= ubsan.c 24SRCS.t_ubsanxx+= ubsan.c 25UBSAN_FLAGS= -fsanitize=undefined 26UBSAN_FLAGS+= ${${ACTIVE_CC} == "clang" :? -fsanitize=integer :} 27UBSAN_FLAGS+= ${${ACTIVE_CC} == "clang" :? -fsanitize=nullability :} 28CFLAGS+= ${UBSAN_FLAGS} 29CXXFLAGS+= ${UBSAN_FLAGS} 30CWARNFLAGS+= -Wno-return-type -Wno-strict-aliasing 31CWARNFLAGS.clang+= -Wno-incompatible-pointer-types-discards-qualifiers 32CWARNFLAGS.clang+= -Wno-nullability-completeness 33.endif 34COPTS.t_ubsan.c += -Wno-stack-protector 35COPTS.t_ubsanxx.cpp += -Wno-stack-protector 36COPTS.ubsan.c+= ${${ACTIVE_CC} == "clang" && ${MACHINE_ARCH} == "powerpc":? -O0 :} 37 38COPTS.t_ubsan.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-int-in-bool-context :} 39COPTS.t_ubsanxx.cpp+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-int-in-bool-context :} 40COPTS.t_ubsan.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-uninitialized :} 41COPTS.t_ubsanxx.cpp+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-uninitialized :} 42 43COPTS.ubsan.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -Wno-builtin-declaration-mismatch :} 44 45.include <bsd.test.mk> 46