File tree 6 files changed +22
-8
lines changed
6 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -588,7 +588,7 @@ else()
588
588
endif ()
589
589
590
590
if (COMPILER_RT_HAS_SANITIZER_COMMON AND FUZZER_SUPPORTED_ARCH AND
591
- OS_NAME MATCHES "Darwin|Linux" )
591
+ OS_NAME MATCHES "Darwin|Linux|NetBSD " )
592
592
set (COMPILER_RT_HAS_FUZZER TRUE )
593
593
else ()
594
594
set (COMPILER_RT_HAS_FUZZER FALSE )
Original file line number Diff line number Diff line change 25
25
#ifdef __linux__
26
26
#define LIBFUZZER_APPLE 0
27
27
#define LIBFUZZER_LINUX 1
28
+ #define LIBFUZZER_NETBSD 0
28
29
#define LIBFUZZER_WINDOWS 0
29
30
#elif __APPLE__
30
31
#define LIBFUZZER_APPLE 1
31
32
#define LIBFUZZER_LINUX 0
33
+ #define LIBFUZZER_NETBSD 0
34
+ #define LIBFUZZER_WINDOWS 0
35
+ #elif __NetBSD__
36
+ #define LIBFUZZER_APPLE 0
37
+ #define LIBFUZZER_LINUX 0
38
+ #define LIBFUZZER_NETBSD 1
32
39
#define LIBFUZZER_WINDOWS 0
33
40
#elif _WIN32
34
41
#define LIBFUZZER_APPLE 0
35
42
#define LIBFUZZER_LINUX 0
43
+ #define LIBFUZZER_NETBSD 0
36
44
#define LIBFUZZER_WINDOWS 1
37
45
#else
38
46
#error "Support for your platform has not been implemented"
42
50
# define __has_attribute (x ) 0
43
51
#endif
44
52
45
- #define LIBFUZZER_POSIX LIBFUZZER_APPLE || LIBFUZZER_LINUX
53
+ #define LIBFUZZER_POSIX ( LIBFUZZER_APPLE || LIBFUZZER_LINUX || LIBFUZZER_NETBSD)
46
54
47
55
#ifdef __x86_64
48
56
# if __has_attribute(target)
Original file line number Diff line number Diff line change 13
13
// to clients right now.
14
14
// ===----------------------------------------------------------------------===//
15
15
#include " FuzzerDefs.h"
16
- #if LIBFUZZER_LINUX
16
+ #if LIBFUZZER_LINUX || LIBFUZZER_NETBSD
17
17
18
18
#include " FuzzerExtFunctions.h"
19
19
#include " FuzzerIO.h"
@@ -51,4 +51,4 @@ ExternalFunctions::ExternalFunctions() {
51
51
52
52
} // namespace fuzzer
53
53
54
- #endif // LIBFUZZER_LINUX
54
+ #endif // LIBFUZZER_LINUX || LIBFUZZER_NETBSD
Original file line number Diff line number Diff line change 11
11
12
12
#include " FuzzerDefs.h"
13
13
14
- #if LIBFUZZER_LINUX
14
+ #if LIBFUZZER_LINUX || LIBFUZZER_NETBSD
15
15
__attribute__ ((weak)) extern uint8_t __start___libfuzzer_extra_counters;
16
16
__attribute__ ((weak)) extern uint8_t __stop___libfuzzer_extra_counters;
17
17
Original file line number Diff line number Diff line change 9
9
// Misc utils for Linux.
10
10
// ===----------------------------------------------------------------------===//
11
11
#include " FuzzerDefs.h"
12
- #if LIBFUZZER_LINUX
12
+ #if LIBFUZZER_LINUX || LIBFUZZER_NETBSD
13
13
14
14
#include < stdlib.h>
15
15
@@ -21,4 +21,4 @@ int ExecuteCommand(const std::string &Command) {
21
21
22
22
} // namespace fuzzer
23
23
24
- #endif // LIBFUZZER_LINUX
24
+ #endif // LIBFUZZER_LINUX || LIBFUZZER_NETBSD
Original file line number Diff line number Diff line change @@ -68,9 +68,15 @@ statistics from the file. If that fails then the process will quit.
68
68
#ifdef __linux__
69
69
#define LIBFUZZER_LINUX 1
70
70
#define LIBFUZZER_APPLE 0
71
+ #define LIBFUZZER_NETBSD 0
71
72
#elif __APPLE__
72
73
#define LIBFUZZER_LINUX 0
73
74
#define LIBFUZZER_APPLE 1
75
+ #define LIBFUZZER_NETBSD 0
76
+ #elif __NetBSD__
77
+ #define LIBFUZZER_LINUX 0
78
+ #define LIBFUZZER_APPLE 0
79
+ #define LIBFUZZER_NETBSD 1
74
80
#else
75
81
#error "Support for your platform has not been implemented"
76
82
#endif
@@ -119,7 +125,7 @@ size_t GetPeakRSSMb() {
119
125
struct rusage usage;
120
126
if (getrusage (RUSAGE_SELF, &usage))
121
127
return 0 ;
122
- if (LIBFUZZER_LINUX) {
128
+ if (LIBFUZZER_LINUX || LIBFUZZER_NETBSD ) {
123
129
// ru_maxrss is in KiB
124
130
return usage.ru_maxrss >> 10 ;
125
131
} else if (LIBFUZZER_APPLE) {
You can’t perform that action at this time.
0 commit comments