void SetAllocatorMayReturnNull(bool may_return_null) {
atomic_store(&allocator_may_return_null, may_return_null,
memory_order_relaxed);
+#ifdef START_BACKGROUND_THREAD_EARLY
+ MaybeStartBackgroudThread();
+#endif
}
void PrintHintAllocatorCannotReturnNull() {
void *internal_start_thread(void *(*func)(void*), void *arg);
void internal_join_thread(void *th);
+void MaybeStartBackgroudThread();
+
+#if defined(__thumb__) && defined(__linux__)
+// Workaround for
+// https://lab.llvm.org/buildbot/#/builders/clang-thumbv7-full-2stage
+# define START_BACKGROUND_THREAD_EARLY
+#endif
// Make the compiler think that something is going on there.
// Use this inside a loop that looks like memset/memcpy/etc to prevent the
}
}
-static void MaybeStartBackgroudThread() {
+void MaybeStartBackgroudThread() {
// Need to implement/test on other platforms.
// Start the background thread if one of the rss limits is given.
if (!common_flags()->hard_rss_limit_mb &&
}
}
-# pragma clang diagnostic push
+# ifndef START_BACKGROUND_THREAD_EARLY
+# pragma clang diagnostic push
// We avoid global-constructors to be sure that globals are ready when
// sanitizers need them. This can happend before global constructors executed.
// Here we don't mind if thread is started on later stages.
-# pragma clang diagnostic ignored "-Wglobal-constructors"
+# pragma clang diagnostic ignored "-Wglobal-constructors"
static struct BackgroudThreadStarted {
BackgroudThreadStarted() { MaybeStartBackgroudThread(); }
} background_thread_strarter UNUSED;
-# pragma clang diagnostic pop
+# pragma clang diagnostic pop
+# endif
#endif
void WriteToSyslog(const char *msg) {