[sanitizer] Avoid calling a nullptr in MonotonicNanoTime if interceptors are not yet initialized

There's a TSan startup crash on Linux when used in Swift programs, where MonotonicNanoTime will try to call real_clock_gettime and then jump to NULL because interceptors are not yet initialized. This is on Ubuntu 18.04. Looks like TSan's main Initialize() function is called at a point where __progname is already set, but interceptors aren't yet set up. Let's fix this by checking whether interceptors are initialized in MonotonicNanoTime.

Differential Revision: https://reviews.llvm.org/D53528



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@345174 91177308-0d34-0410-b5e6-96231b3b80d8
1 file changed