authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-28 14:52:57-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-28 18:07:13-07:00
log1bec824cadba7870d6e2b52588d782f32be44866
tree82822dabd0f63d294221220b4fddb31aa98c880d
parent88bba4c15463796c0b89a4d097366b11bdb7679c

LLVM: disable inline 8-bit counters when using trace pc guard


2 files changed, 12 insertions(+), 5 deletions(-)

lib/std/Build/Step/Compile.zig+11-5
......@@ -218,12 +218,18 @@ no_builtin: bool = false,
218218/// Managed by the build runner, not user build script.
219219zig_process: ?*Step.ZigProcess,
220220
221/// Enables deprecated coverage instrumentation that is only useful if you
222/// are using third party fuzzers that depend on it. Otherwise, slows down
223/// the instrumented binary with unnecessary function calls.
221/// Enables coverage instrumentation that is only useful if you are using third
222/// party fuzzers that depend on it. Otherwise, slows down the instrumented
223/// binary with unnecessary function calls.
224224///
225/// To enable fuzz testing instrumentation on a compilation, see the `fuzz`
226/// flag in `Module`.
225/// This kind of coverage instrumentation is used by AFLplusplus v4.21c,
226/// however, modern fuzzers - including Zig - have switched to using "inline
227/// 8-bit counters" or "inline bool flag" which incurs only a single
228/// instruction for coverage, along with "trace cmp" which instruments
229/// comparisons and reports the operands.
230///
231/// To instead enable fuzz testing instrumentation on a compilation using Zig's
232/// builtin fuzzer, see the `fuzz` flag in `Module`.
227233sanitize_coverage_trace_pc_guard: ?bool = null,
228234
229235pub const ExpectedCompileErrors = union(enum) {
src/codegen/llvm.zig+1
......@@ -1664,6 +1664,7 @@ pub const Object = struct {
16641664 if (!owner_mod.fuzz) break :f null;
16651665 if (func_analysis.disable_instrumentation) break :f null;
16661666 if (is_naked) break :f null;
1667 if (comp.config.san_cov_trace_pc_guard) break :f null;
16671668
16681669 // The void type used here is a placeholder to be replaced with an
16691670 // array of the appropriate size after the POI count is known.