pkgsrc-WIP-changes archive

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

compiler-rt-commonsan: Reintroduce lib/interception / NetBSD



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Jul 9 18:04:22 2017 +0200
Changeset:	3483f8266001bbcc2b67f4eddf87ae969364a8bc

Modified Files:
	compiler-rt-commonsan/distinfo
Added Files:
	compiler-rt-commonsan/patches/patch-lib_interception_interception.h
	compiler-rt-commonsan/patches/patch-lib_interception_interception__linux.cc
	compiler-rt-commonsan/patches/patch-lib_interception_interception__linux.h

Log Message:
compiler-rt-commonsan: Reintroduce lib/interception / NetBSD

This is required to run "check-sanitizer".

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=3483f8266001bbcc2b67f4eddf87ae969364a8bc

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

diffstat:
 compiler-rt-commonsan/distinfo                     |  3 ++
 .../patches/patch-lib_interception_interception.h  | 33 ++++++++++++++++++
 .../patch-lib_interception_interception__linux.cc  | 39 ++++++++++++++++++++++
 .../patch-lib_interception_interception__linux.h   | 19 +++++++++++
 4 files changed, 94 insertions(+)

diffs:
diff --git a/compiler-rt-commonsan/distinfo b/compiler-rt-commonsan/distinfo
index f8df043ea9..16c50678a4 100644
--- a/compiler-rt-commonsan/distinfo
+++ b/compiler-rt-commonsan/distinfo
@@ -13,6 +13,9 @@ SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-cmake_config-ix.cmake) = c4dd6f1e8c3bbe467c7c0ad756e29f423d0b392c
+SHA1 (patch-lib_interception_interception.h) = e6826deb85420ac5c7d9594d5d4364767d22389f
+SHA1 (patch-lib_interception_interception__linux.cc) = 9748f01fb3621c51197a435422e658b9f694dc01
+SHA1 (patch-lib_interception_interception__linux.h) = 8ab24466d85d19d0c5dd35c5867a7cc958009143
 SHA1 (patch-lib_sanitizer__common_CMakeLists.txt) = 2ffbb5737ae8cfb230e12eed87e38c209311168e
 SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = 3e2f5c06d54209d981835d11e272f7cff9086ffb
 SHA1 (patch-lib_sanitizer__common_sanitizer__libignore.cc) = 57eb2b213bd0eb664524aa0e047d5e73d4956ad2
diff --git a/compiler-rt-commonsan/patches/patch-lib_interception_interception.h b/compiler-rt-commonsan/patches/patch-lib_interception_interception.h
new file mode 100644
index 0000000000..7faa04119b
--- /dev/null
+++ b/compiler-rt-commonsan/patches/patch-lib_interception_interception.h
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- lib/interception/interception.h.orig	2017-07-03 15:33:06.000000000 +0000
++++ lib/interception/interception.h
+@@ -15,8 +15,8 @@
+ #ifndef INTERCEPTION_H
+ #define INTERCEPTION_H
+ 
+-#if !defined(__linux__) && !defined(__FreeBSD__) && \
+-  !defined(__APPLE__) && !defined(_WIN32)
++#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
++    !defined(__APPLE__) && !defined(_WIN32)
+ # error "Interception doesn't work on this operating system."
+ #endif
+ 
+@@ -129,7 +129,7 @@ const interpose_substitution substitutio
+     extern "C" ret_type func(__VA_ARGS__);
+ # define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \
+     extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__);
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__NetBSD__)
+ # define WRAP(x) __interceptor_ ## x
+ # define WRAPPER_NAME(x) "__interceptor_" #x
+ # define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default")))
+@@ -241,7 +241,7 @@ typedef unsigned long uptr;  // NOLINT
+ 
+ #define INCLUDED_FROM_INTERCEPTION_LIB
+ 
+-#if defined(__linux__) || defined(__FreeBSD__)
++#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
+ # include "interception_linux.h"
+ # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
+ # define INTERCEPT_FUNCTION_VER(func, symver) \
diff --git a/compiler-rt-commonsan/patches/patch-lib_interception_interception__linux.cc b/compiler-rt-commonsan/patches/patch-lib_interception_interception__linux.cc
new file mode 100644
index 0000000000..06d8d980c3
--- /dev/null
+++ b/compiler-rt-commonsan/patches/patch-lib_interception_interception__linux.cc
@@ -0,0 +1,39 @@
+$NetBSD$
+
+--- lib/interception/interception_linux.cc.orig	2017-07-03 15:33:06.000000000 +0000
++++ lib/interception/interception_linux.cc
+@@ -12,14 +12,26 @@
+ // Linux-specific interception methods.
+ //===----------------------------------------------------------------------===//
+ 
+-#if defined(__linux__) || defined(__FreeBSD__)
++#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
+ #include "interception.h"
+ 
+ #include <dlfcn.h>   // for dlsym() and dlvsym()
+ 
++#ifdef __NetBSD__
++static int mystrcmp(const char *s1, const char *s2) {
++  while (*s1 == *s2++)
++    if (*s1++ == 0) return (0);
++  return (*(const unsigned char *)s1 - *(const unsigned char *)--s2);
++}
++#endif
++
+ namespace __interception {
+ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
+     uptr real, uptr wrapper) {
++#ifdef __NetBSD__
++  // XXX: Until I come up with something better to deal with renames.
++  if (mystrcmp(func_name, "sigaction") == 0) func_name = "__sigaction14";
++#endif
+   *func_addr = (uptr)dlsym(RTLD_NEXT, func_name);
+   return real == wrapper;
+ }
+@@ -32,5 +44,4 @@ void *GetFuncAddrVer(const char *func_na
+ 
+ }  // namespace __interception
+ 
+-
+-#endif  // __linux__ || __FreeBSD__
++#endif  // __linux__ || __FreeBSD__ || __NetBSD__
diff --git a/compiler-rt-commonsan/patches/patch-lib_interception_interception__linux.h b/compiler-rt-commonsan/patches/patch-lib_interception_interception__linux.h
new file mode 100644
index 0000000000..0535469d53
--- /dev/null
+++ b/compiler-rt-commonsan/patches/patch-lib_interception_interception__linux.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- lib/interception/interception_linux.h.orig	2017-07-03 15:33:06.000000000 +0000
++++ lib/interception/interception_linux.h
+@@ -12,7 +12,7 @@
+ // Linux-specific interception methods.
+ //===----------------------------------------------------------------------===//
+ 
+-#if defined(__linux__) || defined(__FreeBSD__)
++#if defined(__linux__) || defined(__FreeBSD__) | defined(__NetBSD__)
+ 
+ #if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
+ # error "interception_linux.h should be included from interception library only"
+@@ -44,4 +44,4 @@ void *GetFuncAddrVer(const char *func_na
+ #endif  // !defined(__ANDROID__)
+ 
+ #endif  // INTERCEPTION_LINUX_H
+-#endif  // __linux__ || __FreeBSD__
++#endif  // __linux__ || __FreeBSD__ || __NetBSD__


Home | Main Index | Thread Index | Old Index