freebsd-dev/lib/libclang_rt/Makefile.inc
Alex Richardson 7bc797e3f3 Add build system support for ASAN+UBSAN instrumentation
This adds two new options WITH_ASAN/WITH_UBSAN that can be set to
enable instrumentation of all binaries with AddressSanitizer and/or
UndefinedBehaviourSanitizer. This current patch is almost sufficient
to get a complete buildworld with sanitizer instrumentation but in
order to actually build and boot a system it depends on a few more
follow-up commits.

Reviewed By:	brooks, kib, markj
Differential Revision: https://reviews.freebsd.org/D31043
2021-08-02 14:33:24 +01:00

39 lines
747 B
Makefile

# $FreeBSD$
.include <bsd.compiler.mk>
CRTSRC= ${SRCTOP}/contrib/llvm-project/compiler-rt
.include "compiler-rt-vars.mk"
.PATH: ${CRTSRC}/lib
LIBDIR= ${SANITIZER_LIBDIR}
SHLIBDIR= ${LIBDIR}
NO_PIC=
MK_PROFILE= no
MK_ASAN:= no
MK_UBSAN:= no
WARNS?= 0
SSP_CFLAGS=
CFLAGS+= -DNDEBUG
CFLAGS+= -DHAVE_RPC_XDR_H=0
CFLAGS+= -DSANITIZER_SUPPORTS_WEAK_HOOKS=0
CFLAGS+= -DUBSAN_CAN_USE_CXXABI
CFLAGS+= ${PICFLAG}
CFLAGS+= -fno-builtin
CFLAGS+= -fno-exceptions
CXXFLAGS+= -fno-rtti
.if ${COMPILER_TYPE} == clang
CFLAGS+= -fno-sanitize=safe-stack
.endif
CFLAGS+= -fno-stack-protector
CFLAGS+= -funwind-tables
CXXFLAGS+= -fvisibility-inlines-hidden
CXXFLAGS+= -fvisibility=hidden
CFLAGS+= -I${CRTSRC}/include
CFLAGS+= -I${CRTSRC}/lib
CXXSTD= c++14