[Mesa-dev] [PATCH] configure.ac: add --enable-sanitize option
Emil Velikov
emil.l.velikov at gmail.com
Fri Apr 7 18:32:06 UTC 2017
On 7 April 2017 at 11:00, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> 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.
> --
> So the main point here is really fixing the linker errors when building
> the video libraries with address sanitizer (the gallium_dri build doesn't
> seem to set --no-undefined anyway). If somebody knows a better way of doing
> that, I'd be happy to hear about it!
The following comes to mind, although it feels _quite_ nasty:
export LD_PRELOAD=libasan.so
export CC="gcc -fsanitiser..."
export CXX=...
configure && make && make install
I understand that most people will not like it, so I won't mention it again ;-)
Couple of suggestions:
- as mentioned by Eric - we want to detect and error out if user
requests a sanitizer that is not available.
- a big warning is due, since running make check _will_ fail, if the
library is not preloaded.
Thanks
Emil
More information about the mesa-dev
mailing list