Commit cb7e3c19 authored by Kirill Smelkov's avatar Kirill Smelkov

tox: Explicitly use -fno-omit-frame-pointer for ASAN/TSAN builds

Some compiler versions and distributions default to that out of the box,
while some others default to -fomit-frame-pointer. Since for sanitizers
it is important to have the frame-pointers to be able to retrieve
program tracebacks even without DWARF and faster(*), let's explicitly make
sure that what we build with comes with frame-pointers enabled.

(*) see e.g. https://github.com/google/sanitizers/wiki/AddressSanitizer#using-addresssanitizer
    for details.

/reviewed-by @jerome
/reviewed-on nexedi/pygolang!24
parent fd2a6b68
...@@ -42,16 +42,16 @@ basepython = ...@@ -42,16 +42,16 @@ basepython =
setenv = setenv =
# distutils take CFLAGS for both C and C++. # distutils take CFLAGS for both C and C++.
# distutils use CFLAGS also at link stage -> we don't need to set LDFLAGS separately. # distutils use CFLAGS also at link stage -> we don't need to set LDFLAGS separately.
tsan: CFLAGS=-g -fsanitize=thread tsan: CFLAGS=-g -fsanitize=thread -fno-omit-frame-pointer
asan: CFLAGS=-g -fsanitize=address asan: CFLAGS=-g -fsanitize=address -fno-omit-frame-pointer
# XXX however distutils' try_link, which is used by numpy.distutils use only CC # XXX however distutils' try_link, which is used by numpy.distutils use only CC
# as linker without CFLAGS and _without_ LDFLAGS, which fails if *.o were # as linker without CFLAGS and _without_ LDFLAGS, which fails if *.o were
# compiled with -fsanitize=X and linked without that option. Work it around # compiled with -fsanitize=X and linked without that option. Work it around
# with also adjusting CC. # with also adjusting CC.
# XXX better arrange to pass CFLAGS to pygolang only, e.g. by adding --race or # XXX better arrange to pass CFLAGS to pygolang only, e.g. by adding --race or
# --sanitize=thread to `setup.py build_ext`. # --sanitize=thread to `setup.py build_ext`.
tsan: CC=cc -fsanitize=thread tsan: CC=cc -fsanitize=thread -fno-omit-frame-pointer
asan: CC=cc -fsanitize=address asan: CC=cc -fsanitize=address -fno-omit-frame-pointer
# always compile pygolang from source and don't reuse binary pygolang wheels as # always compile pygolang from source and don't reuse binary pygolang wheels as
# we compile each case with different CFLAGS. # we compile each case with different CFLAGS.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment