1c5f01b2fSopenharmony_ci//===- FuzzerExtFunctions.def - External functions --------------*- C++ -* ===//
2c5f01b2fSopenharmony_ci//
3c5f01b2fSopenharmony_ci//                     The LLVM Compiler Infrastructure
4c5f01b2fSopenharmony_ci//
5c5f01b2fSopenharmony_ci// This file is distributed under the University of Illinois Open Source
6c5f01b2fSopenharmony_ci// License. See LICENSE.TXT for details.
7c5f01b2fSopenharmony_ci//
8c5f01b2fSopenharmony_ci//===----------------------------------------------------------------------===//
9c5f01b2fSopenharmony_ci// This defines the external function pointers that
10c5f01b2fSopenharmony_ci// ``fuzzer::ExternalFunctions`` should contain and try to initialize.  The
11c5f01b2fSopenharmony_ci// EXT_FUNC macro must be defined at the point of inclusion. The signature of
12c5f01b2fSopenharmony_ci// the macro is:
13c5f01b2fSopenharmony_ci//
14c5f01b2fSopenharmony_ci// EXT_FUNC(<name>, <return_type>, <function_signature>, <warn_if_missing>)
15c5f01b2fSopenharmony_ci//===----------------------------------------------------------------------===//
16c5f01b2fSopenharmony_ci
17c5f01b2fSopenharmony_ci// Optional user functions
18c5f01b2fSopenharmony_ciEXT_FUNC(LLVMFuzzerInitialize, int, (int *argc, char ***argv), false);
19c5f01b2fSopenharmony_ciEXT_FUNC(LLVMFuzzerCustomMutator, size_t,
20c5f01b2fSopenharmony_ci         (uint8_t * Data, size_t Size, size_t MaxSize, unsigned int Seed),
21c5f01b2fSopenharmony_ci         false);
22c5f01b2fSopenharmony_ciEXT_FUNC(LLVMFuzzerCustomCrossOver, size_t,
23c5f01b2fSopenharmony_ci         (const uint8_t * Data1, size_t Size1,
24c5f01b2fSopenharmony_ci          const uint8_t * Data2, size_t Size2,
25c5f01b2fSopenharmony_ci          uint8_t * Out, size_t MaxOutSize, unsigned int Seed),
26c5f01b2fSopenharmony_ci         false);
27c5f01b2fSopenharmony_ci
28c5f01b2fSopenharmony_ci// Sanitizer functions
29c5f01b2fSopenharmony_ciEXT_FUNC(__lsan_enable, void, (), false);
30c5f01b2fSopenharmony_ciEXT_FUNC(__lsan_disable, void, (), false);
31c5f01b2fSopenharmony_ciEXT_FUNC(__lsan_do_recoverable_leak_check, int, (), false);
32c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_get_number_of_counters, size_t, (), false);
33c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_install_malloc_and_free_hooks, int,
34c5f01b2fSopenharmony_ci         (void (*malloc_hook)(const volatile void *, size_t),
35c5f01b2fSopenharmony_ci          void (*free_hook)(const volatile void *)),
36c5f01b2fSopenharmony_ci         false);
37c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_get_total_unique_caller_callee_pairs, size_t, (), false);
38c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_get_total_unique_coverage, size_t, (), true);
39c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_print_memory_profile, int, (size_t), false);
40c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_print_stack_trace, void, (), true);
41c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_symbolize_pc, void,
42c5f01b2fSopenharmony_ci         (void *, const char *fmt, char *out_buf, size_t out_buf_size), false);
43c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_get_module_and_offset_for_pc, int,
44c5f01b2fSopenharmony_ci         (void *pc, char *module_path,
45c5f01b2fSopenharmony_ci         size_t module_path_len,void **pc_offset), false);
46c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_reset_coverage, void, (), true);
47c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_set_death_callback, void, (void (*)(void)), true);
48c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_set_report_fd, void, (void*), false);
49c5f01b2fSopenharmony_ciEXT_FUNC(__sanitizer_update_counter_bitset_and_clear_counters, uintptr_t,
50c5f01b2fSopenharmony_ci  (uint8_t*), false);
51