diff --git a/lib/compiler/test_runner.zig b/lib/compiler/test_runner.zig index 2468c12645..3d2187748e 100644 --- a/lib/compiler/test_runner.zig +++ b/lib/compiler/test_runner.zig @@ -345,7 +345,7 @@ const FuzzerSlice = extern struct { var is_fuzz_test: bool = undefined; -extern fn fuzzer_start() void; +extern fn fuzzer_start(testOne: *const fn ([*]const u8, usize) callconv(.C) void) void; extern fn fuzzer_init(cache_dir: FuzzerSlice) void; extern fn fuzzer_coverage_id() u64; @@ -394,8 +394,7 @@ pub fn fuzz( } }; if (builtin.fuzz) { - @export(&global.fuzzer_one, .{ .name = "fuzzer_one" }); - fuzzer_start(); + fuzzer_start(&global.fuzzer_one); return; } diff --git a/lib/fuzzer.zig b/lib/fuzzer.zig index 2aa9744275..6cc8f9cc28 100644 --- a/lib/fuzzer.zig +++ b/lib/fuzzer.zig @@ -423,9 +423,10 @@ export fn fuzzer_coverage_id() u64 { return fuzzer.coverage_id; } -extern fn fuzzer_one(input_ptr: [*]const u8, input_len: usize) callconv(.C) void; +var fuzzer_one: *const fn (input_ptr: [*]const u8, input_len: usize) callconv(.C) void = undefined; -export fn fuzzer_start() void { +export fn fuzzer_start(testOne: @TypeOf(fuzzer_one)) void { + fuzzer_one = testOne; fuzzer.start() catch |err| switch (err) { error.OutOfMemory => fatal("out of memory", .{}), };