I noticed that on OS X, we currently skip all "Noinst" unit tests, see http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/1384/consoleFull and search for "Asan-i386-inline-Noinst-Test" (they're not being run at all). The reason is that in MaybeReexec() we always try to set DYLD_INSERT_LIBRARIES to the module where we find the __asan_init symbol. However, the non-instrumented unit tests link the runtime statically, so this symbol is in the executable itself.
This was probably caused when we removed the "allow_reexec" flag. This patch adds a check into MaybeReexec such that if the module that contains the __asan_init symbol is not a dylib, we will not try to re-execute at all. This should only affect the statically-linked unit tests, all other uses on OS X should use the dynamic library.