I've fixes few LSan issues and pushed patches upstream. I've precompiled and uploaded the patched version of the toolchain here: http://cdn.netbsd.org/pub/NetBSD/misc/kamil/llvm-clang-compilerrt-10.0.0beta_2019-09-11.tar.bz2 $ cat leak.c #include <stdlib.h> void *p; int main() { p = malloc(7); p = 0; // The memory is leaked here. return 0; } $ clang -fsanitize=address -g leak.c ; ASAN_OPTIONS=detect_leaks=1 ./a.out ================================================================= ==19817==ERROR: LeakSanitizer: detected memory leaks Direct leak of 7 byte(s) in 1 object(s) allocated from: #0 0x4c15dd in malloc /public/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3 #1 0x41eb68 in main /tmp/leak.c:4:7 #2 0x41ea7c in ___start (/tmp/./a.out+0x41ea7c) SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s). I recommend to wait for llvm10 to get these patches properly reviewed and merged instead of backporting to llvm7 in NetBSD-8. Not all LSan tests pass (there are at least 3 breaking scenarios), but it is already usable. Certain bugs will be omitted, others might falsely report problems.
Attachment:
signature.asc
Description: OpenPGP digital signature