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