freebsd-dev/lib/libclang_rt/compiler-rt-vars.mk
Dimitry Andric 7b6f5ebef6 Add several sanitizer ignore lists under /usr/lib/clang
Some of the sanitizers from compiler-rt can use ignore lists, which are
loosely modeled on valgrind's example. Upstream provides default lists
for AddressSanitizer, CFI, and MemorySanitizer, so install these in the
expected location, /usr/lib/clang/14.0.3/share.

Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D35338
2022-05-28 15:46:38 +02:00

29 lines
1.2 KiB
Makefile

CLANG_SUBDIR=clang/14.0.3
CLANGDIR= /usr/lib/${CLANG_SUBDIR}
SANITIZER_LIBDIR= ${CLANGDIR}/lib/freebsd
SANITIZER_SHAREDIR= ${CLANGDIR}/share
# armv[67] is a bit special since we allow a soft-floating version via
# CPUTYPE matching *soft*. This variant may not actually work though.
.if ${MACHINE_ARCH:Marmv[67]*} != "" && \
(!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
CRTARCH?= armhf
.else
CRTARCH?= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:C/sf$//:S/mipsn32/mips64/}
.endif
.if ${COMPILER_TYPE} == "clang"
# The only way to set the path to the sanitizer libraries with clang is to
# override the resource directory.
# Note: lib/freebsd is automatically appended to the -resource-dir value.
SANITIZER_LDFLAGS+= -resource-dir=${SYSROOT}${CLANGDIR}
# Also set RPATH to ensure that the dynamically linked runtime libs are found.
SANITIZER_LDFLAGS+= -Wl,--enable-new-dtags
SANITIZER_LDFLAGS+= -Wl,-rpath,${SANITIZER_LIBDIR}
.elif ${COMPILER_TYPE} != "none"
# This file can be included with COMPILER_TYPE=none during the cleandir phase,
# only emit an error when trying to compile with an unsupported compiler such
# as GCC.
.error "Unknown link flags for -fsanitize=... COMPILER_TYPE=${COMPILER_TYPE}"
.endif