Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ default = ["arbitrary"]
[dependencies]
arbitrary = { version = "1", optional = true }
rustc_version = "0.4"
semver = "1"

[dev-dependencies]
rand = "0.8"
Expand Down
17 changes: 16 additions & 1 deletion src/bin/cargo-hfuzz.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rustc_version::Channel;
use std::env;
use std::fs;
use std::os::unix::process::CommandExt;
Expand Down Expand Up @@ -207,7 +208,21 @@ where
let honggfuzz_target = env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| HONGGFUZZ_TARGET.into());

// HACK: temporary fix, see https://github.com/rust-lang/rust/issues/53945#issuecomment-426824324
let use_gold_linker: bool = match Command::new("which") // check if the gold linker is available
let use_gold_linker: bool = match rustc_version::version_meta() {
Ok(version_meta) => match version_meta.channel {
Channel::Nightly | Channel::Dev => {
// old nightly
version_meta
.commit_date
.map_or(false, |date| *date < *"2025-03-08")
}
Channel::Stable | Channel::Beta => {
// old non-nightly
version_meta.semver < semver::Version::new(1, 87, 0)
}
},
Err(_) => false,
} && match Command::new("which") // only if gold linker is available
.args(&["ld.gold"])
.stdout(Stdio::null())
.stderr(Stdio::null())
Expand Down
Loading