Skip to content

Commit 25719ec

Browse files
committed
Remove archive
1 parent 439c052 commit 25719ec

File tree

3 files changed

+6
-32
lines changed

3 files changed

+6
-32
lines changed

cargo-afl/src/common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ pub fn object_file_path() -> Result<PathBuf> {
5555
afl_llvm_dir().map(|path| path.join("libafl-llvm-rt.o"))
5656
}
5757

58-
pub fn archive_file_path() -> Result<PathBuf> {
59-
afl_llvm_dir().map(|path| path.join("libafl-llvm-rt.a"))
60-
}
61-
6258
pub fn plugins_available() -> Result<bool> {
6359
let afl_llvm_dir = afl_llvm_dir()?;
6460
for result in afl_llvm_dir

cargo-afl/src/config.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ use super::common;
1010

1111
const AFL_SRC_PATH: &str = "AFLplusplus";
1212

13-
// https://github.com/rust-fuzz/afl.rs/issues/148
14-
#[cfg(target_os = "macos")]
15-
static AR_CMD: &str = "/usr/bin/ar";
16-
#[cfg(not(target_os = "macos"))]
17-
static AR_CMD: &str = "ar";
18-
1913
#[allow(clippy::struct_excessive_bools)]
2014
#[derive(Default, Parser)]
2115
#[clap(after_help = "\
@@ -37,8 +31,8 @@ pub struct Args {
3731
}
3832

3933
pub fn config(args: &Args) -> Result<()> {
40-
let archive_file_path = common::archive_file_path()?;
41-
if !args.force && archive_file_path.exists() && args.plugins == common::plugins_available()? {
34+
let object_file_path = common::object_file_path()?;
35+
if !args.force && object_file_path.exists() && args.plugins == common::plugins_available()? {
4236
let version = common::afl_rustc_version()?;
4337
bail!(
4438
"AFL LLVM runtime was already built for Rust {version}; run `cargo afl config --build \
@@ -129,26 +123,11 @@ fn build_afl(args: &Args, work_dir: &Path) -> Result<()> {
129123
Ok(())
130124
}
131125

132-
fn build_afl_llvm_runtime(args: &Args, work_dir: &Path) -> Result<()> {
126+
fn build_afl_llvm_runtime(_args: &Args, work_dir: &Path) -> Result<()> {
133127
let object_file_path = common::object_file_path()?;
134128
let _: u64 = std::fs::copy(work_dir.join("afl-compiler-rt.o"), &object_file_path)
135129
.with_context(|| "could not copy object file")?;
136130

137-
let archive_file_path = common::archive_file_path()?;
138-
let mut command = Command::new(AR_CMD);
139-
command
140-
.arg("r")
141-
.arg(archive_file_path)
142-
.arg(object_file_path);
143-
144-
if !args.verbose {
145-
command.stdout(Stdio::null());
146-
command.stderr(Stdio::null());
147-
}
148-
149-
let success = command.status().as_ref().is_ok_and(ExitStatus::success);
150-
ensure!(success, "could not run 'ar'");
151-
152131
Ok(())
153132
}
154133

cargo-afl/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn main() {
124124
};
125125

126126
if !matches!(afl_args.subcmd, Some(AflSubcommand::Config(..)))
127-
&& !common::archive_file_path().unwrap().exists()
127+
&& !common::object_file_path().unwrap().exists()
128128
{
129129
let version = common::afl_rustc_version().unwrap();
130130
eprintln!(
@@ -346,9 +346,8 @@ where
346346
let mut rustdocflags = rustflags.clone();
347347

348348
rustflags.push_str(&format!(
349-
"-l afl-llvm-rt \
350-
-L {} ",
351-
common::afl_llvm_dir().unwrap().display()
349+
"-Clink-arg={} ",
350+
common::object_file_path().unwrap().display()
352351
));
353352

354353
// add user provided flags

0 commit comments

Comments
 (0)