xref: /freebsd/lib/libc/tests/ssp/Makefile (revision 783d3ff6d7fae619db8a7990b8a6387de0c677b5)
1
2.include <bsd.own.mk>
3
4MK_WERROR=	no
5WARNS?=	2
6
7CFLAGS.h_raw+=	-fstack-protector-all -Wstack-protector
8.if ${COMPILER_TYPE} == "clang"
9# Only use -fsanitize=bounds when using clang. Otherwise we are not able to
10# override the sanitizer runtime libraries to be the ones installed on the
11# target system.
12CFLAGS.h_raw+=	-fsanitize=bounds
13LIBADD+=sys
14.elif ${COMPILER_TYPE} == "gcc"
15CFLAGS.h_raw+=	--param ssp-buffer-size=1
16LDADD+=	-lssp
17.endif
18
19NETBSD_ATF_TESTS_SH=	ssp_test
20
21BINDIR=		${TESTSDIR}
22
23PROGS=		h_fgets
24PROGS+=		h_gets
25PROGS+=		h_getcwd
26PROGS+=		h_memcpy
27PROGS+=		h_memmove
28PROGS+=		h_memset
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.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \
33    (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw")
34.include "${SRCTOP}/lib/libclang_rt/compiler-rt-vars.mk"
35_libclang_rt_ubsan=	${SYSROOT}${SANITIZER_LIBDIR}/libclang_rt.ubsan_standalone-${CRTARCH}.a
36.if exists(${_libclang_rt_ubsan})
37PROGS+=		h_raw
38LDADD.h_raw+=	${SANITIZER_LDFLAGS}
39.else
40.if make(all)
41.info Could not find runtime library ${_libclang_rt_ubsan}, skipping 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