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