xref: /freebsd/lib/libc/tests/ssp/Makefile (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
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
13.elif ${COMPILER_TYPE} == "gcc"
14CFLAGS.h_raw+=	--param ssp-buffer-size=1
15LDADD+=	-lssp
16.endif
17
18NETBSD_ATF_TESTS_SH=	ssp_test
19
20BINDIR=		${TESTSDIR}
21
22PROGS=		h_fgets
23PROGS+=		h_gets
24PROGS+=		h_getcwd
25PROGS+=		h_memcpy
26PROGS+=		h_memmove
27PROGS+=		h_memset
28# XXX: the h_raw/h_read testcases don't cause a SIGABRT with in-tree gcc right
29# now on amd64 when it trips the stack bounds specified in t_ssp.sh . This
30# probably needs to be fixed as it's currently hardcoded.
31.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \
32    (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw")
33.include "${SRCTOP}/lib/libclang_rt/compiler-rt-vars.mk"
34_libclang_rt_ubsan=	${SYSROOT}${SANITIZER_LIBDIR}/libclang_rt.ubsan_standalone-${CRTARCH}.a
35.if exists(${_libclang_rt_ubsan})
36PROGS+=		h_raw
37LDADD.h_raw+=	${SANITIZER_LDFLAGS}
38.else
39.if make(all)
40.info Could not find runtime library ${_libclang_rt_ubsan}, skipping h_raw
41.endif
42.endif
43.endif
44PROGS+=		h_read
45PROGS+=		h_readlink
46PROGS+=		h_snprintf
47PROGS+=		h_sprintf
48PROGS+=		h_stpcpy
49PROGS+=		h_stpncpy
50PROGS+=		h_strcat
51PROGS+=		h_strcpy
52PROGS+=		h_strncat
53PROGS+=		h_strncpy
54PROGS+=		h_vsnprintf
55PROGS+=		h_vsprintf
56
57.include "../Makefile.netbsd-tests"
58
59.include <bsd.test.mk>
60