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