configure.ac: add --enable-sanitize option
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 3 Apr 2017 09:17:48 +0000 (11:17 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 14 Apr 2017 20:44:30 +0000 (22:44 +0200)
commit8b5d477aa820e52ed622c329933550c561ab1c93
treea782e472465ad34fb56481c521d6318168b259d0
parente1f6fb8021bcdd407fae77917502891b9239f53c
configure.ac: add --enable-sanitize option

Enable code sanitizers by adding -fsanitize=$foo flags for the compiler
and linker.

In addition, this also disables checking for undefined symbols: running
the address sanitizer requires additional symbols which should be provided
by a preloaded libasan.so (preloaded for hooking into malloc & friends
globally), and the undefined symbols check gets tripped up by that.

Running the tests works normally via `make check`, but shows additional
failures with the address sanitizer due to memory leaks that seem to be
mostly leaks in the tests themselves. I believe those failures should
really be fixed. In the mean-time, you can set

export ASAN_OPTIONS=detect_leaks=0

to only check for more serious error types.

v2:
- fail reasonably when an unsupported sanitize flag is given (Eric Engestrom)

Reviewed-by: Bartosz Tomczyk <bartosz.tomczyk86@gmail.com> (v1)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
configure.ac