Skip to content

Commit

Permalink
Merge pull request #63 from PsiACE:sancov-module
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulGrandperrin committed Aug 17, 2022
2 parents 8ad3fcf + 0d10837 commit 193711a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ default = ["arbitrary"]

[dependencies]
arbitrary = { version = "1", optional = true }
rustc_version = "0.4"

[dev-dependencies]
rand = "0.8"
Expand Down
16 changes: 15 additions & 1 deletion src/bin/cargo-hfuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,22 @@ fn hfuzz_build<T>(args: T, crate_root: &Path, build_type: &BuildType) where T: s
");

if *build_type == BuildType::ReleaseInstrumented {
// The new LLVM pass manager was not enabled in rustc 1.57 as expected:
// https://github.com/rust-lang/rust/pull/91263
// The fix for now is to pass `-C passes=sancov-module` only to nightly
// compilers for which the LLVM version is >= 13.
let version_meta = rustc_version::version_meta().unwrap();
if version_meta.channel == rustc_version::Channel::Nightly && version_meta.llvm_version.map_or(true, |v| v.major >= 13) {
rustflags.push_str("\
-C passes=sancov-module \
");
} else {
rustflags.push_str("\
-C passes=sancov \
");
};

rustflags.push_str("\
-C passes=sancov \
-C llvm-args=-sanitizer-coverage-level=4 \
-C llvm-args=-sanitizer-coverage-trace-pc-guard \
-C llvm-args=-sanitizer-coverage-trace-divs \
Expand Down

0 comments on commit 193711a

Please sign in to comment.