[issue20935] Cherry pick CFLAGS, add to flags for $(BUILDPYTHON) Makefile rule

Jeffrey Walton report at bugs.python.org
Sat Mar 15 17:14:35 CET 2014


New submission from Jeffrey Walton:

>From Python head in mercurial.

When building Python under Clang's sanitizers, we provide a couple of flags to instrument binaries with the sanitizers. For example:

export CC=/usr/local/bin/clang
export CXX=/usr/local/bin/clang++
export CFLAGS="-g3 -fsanitize=undefined -fsanitize=address"
export CXXFLAGS="-g3 -fsanitize=undefined -fsanitize=address -fno-sanitize=vptr"
./configure
make

However, `make` will fail due to some missing sanitizer libraries. The libraries are added at the link stage by Clang, but the invocation must include the -fsanitize=... flags.

The recipe for $(BUILDPYTHON) in the Makefile does not include necessary CFLAGS:

# Build the interpreter
$(BUILDPYTHON):	Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
	$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)

The result is a failed link when building with the sanitizers.

It would be great if the sanizter flags (-fsanitize=undefined -fsanitize=address -fno-sanitize=vptr) were cherry picked from the FLAGS by the build system and added to the recipe as required:

$(BUILDPYTHON):	Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
	$(LINKCC) -fsanitize=undefined -fsanitize=address -fno-sanitize=vptr $(PY_LDFLAGS) $(LINKFORSHARED) ...

Please consider picking up the sanitizer flags and adding them to the build rule.

----------
components: Build
hgrepos: 220
messages: 213661
nosy: Jeffrey.Walton
priority: normal
severity: normal
status: open
title: Cherry pick CFLAGS, add to flags for $(BUILDPYTHON) Makefile rule
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20935>
_______________________________________


More information about the Python-bugs-list mailing list