pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

compiler-rt-netbsd: Fix pthread_once(3)/TSan/NetBSD



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Tue Nov 21 07:45:54 2017 +0100
Changeset:	cb400a1c3cc2a688f9c9dcbdef507dcd299bdd86

Modified Files:
	compiler-rt-netbsd/Makefile
	compiler-rt-netbsd/distinfo
Added Files:
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc

Log Message:
compiler-rt-netbsd: Fix pthread_once(3)/TSan/NetBSD

Correct NetBSD support in pthread_once(3)/TSan
https://reviews.llvm.org/D40262

While there upgrade to SVN r. 318729.
This contains fixes for !NetBSD afer addition of the recent NetBSD bits.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=cb400a1c3cc2a688f9c9dcbdef507dcd299bdd86

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 compiler-rt-netbsd/Makefile                        |  2 +-
 compiler-rt-netbsd/distinfo                        |  5 +++++
 ...__common_sanitizer__platform__limits__netbsd.cc | 12 +++++++++++
 ...r__common_sanitizer__platform__limits__netbsd.h | 12 +++++++++++
 ...r__common_sanitizer__platform__limits__posix.cc | 12 +++++++++++
 ...er__common_sanitizer__platform__limits__posix.h | 12 +++++++++++
 .../patch-lib_tsan_rtl_tsan__interceptors.cc       | 23 ++++++++++++++++++++++
 7 files changed, 77 insertions(+), 1 deletion(-)

diffs:
diff --git a/compiler-rt-netbsd/Makefile b/compiler-rt-netbsd/Makefile
index e845883211..63ad284ab7 100644
--- a/compiler-rt-netbsd/Makefile
+++ b/compiler-rt-netbsd/Makefile
@@ -5,7 +5,7 @@ CATEGORIES=	lang devel
 
 SVN_REPOSITORIES=	compiler-rt
 SVN_REPO.compiler-rt=	http://llvm.org/svn/llvm-project/compiler-rt/trunk
-SVN_REVISION.compiler-rt=	318673
+SVN_REVISION.compiler-rt=	318729
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	http://compiler-rt.llvm.org/
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index e6091f5dca..27a3e2e48c 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -3,5 +3,10 @@ $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 SHA1 (patch-cmake_config-ix.cmake) = a1814db3e044ce3954655fea1e157a96bfa8df2f
 SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 38ca750154dfc9843a56748078235824b772a147
 SHA1 (patch-lib_msan_msan.h) = ce3f544490aebc1db73be9e3388f0a9d31d5b369
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = 63fbc01ce50355fc1e843ac351fced2711af3485
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = d8b403c6aa2c3c4a50f98afbf3a0d55a28e5e43b
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc) = 56544f9be43ab8d7484b3a5a09425aa85e3f9cca
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h) = b8253f86eb31054478dcb10e9806033446d75679
+SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = 2ab86cd81b2a70d18a6efded8c8caa3d75b2855d
 SHA1 (patch-lib_tsan_rtl_tsan__rtl.cc) = bc3d6aa81515ac4a4fc5b504e93b3ac8de355371
 SHA1 (patch-lib_tsan_rtl_tsan__rtl__amd64.S) = 6df0f2af44ebfec76d3b237c984eff63ee93b30f
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
new file mode 100644
index 0000000000..865e6968f2
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc.orig	2017-11-16 17:55:37.000000000 +0000
++++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
+@@ -83,6 +83,7 @@ unsigned siginfo_t_sz = sizeof(siginfo_t
+ unsigned struct_sigaction_sz = sizeof(struct sigaction);
+ unsigned struct_itimerval_sz = sizeof(struct itimerval);
+ unsigned pthread_t_sz = sizeof(pthread_t);
++unsigned pthread_mutex_t_sz = sizeof(pthread_mutex_t);
+ unsigned pthread_cond_t_sz = sizeof(pthread_cond_t);
+ unsigned pid_t_sz = sizeof(pid_t);
+ unsigned timeval_sz = sizeof(timeval);
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
new file mode 100644
index 0000000000..3cf1aa6716
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.h.orig	2017-11-16 17:55:37.000000000 +0000
++++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
+@@ -38,6 +38,7 @@ extern unsigned struct_rusage_sz;
+ extern unsigned siginfo_t_sz;
+ extern unsigned struct_itimerval_sz;
+ extern unsigned pthread_t_sz;
++extern unsigned pthread_mutex_t_sz;
+ extern unsigned pthread_cond_t_sz;
+ extern unsigned pid_t_sz;
+ extern unsigned timeval_sz;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
new file mode 100644
index 0000000000..44f73d551b
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig	2017-11-16 17:55:37.000000000 +0000
++++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -210,6 +210,7 @@ namespace __sanitizer {
+   unsigned struct_sigaction_sz = sizeof(struct sigaction);
+   unsigned struct_itimerval_sz = sizeof(struct itimerval);
+   unsigned pthread_t_sz = sizeof(pthread_t);
++  unsigned pthread_mutex_t_sz = sizeof(pthread_mutex_t);
+   unsigned pthread_cond_t_sz = sizeof(pthread_cond_t);
+   unsigned pid_t_sz = sizeof(pid_t);
+   unsigned timeval_sz = sizeof(timeval);
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
new file mode 100644
index 0000000000..b9962b084d
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_platform_limits_posix.h.orig	2017-11-16 17:55:37.000000000 +0000
++++ lib/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -46,6 +46,7 @@ namespace __sanitizer {
+   extern unsigned siginfo_t_sz;
+   extern unsigned struct_itimerval_sz;
+   extern unsigned pthread_t_sz;
++  extern unsigned pthread_mutex_t_sz;
+   extern unsigned pthread_cond_t_sz;
+   extern unsigned pid_t_sz;
+   extern unsigned timeval_sz;
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
new file mode 100644
index 0000000000..a401ed0efd
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- lib/tsan/rtl/tsan_interceptors.cc.orig	2017-11-20 18:08:35.000000000 +0000
++++ lib/tsan/rtl/tsan_interceptors.cc
+@@ -1354,10 +1354,15 @@ TSAN_INTERCEPTOR(int, pthread_once, void
+   if (o == 0 || f == 0)
+     return errno_EINVAL;
+   atomic_uint32_t *a;
+-  if (!SANITIZER_MAC)
+-    a = static_cast<atomic_uint32_t*>(o);
+-  else  // On OS X, pthread_once_t has a header with a long-sized signature.
++
++  if (SANITIZER_MAC)
+     a = static_cast<atomic_uint32_t*>((void *)((char *)o + sizeof(long_t)));
++  else if (SANITIZER_NETBSD)
++    a = static_cast<atomic_uint32_t*>
++          ((void *)((char *)o + __sanitizer::pthread_mutex_t_sz));
++  else
++    a = static_cast<atomic_uint32_t*>(o);
++
+   u32 v = atomic_load(a, memory_order_acquire);
+   if (v == 0 && atomic_compare_exchange_strong(a, &v, 1,
+                                                memory_order_relaxed)) {


Home | Main Index | Thread Index | Old Index