pkgsrc-WIP-changes archive

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

compiler-rt-netbsd: Restore libfuzzer/NetBSD



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Tue Aug 22 02:10:55 2017 +0200
Changeset:	e42887d81f74e71e561de1b47734fdc29c8038fd

Added Files:
	compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerDefs.h
	compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerExtFunctionsWeak.cpp
	compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerExtraCounters.cpp
	compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerUtilLinux.cpp
	compiler-rt-netbsd/patches/patch-lib_fuzzer_afl_afl__driver.cpp
	compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt

Log Message:
compiler-rt-netbsd: Restore libfuzzer/NetBSD

Part 3.5

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=e42887d81f74e71e561de1b47734fdc29c8038fd

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

diffstat:
 .../patches/patch-lib_fuzzer_FuzzerDefs.h          | 27 ++++++++++++++++++++
 .../patch-lib_fuzzer_FuzzerExtFunctionsWeak.cpp    | 19 ++++++++++++++
 .../patch-lib_fuzzer_FuzzerExtraCounters.cpp       | 13 ++++++++++
 .../patches/patch-lib_fuzzer_FuzzerUtilLinux.cpp   | 19 ++++++++++++++
 .../patches/patch-lib_fuzzer_afl_afl__driver.cpp   | 29 ++++++++++++++++++++++
 .../patches/patch-lib_fuzzer_tests_CMakeLists.txt  | 14 +++++++++++
 6 files changed, 121 insertions(+)

diffs:
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerDefs.h b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerDefs.h
new file mode 100644
index 0000000000..0e5e5e39c1
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerDefs.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- lib/fuzzer/FuzzerDefs.h.orig	2017-08-21 23:23:37.000000000 +0000
++++ lib/fuzzer/FuzzerDefs.h
+@@ -23,14 +23,22 @@
+ #ifdef __linux__
+ #define LIBFUZZER_APPLE 0
+ #define LIBFUZZER_LINUX 1
++#define LIBFUZZER_NETBSD 0
+ #define LIBFUZZER_WINDOWS 0
+ #elif __APPLE__
+ #define LIBFUZZER_APPLE 1
+ #define LIBFUZZER_LINUX 0
++#define LIBFUZZER_NETBSD 0
++#define LIBFUZZER_WINDOWS 0
++#elif __NetBSD__
++#define LIBFUZZER_APPLE 0
++#define LIBFUZZER_LINUX 0
++#define LIBFUZZER_NETBSD 1
+ #define LIBFUZZER_WINDOWS 0
+ #elif _WIN32
+ #define LIBFUZZER_APPLE 0
+ #define LIBFUZZER_LINUX 0
++#define LIBFUZZER_NETBSD 0
+ #define LIBFUZZER_WINDOWS 1
+ #else
+ #error "Support for your platform has not been implemented"
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerExtFunctionsWeak.cpp b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerExtFunctionsWeak.cpp
new file mode 100644
index 0000000000..bbf520bbb7
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerExtFunctionsWeak.cpp
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- lib/fuzzer/FuzzerExtFunctionsWeak.cpp.orig	2017-08-21 23:23:37.000000000 +0000
++++ lib/fuzzer/FuzzerExtFunctionsWeak.cpp
+@@ -13,7 +13,7 @@
+ // to clients right now.
+ //===----------------------------------------------------------------------===//
+ #include "FuzzerDefs.h"
+-#if LIBFUZZER_LINUX
++#if LIBFUZZER_LINUX || LIBFUZZER_NETBSD
+ 
+ #include "FuzzerExtFunctions.h"
+ #include "FuzzerIO.h"
+@@ -51,4 +51,4 @@ ExternalFunctions::ExternalFunctions() {
+ 
+ } // namespace fuzzer
+ 
+-#endif // LIBFUZZER_LINUX
++#endif // LIBFUZZER_LINUX || LIBFUZZER_NETBSD
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerExtraCounters.cpp b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerExtraCounters.cpp
new file mode 100644
index 0000000000..70ec4a0a45
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerExtraCounters.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- lib/fuzzer/FuzzerExtraCounters.cpp.orig	2017-08-21 23:23:37.000000000 +0000
++++ lib/fuzzer/FuzzerExtraCounters.cpp
+@@ -11,7 +11,7 @@
+ 
+ #include "FuzzerDefs.h"
+ 
+-#if LIBFUZZER_LINUX
++#if LIBFUZZER_LINUX || LIBFUZZER_NETBSD
+ __attribute__((weak)) extern uint8_t __start___libfuzzer_extra_counters;
+ __attribute__((weak)) extern uint8_t __stop___libfuzzer_extra_counters;
+ 
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerUtilLinux.cpp b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerUtilLinux.cpp
new file mode 100644
index 0000000000..957c2b9552
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_FuzzerUtilLinux.cpp
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- lib/fuzzer/FuzzerUtilLinux.cpp.orig	2017-08-21 23:23:37.000000000 +0000
++++ lib/fuzzer/FuzzerUtilLinux.cpp
+@@ -9,7 +9,7 @@
+ // Misc utils for Linux.
+ //===----------------------------------------------------------------------===//
+ #include "FuzzerDefs.h"
+-#if LIBFUZZER_LINUX
++#if LIBFUZZER_LINUX || LIBFUZZER_NETBSD
+ 
+ #include <stdlib.h>
+ 
+@@ -21,4 +21,4 @@ int ExecuteCommand(const std::string &Co
+ 
+ } // namespace fuzzer
+ 
+-#endif // LIBFUZZER_LINUX
++#endif // LIBFUZZER_LINUX || LIBFUZZER_NETBSD
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_afl_afl__driver.cpp b/compiler-rt-netbsd/patches/patch-lib_fuzzer_afl_afl__driver.cpp
new file mode 100644
index 0000000000..f75a6acd88
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_afl_afl__driver.cpp
@@ -0,0 +1,29 @@
+$NetBSD$
+
+--- lib/fuzzer/afl/afl_driver.cpp.orig	2017-08-21 23:23:37.000000000 +0000
++++ lib/fuzzer/afl/afl_driver.cpp
+@@ -68,9 +68,15 @@ statistics from the file. If that fails 
+ #ifdef __linux__
+ #define LIBFUZZER_LINUX 1
+ #define LIBFUZZER_APPLE 0
++#define LIBFUZZER_NETBSD 0
+ #elif __APPLE__
+ #define LIBFUZZER_LINUX 0
+ #define LIBFUZZER_APPLE 1
++#define LIBFUZZER_NETBSD 0
++#elif __NetBSD__
++#define LIBFUZZER_LINUX 0
++#define LIBFUZZER_APPLE 0
++#define LIBFUZZER_NETBSD 1
+ #else
+ #error "Support for your platform has not been implemented"
+ #endif
+@@ -119,7 +125,7 @@ size_t GetPeakRSSMb() {
+   struct rusage usage;
+   if (getrusage(RUSAGE_SELF, &usage))
+     return 0;
+-  if (LIBFUZZER_LINUX) {
++  if (LIBFUZZER_LINUX || LIBFUZZER_NETBSD) {
+     // ru_maxrss is in KiB
+     return usage.ru_maxrss >> 10;
+   } else if (LIBFUZZER_APPLE) {
diff --git a/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt b/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
new file mode 100644
index 0000000000..1bc158c2c8
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_fuzzer_tests_CMakeLists.txt
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- lib/fuzzer/tests/CMakeLists.txt.orig	2017-08-21 23:23:37.000000000 +0000
++++ lib/fuzzer/tests/CMakeLists.txt
+@@ -10,6 +10,9 @@ add_custom_target(FuzzerUnitTests)
+ set_target_properties(FuzzerUnitTests PROPERTIES FOLDER "Compiler-RT Tests")
+ 
+ set(LIBFUZZER_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_LINK_FLAGS})
++if (OS_NAME MATCHES "NetBSD")
++  list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lrt)
++endif()
+ list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS --driver-mode=g++)
+ 
+ if(APPLE)


Home | Main Index | Thread Index | Old Index