1 # $NetBSD: Makefile,v 1.3.4.1 2019/08/16 19:14:29 martin Exp $ 2 3 .include <bsd.own.mk> 4 5 TESTSDIR= ${TESTSBASE}/lib/libc/misc 6 7 TESTS_C+= t_ubsan 8 TESTS_CXX+= t_ubsanxx 9 10 .PATH: ${NETBSDSRCDIR}/common/lib/libc/misc 11 SRCS.t_ubsan= t_ubsan.c 12 SRCS.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. 17 CPPFLAGS+= -DENABLE_TESTS 18 SRCS.t_ubsan+= ubsan.c 19 SRCS.t_ubsanxx+= ubsan.c 20 UBSAN_FLAGS= -fsanitize=undefined 21 UBSAN_FLAGS+= ${${ACTIVE_CC} == "clang" :? -fsanitize=integer :} 22 UBSAN_FLAGS+= ${${ACTIVE_CC} == "clang" :? -fsanitize=nullability :} 23 CFLAGS+= ${UBSAN_FLAGS} 24 CXXFLAGS+= ${UBSAN_FLAGS} 25 CWARNFLAGS+= -Wno-return-type -Wno-strict-aliasing 26 CWARNFLAGS.clang+= -Wno-incompatible-pointer-types-discards-qualifiers 27 CWARNFLAGS.clang+= -Wno-nullability-completeness 28 .endif 29 COPTS.t_ubsan.c += -Wno-stack-protector 30 COPTS.t_ubsanxx.cpp += -Wno-stack-protector 31 32 .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc" 33 COPTS.t_ubsan.c+= -Wno-int-in-bool-context 34 COPTS.t_ubsanxx.cpp+= -Wno-int-in-bool-context 35 .endif 36 37 .include <bsd.test.mk> 38