xref: /freebsd/lib/libclang_rt/compiler-rt-vars.mk (revision c7a063741720ef81d4caa4613242579d12f1d605)
1CLANG_SUBDIR=clang/14.0.5
2CLANGDIR=	/usr/lib/${CLANG_SUBDIR}
3SANITIZER_LIBDIR=		${CLANGDIR}/lib/freebsd
4SANITIZER_SHAREDIR=		${CLANGDIR}/share
5
6# armv[67] is a bit special since we allow a soft-floating version via
7# CPUTYPE matching *soft*. This variant may not actually work though.
8.if ${MACHINE_ARCH:Marmv[67]*} != "" && \
9    (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
10CRTARCH?=	armhf
11.else
12CRTARCH?=	${MACHINE_ARCH:S/amd64/x86_64/:C/sf$//}
13.endif
14
15.if ${COMPILER_TYPE} == "clang"
16# The only way to set the path to the sanitizer libraries with clang is to
17# override the resource directory.
18# Note: lib/freebsd is automatically appended to the -resource-dir value.
19SANITIZER_LDFLAGS+=	-resource-dir=${SYSROOT}${CLANGDIR}
20# Also set RPATH to ensure that the dynamically linked runtime libs are found.
21SANITIZER_LDFLAGS+=	-Wl,--enable-new-dtags
22SANITIZER_LDFLAGS+=	-Wl,-rpath,${SANITIZER_LIBDIR}
23.elif ${COMPILER_TYPE} != "none"
24# This file can be included with COMPILER_TYPE=none during the cleandir phase,
25# only emit an error when trying to compile with an unsupported compiler such
26# as GCC.
27.error "Unknown link flags for -fsanitize=... COMPILER_TYPE=${COMPILER_TYPE}"
28.endif
29