Skip to content

Commit 57554a7

Browse files
committed
Update for new LLVM pass manager
1 parent 2913404 commit 57554a7

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/bin/cargo-afl.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,26 @@ where
295295

296296
// add some flags to sanitizers to make them work with Rust code
297297
let asan_options = env::var("ASAN_OPTIONS").unwrap_or_default();
298-
let asan_options = format!("detect_odr_violation=0:abort_on_error=1:symbolize=0:{}", asan_options);
298+
let asan_options = format!(
299+
"detect_odr_violation=0:abort_on_error=1:symbolize=0:{}",
300+
asan_options
301+
);
299302

300303
let tsan_options = env::var("TSAN_OPTIONS").unwrap_or_default();
301304
let tsan_options = format!("report_signal_unsafe=0:{}", tsan_options);
302305

306+
let passes = if rustc_version::version().unwrap().minor >= 57 {
307+
// New LLVM pass manager introduced in Rust 1.57
308+
"sancov-module"
309+
} else {
310+
"sancov"
311+
};
312+
303313
let mut rustflags = format!(
304314
"--cfg fuzzing \
305315
-C debug-assertions \
306316
-C overflow_checks \
307-
-C passes=sancov \
317+
-C passes={} \
308318
-C llvm-args=-sanitizer-coverage-level=3 \
309319
-C llvm-args=-sanitizer-coverage-trace-pc-guard \
310320
-C llvm-args=-sanitizer-coverage-prune-blocks=0 \
@@ -313,6 +323,7 @@ where
313323
-C debuginfo=0 \
314324
-l afl-llvm-rt \
315325
-L {} ",
326+
passes,
316327
common::afl_llvm_rt_dir().display()
317328
);
318329

@@ -323,14 +334,15 @@ where
323334
"--cfg fuzzing \
324335
-C debug-assertions \
325336
-C overflow_checks \
326-
-C passes=sancov \
337+
-C passes={} \
327338
-C llvm-args=-sanitizer-coverage-level=3 \
328339
-C llvm-args=-sanitizer-coverage-trace-pc-guard \
329340
-C llvm-args=-sanitizer-coverage-prune-blocks=0 \
330341
-C opt-level=3 \
331342
-C target-cpu=native \
332343
-C debuginfo=0 \
333344
-L {} ",
345+
passes,
334346
common::afl_llvm_rt_dir().display()
335347
);
336348

0 commit comments

Comments
 (0)