pkgsrc-WIP-changes archive

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

compiler-rt-netbsd: Fix local patches



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Thu Nov 23 09:27:42 2017 +0100
Changeset:	927bf5847d818d434ee1ba3d4939a3029eb43d73

Modified Files:
	compiler-rt-netbsd/distinfo
	compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
	compiler-rt-netbsd/patches/patch-lib_msan_msan.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__signal__interceptors.inc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc

Log Message:
compiler-rt-netbsd: Fix local patches

Some of local changes were lost in this package.

Sync with local tree.. hovewer on the
cost of spoiling local style of code (copy-pasted from HTML page).

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=927bf5847d818d434ee1ba3d4939a3029eb43d73

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

diffstat:
 compiler-rt-netbsd/distinfo                        |  12 +-
 .../patches/patch-cmake_config-ix.cmake            |   2 +-
 compiler-rt-netbsd/patches/patch-lib_msan_msan.h   |   4 +-
 ...zer__common_sanitizer__signal__interceptors.inc |  26 +++-
 ...anitizer__common_sanitizer__thread__registry.cc |   8 +-
 .../patch-lib_tsan_rtl_tsan__interceptors.cc       | 149 ++++++++++++++++++++-
 .../patches/patch-lib_tsan_rtl_tsan__rtl.cc        |   4 +-
 7 files changed, 183 insertions(+), 22 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 9c9707ac20..c71e45cdd5 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -1,17 +1,17 @@
 $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 
-SHA1 (patch-cmake_config-ix.cmake) = a1814db3e044ce3954655fea1e157a96bfa8df2f
+SHA1 (patch-cmake_config-ix.cmake) = 41e22425cade0674e8cc254fa474a418cd2a7fa0
 SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 38ca750154dfc9843a56748078235824b772a147
 SHA1 (patch-lib_lsan_lsan__interceptors.cc) = 996b0d8634bba7c3eca69c5eb175284e5f834e5c
 SHA1 (patch-lib_lsan_lsan__thread.cc) = 5cfc982f13ad8171fcd2859f2e37edef2f0e41b2
 SHA1 (patch-lib_lsan_lsan__thread.h) = 5fbcc7fe73e619d88912413d99af2f4878ffeae6
-SHA1 (patch-lib_msan_msan.h) = ce3f544490aebc1db73be9e3388f0a9d31d5b369
-SHA1 (patch-lib_sanitizer__common_sanitizer__signal__interceptors.inc) = 30b8f64a9cb4362032d2d8fa936aef49c1c747de
+SHA1 (patch-lib_msan_msan.h) = 1ee0f86ccb410561d381afba526c85aa5dace912
+SHA1 (patch-lib_sanitizer__common_sanitizer__signal__interceptors.inc) = e510af025a295a36799d15c8caf0b6bbb4272f48
 SHA1 (patch-lib_sanitizer__common_sanitizer__symbolizer__posix__libcdep.cc) = 65914439de83efc75bb4191219f85f92c72f0959
-SHA1 (patch-lib_sanitizer__common_sanitizer__thread__registry.cc) = 38be2aa0785c5a17e682f36717fae45cf8596fbe
+SHA1 (patch-lib_sanitizer__common_sanitizer__thread__registry.cc) = 2883ce1ceff9e55c064db944573b568e4b201571
 SHA1 (patch-lib_sanitizer__common_sanitizer__thread__registry.h) = 8b6ab550a34b4e8526a18e45ef6fc05af64e4c2a
-SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = 6a17ddeb59952b4f15cbe2613b76a129659f52cc
-SHA1 (patch-lib_tsan_rtl_tsan__rtl.cc) = bc3d6aa81515ac4a4fc5b504e93b3ac8de355371
+SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = f7c41bff3b94c14bdeb2e12a595e0fdaafbb6708
+SHA1 (patch-lib_tsan_rtl_tsan__rtl.cc) = a2485075212f150ee2ce33616e887be2b3f41822
 SHA1 (patch-lib_tsan_rtl_tsan__rtl.h) = fbab7ceae96a0a2bf9ec7449dd29a8c0e1613943
 SHA1 (patch-lib_tsan_rtl_tsan__rtl__amd64.S) = 5a0bed4cf2c1f63affeed8886983a53b4376ab5b
 SHA1 (patch-lib_tsan_rtl_tsan__rtl__thread.cc) = 80538a9300eb81a1eec353c51fa420d6dcf012b2
diff --git a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
index c914043161..db8b11f272 100644
--- a/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
+++ b/compiler-rt-netbsd/patches/patch-cmake_config-ix.cmake
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- cmake/config-ix.cmake.orig	2017-10-17 18:35:43.000000000 +0000
+--- cmake/config-ix.cmake.orig	2017-11-06 03:58:05.000000000 +0000
 +++ cmake/config-ix.cmake
 @@ -511,28 +511,28 @@ else()
  endif()
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan.h b/compiler-rt-netbsd/patches/patch-lib_msan_msan.h
index 58a27518a0..a39ee5b74b 100644
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan.h
+++ b/compiler-rt-netbsd/patches/patch-lib_msan_msan.h
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- lib/msan/msan.h.orig	2017-10-17 18:35:51.000000000 +0000
+--- lib/msan/msan.h.orig	2017-11-16 17:55:36.000000000 +0000
 +++ lib/msan/msan.h
-@@ -199,7 +199,7 @@ const MappingDesc kMemoryLayout[] = {
+@@ -203,7 +203,7 @@ const MappingDesc kMemoryLayout[] = {
  #define MEM_TO_SHADOW(mem) (LINEARIZE_MEM((mem)) + 0x100000000000ULL)
  #define SHADOW_TO_ORIGIN(shadow) (((uptr)(shadow)) + 0x280000000000)
  
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__signal__interceptors.inc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__signal__interceptors.inc
index 040650919e..a75d9ed17c 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__signal__interceptors.inc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__signal__interceptors.inc
@@ -2,18 +2,34 @@ $NetBSD$
 
 --- lib/sanitizer_common/sanitizer_signal_interceptors.inc.orig	2017-11-16 17:55:37.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_signal_interceptors.inc
-@@ -46,16 +46,22 @@ INTERCEPTOR(uptr, signal, int signum, up
- }
- #define INIT_SIGNAL COMMON_INTERCEPT_FUNCTION(signal)
+@@ -18,6 +18,12 @@
+ 
+ using namespace __sanitizer;
  
--INTERCEPTOR(int, sigaction, int signum, const __sanitizer_sigaction *act,
--            __sanitizer_sigaction *oldact) {
 +#if SANITIZER_NETBSD
 +#define sigaction_symname __sigaction14
 +#else
 +#define sigaction_symname sigaction
 +#endif
 +
+ #ifndef SIGNAL_INTERCEPTOR_SIGNAL_IMPL
+ #define SIGNAL_INTERCEPTOR_SIGNAL_IMPL(func, signum, handler) \
+   { return REAL(func)(signum, handler); }
+@@ -25,7 +31,7 @@ using namespace __sanitizer;
+ 
+ #ifndef SIGNAL_INTERCEPTOR_SIGACTION_IMPL
+ #define SIGNAL_INTERCEPTOR_SIGACTION_IMPL(signum, act, oldact) \
+-  { return REAL(sigaction)(signum, act, oldact); }
++  { return REAL(sigaction_symname)(signum, act, oldact); }
+ #endif
+ 
+ #if SANITIZER_INTERCEPT_BSD_SIGNAL
+@@ -46,16 +52,16 @@ INTERCEPTOR(uptr, signal, int signum, up
+ }
+ #define INIT_SIGNAL COMMON_INTERCEPT_FUNCTION(signal)
+ 
+-INTERCEPTOR(int, sigaction, int signum, const __sanitizer_sigaction *act,
+-            __sanitizer_sigaction *oldact) {
 +INTERCEPTOR(int, sigaction_symname, int signum,
 +            const __sanitizer_sigaction *act, __sanitizer_sigaction *oldact) {
    if (GetHandleSignalMode(signum) == kHandleSignalExclusive) return 0;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
index 71f64c615a..14ef1fcd78 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
@@ -10,7 +10,11 @@ $NetBSD$
  }
  
  ThreadContextBase::~ThreadContextBase() {
-@@ -88,6 +89,14 @@ void ThreadContextBase::Reset() {
+@@ -85,9 +86,18 @@ void ThreadContextBase::SetCreated(uptr 
+ void ThreadContextBase::Reset() {
+   status = ThreadStatusInvalid;
+   SetName(0);
++  atomic_store_relaxed(&thread_destroyed, 0);
    OnReset();
  }
  
@@ -25,7 +29,7 @@ $NetBSD$
  // ThreadRegistry implementation.
  
  const u32 ThreadRegistry::kUnknownTid = ~0U;
-@@ -170,14 +179,15 @@ void ThreadRegistry::RunCallbackForEachT
+@@ -170,14 +180,15 @@ void ThreadRegistry::RunCallbackForEachT
    }
  }
  
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
index 34a08169cf..d6c0ce4604 100644
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
@@ -1,8 +1,114 @@
 $NetBSD$
 
---- lib/tsan/rtl/tsan_interceptors.cc.orig	2017-11-23 05:14:46.406806399 +0000
+--- lib/tsan/rtl/tsan_interceptors.cc.orig	2017-11-21 09:38:56.000000000 +0000
 +++ lib/tsan/rtl/tsan_interceptors.cc
-@@ -932,6 +932,7 @@ void DestroyThreadState() {
+@@ -502,15 +502,17 @@ static void SetJmp(ThreadState *thr, upt
+ static void LongJmp(ThreadState *thr, uptr *env) {
+ #ifdef __powerpc__
+   uptr mangled_sp = env[0];
+-#elif SANITIZER_FREEBSD || SANITIZER_NETBSD
++#elif SANITIZER_FREEBSD
+   uptr mangled_sp = env[2];
++#elif SANITIZER_NETBSD
++  uptr mangled_sp = env[6];
+ #elif SANITIZER_MAC
+ # ifdef __aarch64__
+     uptr mangled_sp = env[13];
+ # else
+     uptr mangled_sp = env[2];
+ # endif
+-#elif defined(SANITIZER_LINUX)
++#elif SANITIZER_LINUX
+ # ifdef __aarch64__
+   uptr mangled_sp = env[13];
+ # elif defined(__mips64)
+@@ -548,7 +550,37 @@ extern "C" void __tsan_setjmp(uptr sp, u
+   SetJmp(cur_thread(), sp, mangled_sp);
+ }
+ 
+-#if SANITIZER_MAC
++#if SANITIZER_NETBSD
++// Not called.  Merely to satisfy TSAN_INTERCEPT().
++extern "C" SANITIZER_INTERFACE_ATTRIBUTE
++int __interceptor___setjmp14(void *env);
++extern "C" int __interceptor___setjmp14(void *env) {
++  CHECK(0);
++  return 0;
++}
++
++// FIXME: any reason to have a separate declaration?
++extern "C" SANITIZER_INTERFACE_ATTRIBUTE
++int __interceptor___sigsetjmp14(void *env, int val);
++extern "C" int __interceptor___sigsetjmp14(void *env, int val) {
++  CHECK(0);
++  return 0;
++}
++
++extern "C" SANITIZER_INTERFACE_ATTRIBUTE
++int __interceptor_setjmp(void *env);
++extern "C" int __interceptor_setjmp(void *env) {
++  CHECK(0);
++  return 0;
++}
++
++extern "C" int __setjmp14(void *env);
++extern "C" int __sigsetjmp14(void *env, int val);
++extern "C" int _setjmp(void *env);
++DEFINE_REAL(int, __setjmp14, void *env)
++DEFINE_REAL(int, __sigsetjmp14, void *env, int val)
++DEFINE_REAL(int, _setjmp, void *env)
++#elif SANITIZER_MAC
+ TSAN_INTERCEPTOR(int, setjmp, void *env);
+ TSAN_INTERCEPTOR(int, _setjmp, void *env);
+ TSAN_INTERCEPTOR(int, sigsetjmp, void *env);
+@@ -593,6 +625,38 @@ DEFINE_REAL(int, sigsetjmp, void *env)
+ DEFINE_REAL(int, __sigsetjmp, void *env)
+ #endif  // SANITIZER_MAC
+ 
++#if SANITIZER_NETBSD
++TSAN_INTERCEPTOR(void, __longjmp14, uptr *env, int val) {
++  // Note: if we call REAL(longjmp) in the context of ScopedInterceptor,
++  // bad things will happen. We will jump over ScopedInterceptor dtor and can
++  // leave thr->in_ignored_lib set.
++  {
++    SCOPED_INTERCEPTOR_RAW(__longjmp14, env, val);
++  }
++  LongJmp(cur_thread(), env);
++  REAL(__longjmp14)(env, val);
++}
++
++TSAN_INTERCEPTOR(void, __siglongjmp14, uptr *env, int val) {
++  {
++    SCOPED_INTERCEPTOR_RAW(__siglongjmp14, env, val);
++  }
++  LongJmp(cur_thread(), env);
++  REAL(__siglongjmp14)(env, val);
++}
++
++TSAN_INTERCEPTOR(void, _longjmp, uptr *env, int val) {
++  // Note: if we call REAL(longjmp) in the context of ScopedInterceptor,
++  // bad things will happen. We will jump over ScopedInterceptor dtor and can
++  // leave thr->in_ignored_lib set.
++  {
++    SCOPED_INTERCEPTOR_RAW(_longjmp, env, val);
++  }
++  LongJmp(cur_thread(), env);
++  REAL(_longjmp)(env, val);
++}
++#else
++
+ TSAN_INTERCEPTOR(void, longjmp, uptr *env, int val) {
+   // Note: if we call REAL(longjmp) in the context of ScopedInterceptor,
+   // bad things will happen. We will jump over ScopedInterceptor dtor and can
+@@ -611,6 +675,7 @@ TSAN_INTERCEPTOR(void, siglongjmp, uptr 
+   LongJmp(cur_thread(), env);
+   REAL(siglongjmp)(env, val);
+ }
++#endif
+ 
+ #if !SANITIZER_MAC
+ TSAN_INTERCEPTOR(void*, malloc, uptr size) {
+@@ -868,6 +933,7 @@ void DestroyThreadState() {
    }
    DTLS_Destroy();
    cur_thread_finalize();
@@ -10,7 +116,7 @@ $NetBSD$
  }
  }  // namespace __tsan
  
-@@ -1046,12 +1047,14 @@ TSAN_INTERCEPTOR(int, pthread_create,
+@@ -982,12 +1048,14 @@ TSAN_INTERCEPTOR(int, pthread_create,
  
  TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) {
    SCOPED_INTERCEPTOR_RAW(pthread_join, th, ret);
@@ -27,7 +133,7 @@ $NetBSD$
    }
    return res;
  }
-@@ -1060,10 +1063,10 @@ DEFINE_REAL_PTHREAD_FUNCTIONS
+@@ -996,10 +1064,10 @@ DEFINE_REAL_PTHREAD_FUNCTIONS
  
  TSAN_INTERCEPTOR(int, pthread_detach, void *th) {
    SCOPED_TSAN_INTERCEPTOR(pthread_detach, th);
@@ -40,3 +146,38 @@ $NetBSD$
    }
    return res;
  }
+@@ -2332,7 +2400,7 @@ static __sanitizer_sighandler_ptr signal
+   internal_memset(&act.sa_mask, -1, sizeof(act.sa_mask));
+   act.sa_flags = 0;
+   __sanitizer_sigaction old;
+-  int res = sigaction(sig, &act, &old);
++  int res = sigaction_symname(sig, &act, &old);
+   if (res) return (__sanitizer_sighandler_ptr)sig_err;
+   return old.handler;
+ }
+@@ -2540,6 +2608,17 @@ void InitializeInterceptors() {
+   InitializeCommonInterceptors();
+   InitializeSignalInterceptors();
+ 
++#if SANITIZER_NETBSD
++  using __interception::GetRealFunctionAddress;
++  GetRealFunctionAddress("__setjmp14", (uptr*)&REAL(__setjmp14), 0, 0);
++  GetRealFunctionAddress("__sigsetjmp14", (uptr*)&REAL(__sigsetjmp14), 0, 0);
++  GetRealFunctionAddress("_setjmp", (uptr*)&REAL(_setjmp), 0, 0);
++
++  TSAN_INTERCEPT(__longjmp14);
++  TSAN_INTERCEPT(__siglongjmp14);
++  TSAN_INTERCEPT(_longjmp);
++#else
++
+ #if !SANITIZER_MAC
+   // We can not use TSAN_INTERCEPT to get setjmp addr,
+   // because it does &setjmp and setjmp is not present in some versions of libc.
+@@ -2552,6 +2631,7 @@ void InitializeInterceptors() {
+ 
+   TSAN_INTERCEPT(longjmp);
+   TSAN_INTERCEPT(siglongjmp);
++#endif
+ 
+   TSAN_INTERCEPT(malloc);
+   TSAN_INTERCEPT(__libc_memalign);
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
index ece81092c3..555bdd33ea 100644
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.cc
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- lib/tsan/rtl/tsan_rtl.cc.orig	2017-10-17 18:35:43.000000000 +0000
+--- lib/tsan/rtl/tsan_rtl.cc.orig	2017-11-16 17:55:36.000000000 +0000
 +++ lib/tsan/rtl/tsan_rtl.cc
-@@ -371,7 +371,7 @@ void Initialize(ThreadState *thr) {
+@@ -387,7 +387,7 @@ void Initialize(ThreadState *thr) {
    // On MIPS, TSan initialization is run before
    // __pthread_initialize_minimal_internal() is finished, so we can not spawn
    // new threads.


Home | Main Index | Thread Index | Old Index