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