| ... | @@ -31,6 +31,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -31,6 +31,7 @@ pub fn build(b: *std.Build) void { |
| 31 | // | 31 | // |
| 32 | | 32 | |
| 33 | const fuzz_exe = addFuzzer(b, target, "yaml", &.{}); | 33 | const fuzz_exe = addFuzzer(b, target, "yaml", &.{}); |
| | 34 | b.getInstallStep().dependOn(&fuzz_exe.step); |
| 34 | | 35 | |
| 35 | const fuzz_run = b.addSystemCommand(&.{"afl-fuzz"}); | 36 | const fuzz_run = b.addSystemCommand(&.{"afl-fuzz"}); |
| 36 | fuzz_run.step.dependOn(&fuzz_exe.step); | 37 | fuzz_run.step.dependOn(&fuzz_exe.step); |
| ... | @@ -54,17 +55,19 @@ fn addFuzzer(b: *std.Build, target: std.Build.ResolvedTarget, comptime name: []c | ... | @@ -54,17 +55,19 @@ fn addFuzzer(b: *std.Build, target: std.Build.ResolvedTarget, comptime name: []c |
| 54 | .optimize = .Debug, | 55 | .optimize = .Debug, |
| 55 | }), | 56 | }), |
| 56 | }); | 57 | }); |
| 57 | fuzz_lib.want_lto = true; | 58 | fuzz_lib.lto = .full; |
| 58 | fuzz_lib.bundle_compiler_rt = true; | 59 | fuzz_lib.bundle_compiler_rt = true; |
| 59 | fuzz_lib.use_llvm = true; | 60 | fuzz_lib.use_llvm = true; |
| 60 | fuzz_lib.use_lld = true; | 61 | fuzz_lib.use_lld = true; |
| 61 | fuzz_lib.root_module.pic = true; | 62 | fuzz_lib.root_module.pic = true; |
| | 63 | fuzz_lib.root_module.link_libc = true; |
| | 64 | fuzz_lib.bundle_ubsan_rt = true; |
| 62 | | 65 | |
| 63 | deps.addAllTo(fuzz_lib); | 66 | deps.addAllTo(fuzz_lib); |
| 64 | | 67 | |
| 65 | const fuzz_executable_name = "fuzz-" ++ name; | 68 | const fuzz_executable_name = "fuzz-" ++ name; |
| 66 | | 69 | |
| 67 | const fuzz_compile = b.addSystemCommand(&.{ "afl-clang-lto", "-v", "-o" }); | 70 | const fuzz_compile = b.addSystemCommand(&.{ "afl-clang-lto", "-o" }); |
| 68 | const output_path = fuzz_compile.addOutputFileArg(fuzz_executable_name); | 71 | const output_path = fuzz_compile.addOutputFileArg(fuzz_executable_name); |
| 69 | fuzz_compile.addArtifactArg(fuzz_lib); | 72 | fuzz_compile.addArtifactArg(fuzz_lib); |
| 70 | fuzz_compile.addArgs(afl_clang_args); | 73 | fuzz_compile.addArgs(afl_clang_args); |