When running ninja check-all on a platform that includes sanitizer tests and the default linker is LLD, the machine can easily be overwhelmed if threads are not disabled in the linker. This is because LLD uses effectively unrestricted parallelism and llvm-lit will use as many processes as there are virtual CPUs on the system.
Of course, this issue can be worked around by specifying a lower number of threads to llvm-lit, but that has the undesired effect of reducing parallelism for the entire test run.
This patch therefore adds -Wl,--no-threads to the cflags for invocations of clang in the sanitizers.
Please keep in mind that this is not at all my area of expertise so if there is a better/simpler/cleaner way to accomplish this, please suggest one.