diff --git a/fuzzers/forkserver_libafl_cc/src/lib.rs b/fuzzers/forkserver_libafl_cc/src/lib.rs index 2a56df02cd..2646c42bf2 100644 --- a/fuzzers/forkserver_libafl_cc/src/lib.rs +++ b/fuzzers/forkserver_libafl_cc/src/lib.rs @@ -1,7 +1,7 @@ use libafl_targets::{map_shared_memory, start_forkserver}; #[no_mangle] -pub fn libafl_start_forkserver() { +pub extern "C" fn libafl_start_forkserver() { // Map shared memory region for the edge coverage map map_shared_memory(); // Start the forkserver diff --git a/fuzzers/fuzzbench/src/lib.rs b/fuzzers/fuzzbench/src/lib.rs index eef5e6f119..0542c75789 100644 --- a/fuzzers/fuzzbench/src/lib.rs +++ b/fuzzers/fuzzbench/src/lib.rs @@ -57,7 +57,7 @@ use nix::{self, unistd::dup}; /// The fuzzer main (as `no_mangle` C function) #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/fuzzbench_text/src/lib.rs b/fuzzers/fuzzbench_text/src/lib.rs index b59cf7c4e6..74004cefc6 100644 --- a/fuzzers/fuzzbench_text/src/lib.rs +++ b/fuzzers/fuzzbench_text/src/lib.rs @@ -64,7 +64,7 @@ use nix::{self, unistd::dup}; /// The fuzzer main (as `no_mangle` C function) #[no_mangle] #[allow(clippy::too_many_lines)] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libafl_atheris/src/lib.rs b/fuzzers/libafl_atheris/src/lib.rs index 8d99f52ac3..98bac10a0f 100644 --- a/fuzzers/libafl_atheris/src/lib.rs +++ b/fuzzers/libafl_atheris/src/lib.rs @@ -48,7 +48,7 @@ use libafl_targets::{ /// Set up our coverage map. #[no_mangle] -pub fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) { +pub extern "C" fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) { unsafe { EDGES_MAP_PTR = start; MAX_EDGES_NUM = (stop as usize - start as usize) / 8; @@ -58,7 +58,7 @@ pub fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) { /// `pcs` tables seem to be unused by `Atheris`, so we can ignore this setup function, /// but the symbol is still being called and, hence, required. #[no_mangle] -pub fn __sanitizer_cov_pcs_init(_pcs_beg: *mut u8, _pcs_end: *mut u8) { +pub extern "C" fn __sanitizer_cov_pcs_init(_pcs_beg: *mut u8, _pcs_end: *mut u8) { // noop } @@ -66,7 +66,7 @@ pub fn __sanitizer_cov_pcs_init(_pcs_beg: *mut u8, _pcs_end: *mut u8) { /// This is a PoC implementation and could be improved. /// For example, it only takes up to 8 bytes into consideration. #[no_mangle] -pub fn __sanitizer_weak_hook_memcmp( +pub extern "C" fn __sanitizer_weak_hook_memcmp( _caller_pc: *const c_void, s1: *const c_void, s2: *const c_void, @@ -104,7 +104,7 @@ pub fn __sanitizer_weak_hook_memcmp( /// and jumps back into `Atheris'` instrumented python code. #[no_mangle] #[allow(non_snake_case)] -pub fn LLVMFuzzerRunDriver( +pub extern "C" fn LLVMFuzzerRunDriver( _argc: *const c_int, _argv: *const *const c_char, harness_fn: Option c_int>, diff --git a/fuzzers/libfuzzer_libmozjpeg/src/lib.rs b/fuzzers/libfuzzer_libmozjpeg/src/lib.rs index 034194c204..95a91ce44c 100644 --- a/fuzzers/libfuzzer_libmozjpeg/src/lib.rs +++ b/fuzzers/libfuzzer_libmozjpeg/src/lib.rs @@ -42,7 +42,7 @@ extern "C" { /// The main fn, usually parsing parameters, and starting the fuzzer #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libfuzzer_libpng/src/lib.rs b/fuzzers/libfuzzer_libpng/src/lib.rs index 35b5fe5db5..fbf8f2a2ac 100644 --- a/fuzzers/libfuzzer_libpng/src/lib.rs +++ b/fuzzers/libfuzzer_libpng/src/lib.rs @@ -41,7 +41,7 @@ use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, EDGES_MAP, /// The main fn, `no_mangle` as it is a C main #[cfg(not(test))] #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libfuzzer_libpng_accounting/src/lib.rs b/fuzzers/libfuzzer_libpng_accounting/src/lib.rs index ce62e5ed7d..0f117f166f 100644 --- a/fuzzers/libfuzzer_libpng_accounting/src/lib.rs +++ b/fuzzers/libfuzzer_libpng_accounting/src/lib.rs @@ -113,7 +113,7 @@ struct Opt { /// The main fn, `no_mangle` as it is a C symbol #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libfuzzer_libpng_centralized/src/lib.rs b/fuzzers/libfuzzer_libpng_centralized/src/lib.rs index f5bb6c3b36..8dc3b770f9 100644 --- a/fuzzers/libfuzzer_libpng_centralized/src/lib.rs +++ b/fuzzers/libfuzzer_libpng_centralized/src/lib.rs @@ -112,7 +112,7 @@ struct Opt { /// The main fn, `no_mangle` as it is a C symbol #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { env_logger::init(); // Registry the metadata types used in this fuzzer diff --git a/fuzzers/libfuzzer_libpng_cmin/src/lib.rs b/fuzzers/libfuzzer_libpng_cmin/src/lib.rs index 1fc59e6bf2..e177575338 100644 --- a/fuzzers/libfuzzer_libpng_cmin/src/lib.rs +++ b/fuzzers/libfuzzer_libpng_cmin/src/lib.rs @@ -44,7 +44,7 @@ use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, std_edges_m /// The main fn, `no_mangle` as it is a C main #[cfg(not(test))] #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libfuzzer_libpng_ctx/src/lib.rs b/fuzzers/libfuzzer_libpng_ctx/src/lib.rs index 9ae48549c8..d50f201db1 100644 --- a/fuzzers/libfuzzer_libpng_ctx/src/lib.rs +++ b/fuzzers/libfuzzer_libpng_ctx/src/lib.rs @@ -108,7 +108,7 @@ struct Opt { /// The main fn, `no_mangle` as it is a C symbol #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libfuzzer_libpng_launcher/src/lib.rs b/fuzzers/libfuzzer_libpng_launcher/src/lib.rs index ffef102464..1c0c657c81 100644 --- a/fuzzers/libfuzzer_libpng_launcher/src/lib.rs +++ b/fuzzers/libfuzzer_libpng_launcher/src/lib.rs @@ -111,7 +111,7 @@ struct Opt { /// The main fn, `no_mangle` as it is a C symbol #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libfuzzer_libpng_norestart/src/lib.rs b/fuzzers/libfuzzer_libpng_norestart/src/lib.rs index cabc4a5354..5c76afc983 100644 --- a/fuzzers/libfuzzer_libpng_norestart/src/lib.rs +++ b/fuzzers/libfuzzer_libpng_norestart/src/lib.rs @@ -129,7 +129,7 @@ struct Opt { /// The main fn, `no_mangle` as it is a C symbol #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libfuzzer_reachability/src/lib.rs b/fuzzers/libfuzzer_reachability/src/lib.rs index ad6d049605..96f7320202 100644 --- a/fuzzers/libfuzzer_reachability/src/lib.rs +++ b/fuzzers/libfuzzer_reachability/src/lib.rs @@ -32,7 +32,7 @@ extern "C" { /// The main fn, `no_mangle` as it is a C symbol #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/libfuzzer_windows_asan/src/lib.rs b/fuzzers/libfuzzer_windows_asan/src/lib.rs index 0cb39415a7..e2fb967c41 100644 --- a/fuzzers/libfuzzer_windows_asan/src/lib.rs +++ b/fuzzers/libfuzzer_windows_asan/src/lib.rs @@ -27,7 +27,7 @@ use libafl::{ }; use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, std_edges_map_observer}; #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { println!( "Workdir: {:?}", env::current_dir().unwrap().to_string_lossy().to_string() diff --git a/fuzzers/nautilus_sync/src/lib.rs b/fuzzers/nautilus_sync/src/lib.rs index e94302a65a..91d285b2bd 100644 --- a/fuzzers/nautilus_sync/src/lib.rs +++ b/fuzzers/nautilus_sync/src/lib.rs @@ -100,7 +100,7 @@ struct Opt { /// The main fn, `no_mangle` as it is a C symbol #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::(); diff --git a/fuzzers/tutorial/src/lib.rs b/fuzzers/tutorial/src/lib.rs index 725b732890..d0ca10980e 100644 --- a/fuzzers/tutorial/src/lib.rs +++ b/fuzzers/tutorial/src/lib.rs @@ -36,7 +36,7 @@ use metadata::*; /// The main fn, `no_mangle` as it is a C main #[cfg(not(test))] #[no_mangle] -pub fn libafl_main() { +pub extern "C" fn libafl_main() { // Registry the metadata types used in this fuzzer // Needed only on no_std //RegistryBuilder::register::();