xref: /freebsd/lib/libc/tests/ssp/Makefile (revision 389e4940069316fe667ffa263fa7d6390d0a960f)
1# $FreeBSD$
2
3# XXX This is a workaround to allow i386 to cross-compile on an amd64 host.
4.include <host-target.mk>
5# XXX ---
6
7.include <bsd.own.mk>
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" && ${MK_TOOLCHAIN} == "yes"
40.if ${COMPILER_VERSION} < 30500 || 30700 <= ${COMPILER_VERSION}
41
42# XXX This is a workaround to allow i386 to cross-compile on an amd64 host.
43.if ${MACHINE_CPUARCH} == ${_HOST_ARCH}
44# XXX ---
45
46PROGS+=		h_raw
47
48# XXX This is a workaround to allow i386 to cross-compile on an amd64 host.
49.endif
50# XXX ---
51
52.endif
53.endif
54.endif
55PROGS+=		h_read
56PROGS+=		h_readlink
57PROGS+=		h_snprintf
58PROGS+=		h_sprintf
59PROGS+=		h_stpcpy
60PROGS+=		h_stpncpy
61PROGS+=		h_strcat
62PROGS+=		h_strcpy
63PROGS+=		h_strncat
64PROGS+=		h_strncpy
65PROGS+=		h_vsnprintf
66PROGS+=		h_vsprintf
67
68.include "../Makefile.netbsd-tests"
69
70.include <bsd.test.mk>
71