xref: /freebsd/lib/libc/tests/ssp/Makefile (revision 67be1e195acfaec99ce4fffeb17111ce085755f7)
1.include <bsd.own.mk>
2
3MK_WERROR=	no
4WARNS?=	2
5
6CFLAGS.h_raw+=	-fstack-protector-all -Wstack-protector
7.if ${COMPILER_TYPE} == "clang"
8# Only use -fsanitize=bounds when using clang. Otherwise we are not able to
9# override the sanitizer runtime libraries to be the ones installed on the
10# target system.
11CFLAGS.h_raw+=	-fsanitize=bounds
12LIBADD+=sys
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    defined(MK_CLANG) && ${MK_CLANG} == "yes"
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