Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Honor ``=no`` and ``--without-...`` for the AddressSanitizer,
MemorySanitizer, UndefinedBehaviorSanitizer, and ThreadSanitizer configure
options without adding sanitizer flags or changing the pymalloc setting.
86 changes: 54 additions & 32 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 18 additions & 20 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3519,14 +3519,14 @@ AC_MSG_CHECKING([for --with-address-sanitizer])
AC_ARG_WITH([address_sanitizer],
AS_HELP_STRING([--with-address-sanitizer],
[enable AddressSanitizer memory error detector, 'asan' (default is no)]),
[
AC_MSG_RESULT([$withval])
[], [with_address_sanitizer=no])
AC_MSG_RESULT([$with_address_sanitizer])
AS_VAR_IF([with_address_sanitizer], [no], [], [
BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
LDFLAGS="-fsanitize=address $LDFLAGS"
# ASan works by controlling memory allocation, our own malloc interferes.
with_pymalloc="no"
],
[AC_MSG_RESULT([no])])
])

AC_MSG_CHECKING([for --with-memory-sanitizer])
AC_ARG_WITH(
Expand All @@ -3535,16 +3535,16 @@ AC_ARG_WITH(
[--with-memory-sanitizer],
[enable MemorySanitizer allocation error detector, 'msan' (default is no)]
)],
[
AC_MSG_RESULT([$withval])
[], [with_memory_sanitizer=no])
AC_MSG_RESULT([$with_memory_sanitizer])
AS_VAR_IF([with_memory_sanitizer], [no], [], [
AX_CHECK_COMPILE_FLAG([-fsanitize=memory],[
BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS"
LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS"
],[AC_MSG_ERROR([The selected compiler doesn't support memory sanitizer])])
# MSan works by controlling memory allocation, our own malloc interferes.
with_pymalloc="no"
],
[AC_MSG_RESULT([no])])
])

AC_MSG_CHECKING([for --with-undefined-behavior-sanitizer])
AC_ARG_WITH(
Expand All @@ -3553,15 +3553,14 @@ AC_ARG_WITH(
[--with-undefined-behavior-sanitizer],
[enable UndefinedBehaviorSanitizer undefined behaviour detector, 'ubsan' (default is no)]
)],
[
AC_MSG_RESULT([$withval])
[], [with_undefined_behavior_sanitizer=no])
AC_MSG_RESULT([$with_undefined_behavior_sanitizer])
AS_VAR_IF([with_undefined_behavior_sanitizer], [no], [
with_ubsan="no"
], [
BASECFLAGS="-fsanitize=undefined $BASECFLAGS"
LDFLAGS="-fsanitize=undefined $LDFLAGS"
with_ubsan="yes"
],
[
AC_MSG_RESULT([no])
with_ubsan="no"
])

AC_MSG_CHECKING([for --with-thread-sanitizer])
Expand All @@ -3571,15 +3570,14 @@ AC_ARG_WITH(
[--with-thread-sanitizer],
[enable ThreadSanitizer data race detector, 'tsan' (default is no)]
)],
[
AC_MSG_RESULT([$withval])
[], [with_thread_sanitizer=no])
AC_MSG_RESULT([$with_thread_sanitizer])
AS_VAR_IF([with_thread_sanitizer], [no], [
with_tsan="no"
], [
BASECFLAGS="-fsanitize=thread $BASECFLAGS"
LDFLAGS="-fsanitize=thread $LDFLAGS"
with_tsan="yes"
],
[
AC_MSG_RESULT([no])
with_tsan="no"
])

# Set info about shared libraries.
Expand Down
Loading