Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

#	$NetBSD: Makefile.sanitizer,v 1.7 2019/02/06 04:00:43 mrg Exp $

SANITIZER=${GCCDIST}/libsanitizer
.PATH: ${SANITIZER}/interception ${SANITIZER}/sanitizer_common

INTERCEPTION_SRCS= \
interception_linux.cc \
interception_mac.cc \
interception_type_test.cc \
interception_win.cc

SANITIZER_SRCS+= \
	sanitizer_allocator.cc \
	sanitizer_common.cc \
	sanitizer_common_libcdep.cc \
	sanitizer_coverage_libcdep.cc \
	sanitizer_coverage_mapping_libcdep.cc \
	sanitizer_deadlock_detector1.cc \
	sanitizer_deadlock_detector2.cc \
	sanitizer_flags.cc \
	sanitizer_flag_parser.cc \
	sanitizer_libc.cc \
	sanitizer_libignore.cc \
	sanitizer_linux.cc \
	sanitizer_linux_libcdep.cc \
	sanitizer_linux_s390.cc \
	sanitizer_mac.cc \
	sanitizer_persistent_allocator.cc \
	sanitizer_platform_limits_linux.cc \
	sanitizer_platform_limits_posix.cc \
	sanitizer_posix.cc \
	sanitizer_posix_libcdep.cc \
	sanitizer_printf.cc \
	sanitizer_procmaps_common.cc \
	sanitizer_procmaps_freebsd.cc \
	sanitizer_procmaps_netbsd.cc \
	sanitizer_procmaps_linux.cc \
	sanitizer_procmaps_mac.cc \
	sanitizer_stackdepot.cc \
	sanitizer_stacktrace.cc \
	sanitizer_stacktrace_libcdep.cc \
	sanitizer_symbolizer_mac.cc \
	sanitizer_stacktrace_printer.cc \
	sanitizer_stoptheworld_linux_libcdep.cc \
	sanitizer_suppressions.cc \
	sanitizer_symbolizer.cc \
	sanitizer_symbolizer_libbacktrace.cc \
	sanitizer_symbolizer_libcdep.cc \
	sanitizer_symbolizer_posix_libcdep.cc \
	sanitizer_symbolizer_win.cc \
	sanitizer_termination.cc \
	sanitizer_thread_registry.cc \
	sanitizer_tls_get_addr.cc \
	sanitizer_unwind_linux_libcdep.cc \
	sanitizer_win.cc

# The linux build does this to avoid preinit sections on shared libraries
CSHLIBFLAGS+= -DPIC

#SRCS+=	${INTERCEPTION_SRCS} ${SANITIZER_SRCS} ${UBSAN_SRCS}
SRCS+=	${INTERCEPTION_SRCS} ${SANITIZER_SRCS}
CPPFLAGS+=-I${SANITIZER}/include -I${SANITIZER}
CPPFLAGS.sanitizer_netbsd.cc+=-I${GCCDIST}/gcc/ginclude
CPPFLAGS+=-D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
CPPFLAGS+=-D__STDC_LIMIT_MACROS -DSANITIZER_HAS_EXCEPTIONS=1
CPPFLAGS+=-DSANITIZER_NEEDS_SEGV=1
#CPPFLAGS+=-DCAN_SANITIZE_UB=0

LIBDPLIBS+=    pthread ${.CURDIR}/../../../../../lib/libpthread
COPTS+=-std=gnu++11 -fsized-deallocation -fvisibility=hidden
COPTS+=-fno-builtin -fno-exceptions -fno-rtti -funwind-tables

# Can't profile without it`
#-fomit-frame-pointer

.if ${MACHINE_ARCH} == "vax"
COPTS.sanitizer_allocator.cc += -O1
COPTS.sanitizer_common.cc += -O1
COPTS.sanitizer_common_libcdep.cc += -O1
COPTS.sanitizer_coverage_libcdep.cc += -O1
COPTS.sanitizer_coverage_mapping_libcdep.cc += -O1
COPTS.sanitizer_deadlock_detector1.cc += -O1
COPTS.sanitizer_mac.cc += -O1
COPTS.sanitizer_netbsd.cc += -O1
COPTS.sanitizer_posix.cc += -O1
COPTS.sanitizer_printf.cc += -O1
COPTS.sanitizer_procmaps_common.cc += -O1
COPTS.sanitizer_stackdepot.cc += -O1
COPTS.sanitizer_symbolizer_libcdep.cc += -O1
COPTS.ubsan_diag.cc += -O1
COPTS.ubsan_init.cc += -O1
.endif