We don't want to set these globally via the normal CFLAGS, because if
we did, AddressSanitizer would catch test-segfault deliberately
segfaulting, and "helpfully" turn it into exit status 1, which in turn
makes our test fail because it asserts that the segfault is reported
as a segfault.
A typical use with gcc as compiler, on a reasonably recent Debian,
would be:
./configure SANITIZE_CFLAGS="-fsanitize=address -fsanitize=undefined -fPIE -pie"
Signed-off-by: Simon McVittie <smcv@collabora.com>
AM_CFLAGS = \
$(CODE_COVERAGE_CFLAGS) \
+ $(SANITIZE_CFLAGS) \
$(NULL)
EFENCE=
CXXFLAGS="$EXTRA_CXXFLAGS $CXXFLAGS"
LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
+AC_ARG_VAR([SANITIZE_CFLAGS],
+ [Extra CFLAGS for modules that are instrumented for error-checking])
+
case $host_os in
solaris*)
# Solaris' C library apparently needs these runes to be threadsafe...
AM_CFLAGS = \
$(CODE_COVERAGE_CFLAGS) \
+ $(SANITIZE_CFLAGS) \
$(NULL)
if HAVE_VISIBILITY
AM_CFLAGS = \
$(CODE_COVERAGE_CFLAGS) \
+ $(SANITIZE_CFLAGS) \
$(NULL)
noinst_LTLIBRARIES = libdbus-testutils.la
noinst_PROGRAMS= $(TEST_BINARIES)
+# This helper is meant to crash, so if we're compiling the rest with
+# AddressSanitizer, we need to stop it from catching the SIGSEGV and
+# turning it into _exit(1); so don't give it SANITIZE_CFLAGS.
+# CODE_COVERAGE_CFLAGS are fairly pointless here, too.
+test_segfault_CFLAGS =
+
test_service_LDADD = libdbus-testutils.la
test_names_LDADD = libdbus-testutils.la
## break_loader_LDADD = $(top_builddir)/dbus/libdbus-internal.la
AM_CFLAGS = \
$(CODE_COVERAGE_CFLAGS) \
+ $(SANITIZE_CFLAGS) \
$(NULL)
# if assertions are enabled, improve backtraces
AM_CFLAGS = \
$(CODE_COVERAGE_CFLAGS) \
+ $(SANITIZE_CFLAGS) \
$(NULL)
# if assertions are enabled, improve backtraces