mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

Linux + ASAN + MI_TRACK_ASAN + MI_OVERRIDE + static linking

Open Noxybot opened this issue 10 months ago • 1 comments

Hi! Is this use-case supported? If I enable ASAN + MI_OVERRIDE, I seem to not be able to compile executable b.c. of such errors:

[1]  ld.lld: error: duplicate symbol: operator delete[](void*)
[1]  >>> defined at asan_new_delete.cpp.o:(operator delete[](void*)) in archive /usr/lib/llvm-12/lib/clang/12.0.1/lib/linux/libclang_rt.asan_cxx-x86_64.a
[1]  >>> defined at alloc-override.c:193 (mimalloc/src/alloc-override.c:193)
[1]  >>>            CMakeFiles/mimalloc-static.dir/src/alloc.c.o:(.text+0x750) in archive mimalloc/libmimalloc-asan-optimized.a

Noxybot avatar Feb 25 '25 01:02 Noxybot

Seems like libclang_rt.asan_cxx-x86_64.a is linked by clang itself. I tried work-around it by linking to the mimalloc's object file (as opposed to the static lib), but also didn't work when combined with "-fsanitize=address".

Noxybot avatar Feb 25 '25 21:02 Noxybot