12 #ifndef LLVM_FUZZER_DEFS_H
13 #define LLVM_FUZZER_DEFS_H
24 #define LIBFUZZER_APPLE 0
25 #define LIBFUZZER_LINUX 1
26 #define LIBFUZZER_WINDOWS 0
28 #define LIBFUZZER_APPLE 1
29 #define LIBFUZZER_LINUX 0
30 #define LIBFUZZER_WINDOWS 0
32 #define LIBFUZZER_APPLE 0
33 #define LIBFUZZER_LINUX 0
34 #define LIBFUZZER_WINDOWS 1
36 #error "Support for your platform has not been implemented"
39 #ifndef __has_attribute
40 # define __has_attribute(x) 0
43 #define LIBFUZZER_POSIX LIBFUZZER_APPLE || LIBFUZZER_LINUX
46 # if __has_attribute(target)
47 # define ATTRIBUTE_TARGET_POPCNT __attribute__((target("popcnt")))
49 # define ATTRIBUTE_TARGET_POPCNT
52 # define ATTRIBUTE_TARGET_POPCNT
56 #ifdef __clang__ // avoid gcc warning.
57 # if __has_attribute(no_sanitize)
58 # define ATTRIBUTE_NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory")))
60 # define ATTRIBUTE_NO_SANITIZE_MEMORY
62 # define ALWAYS_INLINE __attribute__((always_inline))
64 # define ATTRIBUTE_NO_SANITIZE_MEMORY
65 # define ALWAYS_INLINE
68 #define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
70 #if defined(__has_feature)
71 # if __has_feature(address_sanitizer)
72 # define ATTRIBUTE_NO_SANITIZE_ALL ATTRIBUTE_NO_SANITIZE_ADDRESS
73 # elif __has_feature(memory_sanitizer)
74 # define ATTRIBUTE_NO_SANITIZE_ALL ATTRIBUTE_NO_SANITIZE_MEMORY
76 # define ATTRIBUTE_NO_SANITIZE_ALL
79 # define ATTRIBUTE_NO_SANITIZE_ALL
83 #define ATTRIBUTE_INTERFACE __declspec(dllexport)
85 #define ATTRIBUTE_INTERFACE __attribute__((visibility("default")))
90 template <
class T>
T Min(
T a,
T b) {
return a < b ? a : b; }
91 template <
class T>
T Max(
T a,
T b) {
return a > b ? a : b; }
95 class DictionaryEntry;
96 class MutationDispatcher;
97 struct FuzzingOptions;
100 struct ExternalFunctions;
103 extern ExternalFunctions *
EF;
105 typedef std::vector<uint8_t>
Unit;
117 inline uint8_t
Bswap(uint8_t x) {
return x; }
118 inline uint16_t
Bswap(uint16_t x) {
return __builtin_bswap16(x); }
120 inline uint64_t
Bswap(uint64_t x) {
return __builtin_bswap64(x); }
128 #endif // LLVM_FUZZER_DEFS_H
int(* UserCallback)(const uint8_t *Data, size_t Size)
~ScopedDoingMyOwnMemOrStr()
uint8_t * ExtraCountersBegin()
static int DoingMyOwnMemOrStr
int FuzzerDriver(int *argc, char ***argv, UserCallback Callback)
void ClearExtraCounters()
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
std::vector< Unit > UnitVector
ScopedDoingMyOwnMemOrStr()
std::vector< uint8_t > Unit
uint8_t * ExtraCountersEnd()