This is a new version of http://reviews.llvm.org/D18121, which I had to revert due to test failures. It's not possible to reopen a closed revision here, so I'm creating a new one.
The issue is that TSan unit tests run with a statically linked runtime, where interceptors don't work, but that's fine, we don't need them. With the patch, this is now detected and the unit tests are aborted. To avoid this, we have DisableReexec(), but due to static initializers order, it's not possible to call this function early enough (we'd have to make more invasive changes). So I'm proposing a simpler fix, which simply adds a "disable_reexec" flag that is set in unit tests.