Skip to content

Commit 4f1d0fc

Browse files
committed
Remove archive
1 parent 12f0821 commit 4f1d0fc

File tree

3 files changed

+3
-37
lines changed

3 files changed

+3
-37
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: 2 additions & 32 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 \
@@ -79,7 +73,6 @@ pub fn config(args: &Args) -> Result<()> {
7973
let work_dir = tempdir.path().join(AFL_SRC_PATH);
8074

8175
build_afl(args, &work_dir)?;
82-
build_afl_llvm_runtime(args, &work_dir)?;
8376

8477
if args.plugins {
8578
copy_afl_llvm_plugins(args, &work_dir)?;
@@ -129,29 +122,6 @@ fn build_afl(args: &Args, work_dir: &Path) -> Result<()> {
129122
Ok(())
130123
}
131124

132-
fn build_afl_llvm_runtime(args: &Args, work_dir: &Path) -> Result<()> {
133-
let object_file_path = common::object_file_path()?;
134-
let _: u64 = std::fs::copy(work_dir.join("afl-compiler-rt.o"), &object_file_path)
135-
.with_context(|| "could not copy object file")?;
136-
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-
152-
Ok(())
153-
}
154-
155125
fn copy_afl_llvm_plugins(_args: &Args, work_dir: &Path) -> Result<()> {
156126
// Iterate over the files in the directory.
157127
for result in work_dir

cargo-afl/src/main.rs

Lines changed: 1 addition & 1 deletion
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!(

0 commit comments

Comments
 (0)