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