I recently tried to use ASAN on Windows again. I noticed some issues regarding
Windows runtimes and would like to get some insight on that:
a) The compiler-rt ASAN libs as provided for Windows from  are linked
against the static Windows runtime (/MT). Would it be possible to also include
versions for the compiler-rt libs linked against the dynamic runtime (/MD)?
This would greatly simplify getting ASAN up and running for projects that use
e.g. Qt which is usually consumed as a dynamic library.
: LLVM Download Page
b) I notice that it's impossible to compile compiler-rt against the debug
variants (/MTd or /MDd), cf. . Is this a conceptual limitation that cannot
ever be implemented? I.e. are features in the debug runtime negatively
influencing the functionality of ASAN, making this impossible to work? Or is
it "simply" a matter of work that needs to be done, i.e. adding the
corresponding interceptors for the debug runtime?
: compiler-rt/lib/asan at master · llvm-mirror/compiler-rt · GitHub
c) Using ASAN via `clang.exe` or `clang-cl.exe` on single-file demo
applications is straight forward, as the linker will be fed with the correct
arguments when enabling `-fsanitize=address`. But when trying to use ASAN on
Windows for real-world applications that use e.g. CMake or QMake, I am running
into the following issue: These build systems separate the object file
creation and linking phase. Then, when using the Visual Studio linker
(`link.exe`) for linking, that tool of course does not (yet?) know anything
about the sanitizers and compiler-rt. So while I can simply add the `-
fsanitize=address` argument to the invocation of `clang-cl.exe`, one needs to
find and specify the correct arguments to pass to `link.exe` too. This latter
step is not straight forward at all. How do people cope with this? Is there
something I'm missing, like a `clang-link.exe` that understands `-
Right now, I have to hardcode these arguments manually:
The path could probably be obtained automatically by joining `llvm-config --
lib`, `llvm-config --version` and some hard coded strings. But could we maybe
get an `llvm-config --asan-ldflags` or similar?