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