mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 22:32:30 +01:00
parent
ca34553b6f
commit
17d6371e4c
@ -15,10 +15,13 @@ CRTARCH?= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}
|
||||
# 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}
|
||||
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}
|
||||
.else
|
||||
.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
|
||||
|
@ -1,6 +1,5 @@
|
||||
.include <bsd.opts.mk>
|
||||
|
||||
.include "../../lib/libclang_rt/compiler-rt-vars.mk"
|
||||
_use_sanitizers= no
|
||||
# Add the necessary sanitizer flags if requested
|
||||
.if ${MK_ASAN} == "yes" && ${NO_SHARED:Uno:tl} == "no"
|
||||
@ -23,7 +22,7 @@ SANITIZER_LDFLAGS+= -fsanitize=undefined
|
||||
_use_sanitizers= yes
|
||||
.endif # ${MK_UBSAN} == "yes"
|
||||
|
||||
.if !defined(BOOTSTRAPPING) && ${_use_sanitizers} != 0 && \
|
||||
.if !defined(BOOTSTRAPPING) && ${_use_sanitizers} != "no" && \
|
||||
${COMPILER_TYPE} != "clang"
|
||||
.error "Sanitizer instrumentation currently only supported with clang"
|
||||
.endif
|
||||
@ -32,6 +31,7 @@ _use_sanitizers= yes
|
||||
# SHARED_CFLAGS instead of CFLAGS. We do this since static executables are not
|
||||
# compatible with the santizers (interceptors do not work).
|
||||
.if ${_use_sanitizers} != "no"
|
||||
.include "../../lib/libclang_rt/compiler-rt-vars.mk"
|
||||
.if target(__<bsd.lib.mk>__)
|
||||
SHARED_CFLAGS+= ${SANITIZER_CFLAGS}
|
||||
SOLINKOPTS+= ${SANITIZER_LDFLAGS}
|
||||
|
Loading…
Reference in New Issue
Block a user