xref: /freebsd/lib/libc/tests/ssp/Makefile (revision 2830819497fb2deae3dd71574592ace55f2fbdba)
1# $FreeBSD$
2
3.include <bsd.own.mk>
4
5NO_WERROR=
6WARNS?=	2
7
8CFLAGS.h_raw+=	-fstack-protector-all -Wstack-protector
9.if ${COMPILER_TYPE} == "clang"
10CFLAGS.h_raw+=	-fsanitize=bounds
11.elif ${COMPILER_TYPE} == "gcc"
12CFLAGS.h_raw+=	--param ssp-buffer-size=1
13DPADD+=		${LIBSSP}
14LDADD+=		-lssp
15.endif
16
17NETBSD_ATF_TESTS_SH=	ssp_test
18
19BINDIR=		${TESTSDIR}
20
21PROGS=		h_fgets
22PROGS+=		h_gets
23PROGS+=		h_getcwd
24PROGS+=		h_memcpy
25PROGS+=		h_memmove
26PROGS+=		h_memset
27# This testcase doesn't run properly when not compiled with -fsantize=bounds
28# with clang, which is currently contingent on a compiler_rt update
29#
30# XXX: the h_raw/h_read testcases don't cause a SIGABRT with in-tree gcc right
31# now on amd64 when it trips the stack bounds specified in t_ssp.sh . This
32# probably needs to be fixed as it's currently hardcoded.
33#
34# sanitizer is not tested or supported for ARM right now. sbruno
35.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
36.if ${COMPILER_TYPE} == "clang"
37.if ${COMPILER_VERSION} < 30500 || 30700 <= ${COMPILER_VERSION}
38PROGS+=		h_raw
39.endif
40.endif
41.endif
42PROGS+=		h_read
43PROGS+=		h_readlink
44PROGS+=		h_snprintf
45PROGS+=		h_sprintf
46PROGS+=		h_stpcpy
47PROGS+=		h_stpncpy
48PROGS+=		h_strcat
49PROGS+=		h_strcpy
50PROGS+=		h_strncat
51PROGS+=		h_strncpy
52PROGS+=		h_vsnprintf
53PROGS+=		h_vsprintf
54
55.include "../Makefile.netbsd-tests"
56
57.include <bsd.test.mk>
58