Skip to content

gh-109575: Don't export -fsanitize compiler options #109576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include
PY_CPPFLAGS= $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
PY_LDFLAGS_NOLTO=$(PY_LDFLAGS) $(CONFIGURE_LDFLAGS_NOLTO) $(LDFLAGS_NODIST)
PY_LDFLAGS_NOLTO=$(PY_LDFLAGS) $(PY_LDFLAGS_NODIST) $(CONFIGURE_LDFLAGS_NOLTO)
NO_AS_NEEDED= @NO_AS_NEEDED@
CCSHARED= @CCSHARED@
# LINKFORSHARED are the flags passed to the $(CC) command that links
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
When Python is configured to use ASAN, MSAN or UBSAN sanitizer, with
``./configure --with-address-sanitizer`` for example, compiler and linker
flags for sanitizers are no longer exported to third party C extensions. Add
flags to ``CFLAGS_NODIST`` and ``LDFLAGS_NODIST``, instead of ``BASECFLAGS``
and ``LDFLAGS``. Patch by Victor Stinner.
12 changes: 6 additions & 6 deletions configure

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

12 changes: 6 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2997,8 +2997,8 @@ AC_ARG_WITH([address_sanitizer],
[enable AddressSanitizer memory error detector, 'asan' (default is no)]),
[
AC_MSG_RESULT([$withval])
BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
LDFLAGS="-fsanitize=address $LDFLAGS"
CFLAGS_NODIST="$CFLAGS_NODIST -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_NODIST="$LDFLAGS_NODIST -fsanitize=address"
# ASan works by controlling memory allocation, our own malloc interferes.
with_pymalloc="no"
],
Expand All @@ -3014,8 +3014,8 @@ AC_ARG_WITH(
[
AC_MSG_RESULT([$withval])
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"
CFLAGS_NODIST="$CFLAGS_NODIST -fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer"
LDFLAGS_NODIST="$LDFLAGS_NODIST -fsanitize=memory -fsanitize-memory-track-origins=2"
],[AC_MSG_ERROR([The selected compiler doesn't support memory sanitizer])])
# MSan works by controlling memory allocation, our own malloc interferes.
with_pymalloc="no"
Expand All @@ -3031,8 +3031,8 @@ AC_ARG_WITH(
)],
[
AC_MSG_RESULT([$withval])
BASECFLAGS="-fsanitize=undefined $BASECFLAGS"
LDFLAGS="-fsanitize=undefined $LDFLAGS"
CFLAGS_NODIST="$CFLAGS_NODIST -fsanitize=undefined"
LDFLAGS_NODIST="$LDFLAGS_NODIST -fsanitize=undefined"
with_ubsan="yes"
],
[
Expand Down