xref: /freebsd/lib/libc/tests/ssp/Makefile (revision b1e20a1db5819338dd2af0226af90de8a7045866)
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
13*b1e20a1dSBryan 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
344d871c1eSSean Bruno.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
35ff44c538SEnji Cooper.if ${COMPILER_TYPE} == "clang"
36ff44c538SEnji Cooper.if ${COMPILER_VERSION} < 30500 || 30700 <= ${COMPILER_VERSION}
372f121787SEnji CooperPROGS+=		h_raw
3897e4ab09SEnji Cooper.endif
39ff44c538SEnji Cooper.endif
404d871c1eSSean Bruno.endif
412f121787SEnji CooperPROGS+=		h_read
422f121787SEnji CooperPROGS+=		h_readlink
432f121787SEnji CooperPROGS+=		h_snprintf
442f121787SEnji CooperPROGS+=		h_sprintf
452f121787SEnji CooperPROGS+=		h_stpcpy
462f121787SEnji CooperPROGS+=		h_stpncpy
472f121787SEnji CooperPROGS+=		h_strcat
482f121787SEnji CooperPROGS+=		h_strcpy
492f121787SEnji CooperPROGS+=		h_strncat
502f121787SEnji CooperPROGS+=		h_strncpy
512f121787SEnji CooperPROGS+=		h_vsnprintf
522f121787SEnji CooperPROGS+=		h_vsprintf
532f121787SEnji Cooper
542f121787SEnji Cooper.include "../Makefile.netbsd-tests"
552f121787SEnji Cooper
562f121787SEnji Cooper.include <bsd.test.mk>
57