12f121787SEnji Cooper# $FreeBSD$ 22f121787SEnji Cooper 32f121787SEnji Cooper.include <bsd.own.mk> 42f121787SEnji Cooper 57fa2f2a6SAlex RichardsonMK_WERROR= no 62f121787SEnji CooperWARNS?= 2 72f121787SEnji Cooper 82f121787SEnji CooperCFLAGS.h_raw+= -fstack-protector-all -Wstack-protector 9*fe525d3fSAlex Richardson.if ${COMPILER_TYPE} == "clang" 10*fe525d3fSAlex Richardson# Only use -fsanitize=bounds when using clang. Otherwise we are not able to 11*fe525d3fSAlex Richardson# override the sanitizer runtime libraries to be the ones installed on the 12*fe525d3fSAlex Richardson# target system. 132f121787SEnji CooperCFLAGS.h_raw+= -fsanitize=bounds 142f121787SEnji Cooper.elif ${COMPILER_TYPE} == "gcc" 152f121787SEnji CooperCFLAGS.h_raw+= --param ssp-buffer-size=1 16b1e20a1dSBryan DreweryLDADD+= -lssp 172f121787SEnji Cooper.endif 182f121787SEnji Cooper 192f121787SEnji CooperNETBSD_ATF_TESTS_SH= ssp_test 202f121787SEnji Cooper 212f121787SEnji CooperBINDIR= ${TESTSDIR} 222f121787SEnji Cooper 232f121787SEnji CooperPROGS= h_fgets 242f121787SEnji CooperPROGS+= h_gets 252f121787SEnji CooperPROGS+= h_getcwd 262f121787SEnji CooperPROGS+= h_memcpy 272f121787SEnji CooperPROGS+= h_memmove 282f121787SEnji CooperPROGS+= h_memset 29ff44c538SEnji Cooper# XXX: the h_raw/h_read testcases don't cause a SIGABRT with in-tree gcc right 30ff44c538SEnji Cooper# now on amd64 when it trips the stack bounds specified in t_ssp.sh . This 31ff44c538SEnji Cooper# probably needs to be fixed as it's currently hardcoded. 32*fe525d3fSAlex Richardson.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \ 33f272627fSBryan Drewery (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw") 34*fe525d3fSAlex Richardson.include "${SRCTOP}/lib/libclang_rt/compiler-rt-vars.mk" 35*fe525d3fSAlex Richardson_libclang_rt_ubsan= ${SYSROOT}${SANITIZER_LIBDIR}/libclang_rt.ubsan_standalone-${CRTARCH}.a 36f272627fSBryan Drewery.if exists(${_libclang_rt_ubsan}) 372f121787SEnji CooperPROGS+= h_raw 38*fe525d3fSAlex RichardsonLDADD.h_raw+= ${SANITIZER_LDFLAGS} 39*fe525d3fSAlex Richardson.else 40*fe525d3fSAlex Richardson.if make(all) 41*fe525d3fSAlex Richardson.info "Could not find runtime library ${_libclang_rt_ubsan}, skipping h_raw" 42*fe525d3fSAlex Richardson.endif 43ff44c538SEnji Cooper.endif 444d871c1eSSean Bruno.endif 452f121787SEnji CooperPROGS+= h_read 462f121787SEnji CooperPROGS+= h_readlink 472f121787SEnji CooperPROGS+= h_snprintf 482f121787SEnji CooperPROGS+= h_sprintf 492f121787SEnji CooperPROGS+= h_stpcpy 502f121787SEnji CooperPROGS+= h_stpncpy 512f121787SEnji CooperPROGS+= h_strcat 522f121787SEnji CooperPROGS+= h_strcpy 532f121787SEnji CooperPROGS+= h_strncat 542f121787SEnji CooperPROGS+= h_strncpy 552f121787SEnji CooperPROGS+= h_vsnprintf 562f121787SEnji CooperPROGS+= h_vsprintf 572f121787SEnji Cooper 582f121787SEnji Cooper.include "../Makefile.netbsd-tests" 592f121787SEnji Cooper 602f121787SEnji Cooper.include <bsd.test.mk> 61