<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Evgeniy,<div><br><div>this appears to have broken mac os x builds of compiler-rt:</div><div><br></div><div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">CHECK_TYPE_SIZE(clockid_t);</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> ^~~~~~~~~</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> clock_t</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1263:55: note: expanded from macro 'CHECK_TYPE_SIZE'</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> ^</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">../projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:264:51: note: expanded from macro 'COMPILER_CHECK'</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> ^</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">../projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:270:65: note: expanded from macro 'IMPL_COMPILER_ASSERT'</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> ^</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">/usr/include/sys/_types/_clock_t.h:30:33: note: 'clock_t' declared here</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">typedef __darwin_clock_t clock_t;</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> ^</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1061:1: error: 'assertion_failed__1061' declared as an array with a negative size</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">CHECK_TYPE_SIZE(clockid_t);</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">^~~~~~~~~~~~~~~~~~~~~~~~~~</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1263:3: note: expanded from macro 'CHECK_TYPE_SIZE'</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">../projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:264:30: note: expanded from macro 'COMPILER_CHECK'</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;">../projects/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:270:57: note: expanded from macro 'IMPL_COMPILER_ASSERT'</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"> typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]</div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 14px; font-family: Menlo;"><br></div><div><blockquote type="cite"><div>On Jun 18, 2014, at 7:16 AM, Evgeniy Stepanov <<a href="mailto:eugeni.stepanov@gmail.com">eugeni.stepanov@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div>Author: eugenis<br>Date: Wed Jun 18 09:16:41 2014<br>New Revision: 211166<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=211166&view=rev">http://llvm.org/viewvc/llvm-project?rev=211166&view=rev</a><br>Log:<br>[sanitizer] Intercept pthread_*attr_get*.<br><br>Added:<br> compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc (with props)<br>Modified:<br> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc<br> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h<br> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc<br> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h<br> compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc<br><br>Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=211166&r1=211165&r2=211166&view=diff">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=211166&r1=211165&r2=211166&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)<br>+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Jun 18 09:16:41 2014<br>@@ -3294,19 +3294,26 @@ INTERCEPTOR(int, random_r, void *buf, u3<br> // FIXME: under ASan the REAL() call below may write to freed memory and corrupt<br> // its metadata. See<br> // <a href="https://code.google.com/p/address-sanitizer/issues/detail?id=321">https://code.google.com/p/address-sanitizer/issues/detail?id=321</a>.<br>-#if SANITIZER_INTERCEPT_PTHREAD_ATTR_GET || \<br>- SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSSCHED<br>-#define INTERCEPTOR_PTHREAD_ATTR_GET(what, sz) \<br>- INTERCEPTOR(int, pthread_attr_get##what, void *attr, void *r) { \<br>- void *ctx; \<br>- COMMON_INTERCEPTOR_ENTER(ctx, pthread_attr_get##what, attr, r); \<br>- int res = REAL(pthread_attr_get##what)(attr, r); \<br>- if (!res && r) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, r, sz); \<br>- return res; \<br>+#if SANITIZER_INTERCEPT_PTHREAD_ATTR_GET || \<br>+ SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSSCHED || \<br>+ SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GET || \<br>+ SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GET || \<br>+ SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GET || \<br>+ SANITIZER_INTERCEPT_PTHREAD_BARRIERATTR_GET<br>+#define INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(fn, sz) \<br>+ INTERCEPTOR(int, fn, void *attr, void *r) { \<br>+ void *ctx; \<br>+ COMMON_INTERCEPTOR_ENTER(ctx, fn, attr, r); \<br>+ int res = REAL(fn)(attr, r); \<br>+ if (!res && r) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, r, sz); \<br>+ return res; \<br> }<br> #endif<br><br>+<br> #if SANITIZER_INTERCEPT_PTHREAD_ATTR_GET<br>+#define INTERCEPTOR_PTHREAD_ATTR_GET(what, sz) \<br>+ INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_attr_get##what, sz)<br> INTERCEPTOR_PTHREAD_ATTR_GET(detachstate, sizeof(int))<br> INTERCEPTOR_PTHREAD_ATTR_GET(guardsize, sizeof(SIZE_T))<br> INTERCEPTOR_PTHREAD_ATTR_GET(schedparam, struct_sched_param_sz)<br>@@ -3380,6 +3387,60 @@ INTERCEPTOR(int, pthread_attr_getaffinit<br> #define INIT_PTHREAD_ATTR_GETAFFINITY_NP<br> #endif<br><br>+#if SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GET<br>+#define INTERCEPTOR_PTHREAD_MUTEXATTR_GET(what, sz) \<br>+ INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_mutexattr_get##what, sz)<br>+INTERCEPTOR_PTHREAD_MUTEXATTR_GET(pshared, sizeof(int))<br>+INTERCEPTOR_PTHREAD_MUTEXATTR_GET(type, sizeof(int))<br>+INTERCEPTOR_PTHREAD_MUTEXATTR_GET(protocol, sizeof(int))<br>+INTERCEPTOR_PTHREAD_MUTEXATTR_GET(prioceiling, sizeof(int))<br>+INTERCEPTOR_PTHREAD_MUTEXATTR_GET(robust, sizeof(int))<br>+INTERCEPTOR_PTHREAD_MUTEXATTR_GET(robust_np, sizeof(int))<br>+#define INIT_PTHREAD_MUTEXATTR_GET \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getpshared); \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_gettype); \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getprotocol); \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getprioceiling); \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getrobust); \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getrobust_np);<br>+#else<br>+#define INIT_PTHREAD_MUTEXATTR_GET<br>+#endif<br>+<br>+#if SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GET<br>+#define INTERCEPTOR_PTHREAD_RWLOCKATTR_GET(what, sz) \<br>+ INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_rwlockattr_get##what, sz)<br>+INTERCEPTOR_PTHREAD_RWLOCKATTR_GET(pshared, sizeof(int))<br>+INTERCEPTOR_PTHREAD_RWLOCKATTR_GET(kind_np, sizeof(int))<br>+#define INIT_PTHREAD_RWLOCKATTR_GET \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_rwlockattr_getpshared); \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_rwlockattr_getkind_np);<br>+#else<br>+#define INIT_PTHREAD_RWLOCKATTR_GET<br>+#endif<br>+<br>+#if SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GET<br>+#define INTERCEPTOR_PTHREAD_CONDATTR_GET(what, sz) \<br>+ INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_condattr_get##what, sz)<br>+INTERCEPTOR_PTHREAD_CONDATTR_GET(pshared, sizeof(int))<br>+INTERCEPTOR_PTHREAD_CONDATTR_GET(clock, sizeof(__sanitizer_clockid_t))<br>+#define INIT_PTHREAD_CONDATTR_GET \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_condattr_getpshared); \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_condattr_getclock);<br>+#else<br>+#define INIT_PTHREAD_CONDATTR_GET<br>+#endif<br>+<br>+#if SANITIZER_INTERCEPT_PTHREAD_BARRIERATTR_GET<br>+#define INTERCEPTOR_PTHREAD_BARRIERATTR_GET(what, sz) \<br>+ INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_barrierattr_get##what, sz)<br>+INTERCEPTOR_PTHREAD_BARRIERATTR_GET(pshared, sizeof(int))<br>+#define INIT_PTHREAD_BARRIERATTR_GET \<br>+ COMMON_INTERCEPT_FUNCTION(pthread_barrierattr_getpshared);<br>+#else<br>+#define INIT_PTHREAD_BARRIERATTR_GET<br>+#endif<br>+<br> #if SANITIZER_INTERCEPT_TMPNAM<br> INTERCEPTOR(char *, tmpnam, char *s) {<br> void *ctx;<br>@@ -4606,6 +4667,10 @@ static void InitializeCommonInterceptors<br> INIT_PTHREAD_ATTR_GET;<br> INIT_PTHREAD_ATTR_GETINHERITSCHED;<br> INIT_PTHREAD_ATTR_GETAFFINITY_NP;<br>+ INIT_PTHREAD_MUTEXATTR_GET;<br>+ INIT_PTHREAD_RWLOCKATTR_GET;<br>+ INIT_PTHREAD_CONDATTR_GET;<br>+ INIT_PTHREAD_BARRIERATTR_GET;<br> INIT_TMPNAM;<br> INIT_TMPNAM_R;<br> INIT_TEMPNAM;<br><br>Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=211166&r1=211165&r2=211166&view=diff">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=211166&r1=211165&r2=211166&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)<br>+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Wed Jun 18 09:16:41 2014<br>@@ -163,6 +163,10 @@<br> #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \<br> SI_MAC || SI_LINUX_NOT_ANDROID<br> #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP SI_LINUX_NOT_ANDROID<br>+#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GET SI_NOT_WINDOWS<br>+#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GET SI_NOT_WINDOWS<br>+#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GET SI_NOT_WINDOWS<br>+#define SANITIZER_INTERCEPT_PTHREAD_BARRIERATTR_GET SI_NOT_WINDOWS<br> #define SANITIZER_INTERCEPT_TMPNAM SI_NOT_WINDOWS<br> #define SANITIZER_INTERCEPT_TMPNAM_R SI_LINUX_NOT_ANDROID<br> #define SANITIZER_INTERCEPT_TEMPNAM SI_NOT_WINDOWS<br><br>Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc?rev=211166&r1=211165&r2=211166&view=diff">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc?rev=211166&r1=211165&r2=211166&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc (original)<br>+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc Wed Jun 18 09:16:41 2014<br>@@ -1058,6 +1058,7 @@ CHECK_SIZE_AND_OFFSET(shmid_ds, shm_natt<br> #endif<br><br> CHECK_TYPE_SIZE(clock_t);<br>+CHECK_TYPE_SIZE(clockid_t);<br><br> #if !SANITIZER_ANDROID<br> CHECK_TYPE_SIZE(ifaddrs);<br><br>Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=211166&r1=211165&r2=211166&view=diff">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=211166&r1=211165&r2=211166&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h (original)<br>+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h Wed Jun 18 09:16:41 2014<br>@@ -440,6 +440,8 @@ namespace __sanitizer {<br> typedef long __sanitizer_clock_t;<br> #endif<br><br>+ typedef int __sanitizer_clockid_t;<br>+<br> #if SANITIZER_LINUX || SANITIZER_FREEBSD<br> #if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)<br> typedef unsigned __sanitizer___kernel_uid_t;<br><br>Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=211166&r1=211165&r2=211166&view=diff">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=211166&r1=211165&r2=211166&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)<br>+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Wed Jun 18 09:16:41 2014<br>@@ -47,7 +47,7 @@ DECLARE_REAL(int, pthread_attr_getdetach<br> extern "C" int pthread_attr_setstacksize(void *attr, uptr stacksize);<br> extern "C" int pthread_key_create(unsigned *key, void (*destructor)(void* v));<br> extern "C" int pthread_setspecific(unsigned key, const void *v);<br>-extern "C" int pthread_mutexattr_gettype(void *a, int *type);<br>+DECLARE_REAL(int, pthread_mutexattr_gettype, void *, void *)<br> extern "C" int pthread_yield();<br> extern "C" int pthread_sigmask(int how, const __sanitizer_sigset_t *set,<br> __sanitizer_sigset_t *oldset);<br>@@ -1029,7 +1029,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_init<br> bool recursive = false;<br> if (a) {<br> int type = 0;<br>- if (pthread_mutexattr_gettype(a, &type) == 0)<br>+ if (REAL(pthread_mutexattr_gettype)(a, &type) == 0)<br> recursive = (type == PTHREAD_MUTEX_RECURSIVE<br> || type == PTHREAD_MUTEX_RECURSIVE_NP);<br> }<br><br>Added: compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc?rev=211166&view=auto">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc?rev=211166&view=auto</a><br>==============================================================================<br>--- compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc (added)<br>+++ compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc Wed Jun 18 09:16:41 2014<br>@@ -0,0 +1,20 @@<br>+// RUN: %clangxx -O0 %s -o %t && %run %t<br>+// XFAIL: arm-linux-gnueabi<br>+<br>+#include <assert.h><br>+#include <pthread.h><br>+<br>+int main(void) {<br>+ pthread_mutexattr_t ma;<br>+ int res = pthread_mutexattr_init(&ma);<br>+ assert(res == 0);<br>+ res = pthread_mutexattr_setpshared(&ma, 1);<br>+ assert(res == 0);<br>+ int pshared;<br>+ res = pthread_mutexattr_getpshared(&ma, &pshared);<br>+ assert(res == 0);<br>+ assert(pshared == 1);<br>+ res = pthread_mutexattr_destroy(&ma);<br>+ assert(res == 0);<br>+ return 0;<br>+}<br><br>Propchange: compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc<br>------------------------------------------------------------------------------<br> svn:eol-style = LF<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></div></blockquote></div><br></div></div></body></html>