1274075Sngie# $FreeBSD: stable/11/lib/libc/tests/ssp/Makefile 367315 2020-11-03 23:30:11Z brooks $ 2274075Sngie 3274075Sngie.include <bsd.own.mk> 4274075Sngie 5274075SngieNO_WERROR= 6274075SngieWARNS?= 2 7274075Sngie 8274075SngieCFLAGS.h_raw+= -fstack-protector-all -Wstack-protector 9367062Sbrooks.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" 10367062Sbrooks# Only use -fsanitize=bounds when using the in-tree compiler. Otherwise 11367062Sbrooks# we may link to a sanitizer library targeted at a newer kernel/libc. 12274075SngieCFLAGS.h_raw+= -fsanitize=bounds 13274075Sngie.elif ${COMPILER_TYPE} == "gcc" 14274075SngieCFLAGS.h_raw+= --param ssp-buffer-size=1 15291864SbdreweryLDADD+= -lssp 16274075Sngie.endif 17274075Sngie 18274075SngieNETBSD_ATF_TESTS_SH= ssp_test 19274075Sngie 20274075SngieBINDIR= ${TESTSDIR} 21274075Sngie 22274075SngiePROGS= h_fgets 23274075SngiePROGS+= h_gets 24274075SngiePROGS+= h_getcwd 25274075SngiePROGS+= h_memcpy 26274075SngiePROGS+= h_memmove 27274075SngiePROGS+= h_memset 28276527Sngie# This testcase doesn't run properly when not compiled with -fsantize=bounds 29276527Sngie# with clang, which is currently contingent on a compiler_rt update 30290185Sngie# 31290185Sngie# XXX: the h_raw/h_read testcases don't cause a SIGABRT with in-tree gcc right 32290185Sngie# now on amd64 when it trips the stack bounds specified in t_ssp.sh . This 33290185Sngie# probably needs to be fixed as it's currently hardcoded. 34290200Ssbruno# 35290200Ssbruno# sanitizer is not tested or supported for ARM right now. sbruno 36367315Sbrooks.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" && !defined(_SKIP_BUILD) && \ 37337473Sbdrewery (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw") 38337473Sbdrewery.if !defined(_CLANG_RESOURCE_DIR) 39337473Sbdrewery_CLANG_RESOURCE_DIR!= ${CC:N${CCACHE_BIN}} -print-resource-dir 40337473Sbdrewery.export _CLANG_RESOURCE_DIR 41337473Sbdrewery.endif 42337473Sbdrewery_libclang_rt_arch= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/} 43337473Sbdrewery_libclang_rt_ubsan= ${_CLANG_RESOURCE_DIR}/lib/freebsd/libclang_rt.ubsan_standalone-${_libclang_rt_arch}.a 44337473Sbdrewery.if exists(${_libclang_rt_ubsan}) 45274075SngiePROGS+= h_raw 46276527Sngie.endif 47290185Sngie.endif 48274075SngiePROGS+= h_read 49274075SngiePROGS+= h_readlink 50274075SngiePROGS+= h_snprintf 51274075SngiePROGS+= h_sprintf 52274075SngiePROGS+= h_stpcpy 53274075SngiePROGS+= h_stpncpy 54274075SngiePROGS+= h_strcat 55274075SngiePROGS+= h_strcpy 56274075SngiePROGS+= h_strncat 57274075SngiePROGS+= h_strncpy 58274075SngiePROGS+= h_vsnprintf 59274075SngiePROGS+= h_vsprintf 60274075Sngie 61274075Sngie.include "../Makefile.netbsd-tests" 62274075Sngie 63274075Sngie.include <bsd.test.mk> 64