From 7295e4f63764bddc2eb049bec3b52666b12fe72b Mon Sep 17 00:00:00 2001 From: Brendan Hansknecht Date: Sat, 11 Oct 2025 11:00:24 -0700 Subject: [PATCH] fix canonicalize fuzzer --- build.zig | 6 +++++- build.zig.zon | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build.zig b/build.zig index eaeddfd587..7a981dc005 100644 --- a/build.zig +++ b/build.zig @@ -543,6 +543,10 @@ fn add_fuzz_target( // Work around instrumentation bugs on mac without giving up perf on linux. .optimize = if (target.result.os.tag == .macos) .Debug else .ReleaseSafe, }); + // Required for fuzzing. + fuzz_obj.root_module.link_libc = true; + fuzz_obj.root_module.stack_check = false; + roc_modules.addAll(fuzz_obj); add_tracy(b, roc_modules.build_options, fuzz_obj, target, false, tracy); @@ -565,7 +569,7 @@ fn add_fuzz_target( b.default_step.dependOn(fuzz_step); const afl = b.lazyImport(@This(), "afl_kit") orelse return; - const fuzz_exe = afl.addInstrumentedExe(b, target, .ReleaseSafe, &.{}, use_system_afl, fuzz_obj) orelse return; + const fuzz_exe = afl.addInstrumentedExe(b, target, .ReleaseSafe, &.{}, use_system_afl, fuzz_obj, &.{"-lm"}) orelse return; const install_fuzz = b.addInstallBinFile(fuzz_exe, name_exe); fuzz_step.dependOn(&install_fuzz.step); b.getInstallStep().dependOn(&install_fuzz.step); diff --git a/build.zig.zon b/build.zig.zon index 7d4b415962..b2bb235958 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -4,8 +4,8 @@ .minimum_zig_version = "0.14.0", .dependencies = .{ .afl_kit = .{ - .url = "git+https://github.com/bhansconnect/zig-afl-kit?ref=zig-0.14.0#9f09f8e5c29102b94d775305801315320515a2b8", - .hash = "afl_kit-0.1.0-uhOgGEEbAADSSVtFLWc0eoZFxVLiELWLNldB9K_f9x5L", + .url = "git+https://github.com/bhansconnect/zig-afl-kit?ref=main#b863c41ca47ed05729e0b509fb1926c111aa2800", + .hash = "afl_kit-0.1.0-NdJ3cncdAAA4154gtkRqNApovBYfOs-LWADNE-9BzzPC", .lazy = true, }, .roc_deps_aarch64_macos_none = .{