xref: /freebsd/lib/libc/tests/ssp/Makefile (revision f272627fcd3720f6f5fd3deb4ffb8f978516688a)
12f121787SEnji Cooper# $FreeBSD$
22f121787SEnji Cooper
32f121787SEnji Cooper.include <bsd.own.mk>
42f121787SEnji Cooper
52f121787SEnji CooperNO_WERROR=
62f121787SEnji CooperWARNS?=	2
72f121787SEnji Cooper
82f121787SEnji CooperCFLAGS.h_raw+=	-fstack-protector-all -Wstack-protector
92f121787SEnji Cooper.if ${COMPILER_TYPE} == "clang"
102f121787SEnji CooperCFLAGS.h_raw+=	-fsanitize=bounds
112f121787SEnji Cooper.elif ${COMPILER_TYPE} == "gcc"
122f121787SEnji CooperCFLAGS.h_raw+=	--param ssp-buffer-size=1
13b1e20a1dSBryan DreweryLDADD+=	-lssp
142f121787SEnji Cooper.endif
152f121787SEnji Cooper
162f121787SEnji CooperNETBSD_ATF_TESTS_SH=	ssp_test
172f121787SEnji Cooper
182f121787SEnji CooperBINDIR=		${TESTSDIR}
192f121787SEnji Cooper
202f121787SEnji CooperPROGS=		h_fgets
212f121787SEnji CooperPROGS+=		h_gets
222f121787SEnji CooperPROGS+=		h_getcwd
232f121787SEnji CooperPROGS+=		h_memcpy
242f121787SEnji CooperPROGS+=		h_memmove
252f121787SEnji CooperPROGS+=		h_memset
2697e4ab09SEnji Cooper# This testcase doesn't run properly when not compiled with -fsantize=bounds
2797e4ab09SEnji Cooper# with clang, which is currently contingent on a compiler_rt update
28ff44c538SEnji Cooper#
29ff44c538SEnji Cooper# XXX: the h_raw/h_read testcases don't cause a SIGABRT with in-tree gcc right
30ff44c538SEnji Cooper# now on amd64 when it trips the stack bounds specified in t_ssp.sh . This
31ff44c538SEnji Cooper# probably needs to be fixed as it's currently hardcoded.
324d871c1eSSean Bruno#
334d871c1eSSean Bruno# sanitizer is not tested or supported for ARM right now. sbruno
34*f272627fSBryan Drewery.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \
35*f272627fSBryan Drewery    (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw")
36*f272627fSBryan Drewery.if !defined(_CLANG_RESOURCE_DIR)
37*f272627fSBryan Drewery_CLANG_RESOURCE_DIR!=	${CC:N${CCACHE_BIN}} -print-resource-dir
38*f272627fSBryan Drewery.export _CLANG_RESOURCE_DIR
39*f272627fSBryan Drewery.endif
40*f272627fSBryan Drewery_libclang_rt_arch=	${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}
41*f272627fSBryan Drewery_libclang_rt_ubsan=	${_CLANG_RESOURCE_DIR}/lib/freebsd/libclang_rt.ubsan_standalone-${_libclang_rt_arch}.a
42*f272627fSBryan Drewery.if exists(${_libclang_rt_ubsan})
432f121787SEnji CooperPROGS+=		h_raw
44ff44c538SEnji Cooper.endif
454d871c1eSSean Bruno.endif
462f121787SEnji CooperPROGS+=		h_read
472f121787SEnji CooperPROGS+=		h_readlink
482f121787SEnji CooperPROGS+=		h_snprintf
492f121787SEnji CooperPROGS+=		h_sprintf
502f121787SEnji CooperPROGS+=		h_stpcpy
512f121787SEnji CooperPROGS+=		h_stpncpy
522f121787SEnji CooperPROGS+=		h_strcat
532f121787SEnji CooperPROGS+=		h_strcpy
542f121787SEnji CooperPROGS+=		h_strncat
552f121787SEnji CooperPROGS+=		h_strncpy
562f121787SEnji CooperPROGS+=		h_vsnprintf
572f121787SEnji CooperPROGS+=		h_vsprintf
582f121787SEnji Cooper
592f121787SEnji Cooper.include "../Makefile.netbsd-tests"
602f121787SEnji Cooper
612f121787SEnji Cooper.include <bsd.test.mk>
62