1*0fca6ea1SDimitry AndricCLANG_SUBDIR=clang/19 2fe525d3fSAlex RichardsonCLANGDIR= /usr/lib/${CLANG_SUBDIR} 3fe525d3fSAlex RichardsonSANITIZER_LIBDIR= ${CLANGDIR}/lib/freebsd 47b6f5ebeSDimitry AndricSANITIZER_SHAREDIR= ${CLANGDIR}/share 5fe525d3fSAlex Richardson 6fe525d3fSAlex Richardson# armv[67] is a bit special since we allow a soft-floating version via 7fe525d3fSAlex Richardson# CPUTYPE matching *soft*. This variant may not actually work though. 897dbe3e7SAndrew Turner.if ${MACHINE_CPUARCH} == "arm" && \ 9fe525d3fSAlex Richardson (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") 10fe525d3fSAlex RichardsonCRTARCH?= armhf 11fe525d3fSAlex Richardson.else 1210172ce3SJohn BaldwinCRTARCH?= ${MACHINE_ARCH:S/amd64/x86_64/} 13fe525d3fSAlex Richardson.endif 14fe525d3fSAlex Richardson 15fe525d3fSAlex Richardson.if ${COMPILER_TYPE} == "clang" 16fe525d3fSAlex Richardson# The only way to set the path to the sanitizer libraries with clang is to 17fe525d3fSAlex Richardson# override the resource directory. 18fe525d3fSAlex Richardson# Note: lib/freebsd is automatically appended to the -resource-dir value. 1917d6371eSAlex RichardsonSANITIZER_LDFLAGS+= -resource-dir=${SYSROOT}${CLANGDIR} 20fe525d3fSAlex Richardson# Also set RPATH to ensure that the dynamically linked runtime libs are found. 21fe525d3fSAlex RichardsonSANITIZER_LDFLAGS+= -Wl,--enable-new-dtags 22fe525d3fSAlex RichardsonSANITIZER_LDFLAGS+= -Wl,-rpath,${SANITIZER_LIBDIR} 2317d6371eSAlex Richardson.elif ${COMPILER_TYPE} != "none" 2417d6371eSAlex Richardson# This file can be included with COMPILER_TYPE=none during the cleandir phase, 2517d6371eSAlex Richardson# only emit an error when trying to compile with an unsupported compiler such 2617d6371eSAlex Richardson# as GCC. 27fe525d3fSAlex Richardson.error "Unknown link flags for -fsanitize=... COMPILER_TYPE=${COMPILER_TYPE}" 28fe525d3fSAlex Richardson.endif 29