How to build gas with ASAN/UBSAN?
Fangrui Song
i@maskray.me
Wed Aug 19 21:50:02 GMT 2020
On 2020-08-19, Nick Clifton via Binutils wrote:
>Hi Martin,
>
>> One can't do that with CFLAGS="..." ../configure as it would
>> build all .a file with that as well. And test would fail then due to unresolved
>> sanitizer-related symbols.
>
>Err, I use that particular method and it works for me. You just need to
>add in a definition of LDFLAGS so that the appropriate library is included
>as well. For example:
>
> % $BINUTILS_SRCDIR/configure \
> --enable-targets=all \
> --enable-64-bit-bfd \
> CFLAGS='-g -O2 -fsanitize=address' \
> CXXFLAGS='-g -O2 -fsanitize=address' \
> LDFLAGS='-ldl' \
>
Emmm, is LDFLAGS='-fsanitize=address' needed?
See the *link_command section in the output of
gcc -dumpspecs, -fsanitize=address also affects linking.
More information about the Binutils
mailing list