Hi Evgeny, On Fri, Dec 03, 2021 at 02:17:21PM +0000, Evgeny Vereshchagin wrote: > ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined > and -z,defs: > https://clang.llvm.org/docs/AddressSanitizer.html#usage > https://github.com/google/sanitizers/issues/380 > so to build elfutils with clang with the sanitizers it should be possible > to turn them off.
I have to agree with Florian, this really is a bug in the compiler you are using. Adding -fsanitize=address to CFLAGS/CXXFLAGS works just fine with gcc. I have been using it in the past in combination with the afl fuzzer (32bit only). It doesn't work together with --enable-valgrind though. That said, I really would like to add address sanitizer support. It would be great to add this to our buildbot CI to catch more issues early. We already support --enable-sanitize-undefined and --enable-valgrind. But sadly we have to disable valgrind in a couple of testcases, specifically when testing the debuginfod server. I just testing with gcc (Debian 10.2.1-6) 10.2.1 20210110 on arm64 and it actually found some issues. I'll post patches for those. There is one issue with the test-nlist test because we use special CFLAGS for that. But if we introduce an --enable-sanitize-address we could work around that. If clang really cannot be fixed then your patch in combination with an --enable-sanitize-address might be a good idea. But I don't think it makes sense as a standalone option. In the past we made the mistake of adding configure options to disable some necessary flags, like --disable-symbol-versioning, which was a mistake. There are now distros shipping elfutils libraries with broken abis while using the same SONAMEs. Cheers, Mark