[compiler-rt] r251935 - [tsan] Allow memchr interceptor to be used before initialization on OS X
Kuba Brecka via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 3 08:19:37 PST 2015
Author: kuba.brecka
Date: Tue Nov 3 10:19:37 2015
New Revision: 251935
URL: http://llvm.org/viewvc/llvm-project?rev=251935&view=rev
Log:
[tsan] Allow memchr interceptor to be used before initialization on OS X
On OS X, `memchr` is called on a newly created thread even before `__tsan_thread_start_func` is invoked, which means that the ThreadState object for that thread will not yet be initialized. Let's add `COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED` into the interceptor to simply call `internal_memchr` in these cases.
Differential Revision: http://reviews.llvm.org/D14283
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=251935&r1=251934&r2=251935&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Tue Nov 3 10:19:37 2015
@@ -441,6 +441,8 @@ INTERCEPTOR(int, memcmp, const void *a1,
#if SANITIZER_INTERCEPT_MEMCHR
INTERCEPTOR(void*, memchr, const void *s, int c, SIZE_T n) {
+ if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
+ return internal_memchr(s, c, n);
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, memchr, s, c, n);
void *res = REAL(memchr)(s, c, n);
More information about the llvm-commits
mailing list