pkgsrc-WIP-changes archive

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

compiler-rt-netbsd: Update to SVN r. 346579



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sat Nov 10 04:01:39 2018 +0100
Changeset:	8232732c575089819a4d3f4046ea2890eadce4c5

Modified Files:
	compiler-rt-netbsd/Makefile
Removed Files:
	compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc

Log Message:
compiler-rt-netbsd: Update to SVN r. 346579

Merged:
[compiler-rt] r346579 - Correct atexit(3) support in MSan/NetBSD

Thanks mgorny@ for debugging on Linux.

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

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 +-
 .../patches/patch-lib_msan_msan__interceptors.cc   | 112 ---------------------
 2 files changed, 1 insertion(+), 113 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/Makefile b/compiler-rt-netbsd/Makefile
index 6da41b934a..98a29e6323 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=	346352
+SVN_REVISION.compiler-rt=	346579
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	http://compiler-rt.llvm.org/
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
deleted file mode 100644
index 0124b05fec..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-$NetBSD$
-
---- lib/msan/msan_interceptors.cc.orig	2018-11-04 15:43:06.000000000 +0000
-+++ lib/msan/msan_interceptors.cc
-@@ -34,6 +34,7 @@
- #include "sanitizer_common/sanitizer_libc.h"
- #include "sanitizer_common/sanitizer_linux.h"
- #include "sanitizer_common/sanitizer_tls_get_addr.h"
-+#include "sanitizer_common/sanitizer_vector.h"
- 
- #if SANITIZER_NETBSD
- #define fstat __fstat50
-@@ -1086,23 +1087,78 @@ struct MSanAtExitRecord {
-   void *arg;
- };
- 
--void MSanAtExitWrapper(void *arg) {
-+struct InterceptorContext {
-+  BlockingMutex atexit_mu;
-+  Vector<struct MSanAtExitRecord *> AtExitStack;
-+
-+  InterceptorContext()
-+      : AtExitStack() {
-+  }
-+};
-+
-+static ALIGNED(64) char interceptor_placeholder[sizeof(InterceptorContext)];
-+InterceptorContext *interceptor_ctx() {
-+  return reinterpret_cast<InterceptorContext*>(&interceptor_placeholder[0]);
-+}
-+
-+void MSanAtExitWrapper() {
-+  MSanAtExitRecord *r;
-+  {
-+    BlockingMutexLock l(&interceptor_ctx()->atexit_mu);
-+
-+    uptr element = interceptor_ctx()->AtExitStack.Size() - 1;
-+    r = interceptor_ctx()->AtExitStack[element];
-+    interceptor_ctx()->AtExitStack.PopBack();
-+  }
-+
-+  UnpoisonParam(1);
-+  ((void(*)())r->func)();
-+  InternalFree(r);
-+}
-+
-+void MSanCxaAtExitWrapper(void *arg) {
-   UnpoisonParam(1);
-   MSanAtExitRecord *r = (MSanAtExitRecord *)arg;
-   r->func(r->arg);
-   InternalFree(r);
- }
- 
-+static int setup_at_exit_wrapper(void(*f)(), void *arg, void *dso);
-+
-+// Unpoison argument shadow for C++ module destructors.
-+INTERCEPTOR(int, atexit, void (*func)()) {
-+  if (msan_init_is_running) return REAL(atexit)(func);
-+  return setup_at_exit_wrapper((void(*)())func, 0, 0);
-+}
-+
- // Unpoison argument shadow for C++ module destructors.
- INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
-             void *dso_handle) {
-   if (msan_init_is_running) return REAL(__cxa_atexit)(func, arg, dso_handle);
-+  return setup_at_exit_wrapper((void(*)())func, arg, dso_handle);
-+}
-+
-+static int setup_at_exit_wrapper(void(*f)(), void *arg, void *dso) {
-   ENSURE_MSAN_INITED();
-   MSanAtExitRecord *r =
-       (MSanAtExitRecord *)InternalAlloc(sizeof(MSanAtExitRecord));
--  r->func = func;
-+  r->func = (void(*)(void *a))f;
-   r->arg = arg;
--  return REAL(__cxa_atexit)(MSanAtExitWrapper, r, dso_handle);
-+  int res;
-+  if (!dso) {
-+    // NetBSD does not preserve the 2nd argument if dso is equal to 0
-+    // Store ctx in a local stack-like structure
-+
-+    BlockingMutexLock l(&interceptor_ctx()->atexit_mu);
-+
-+    res = REAL(__cxa_atexit)((void (*)(void *a))MSanAtExitWrapper, 0, 0);
-+    if (!res) {
-+      interceptor_ctx()->AtExitStack.PushBack(r);
-+    }
-+  } else {
-+    res = REAL(__cxa_atexit)(MSanCxaAtExitWrapper, r, dso);
-+  }
-+  return res;
- }
- 
- static void BeforeFork() {
-@@ -1522,6 +1578,9 @@ namespace __msan {
- void InitializeInterceptors() {
-   static int inited = 0;
-   CHECK_EQ(inited, 0);
-+
-+  new(interceptor_ctx()) InterceptorContext();
-+
-   InitializeCommonInterceptors();
-   InitializeSignalInterceptors();
- 
-@@ -1631,6 +1690,7 @@ void InitializeInterceptors() {
- 
-   INTERCEPT_FUNCTION(pthread_join);
-   INTERCEPT_FUNCTION(tzset);
-+  INTERCEPT_FUNCTION(atexit);
-   INTERCEPT_FUNCTION(__cxa_atexit);
-   INTERCEPT_FUNCTION(shmat);
-   INTERCEPT_FUNCTION(fork);


Home | Main Index | Thread Index | Old Index