Skip to content

Commit a40b57b

Browse files
Merge branch 'master' into master
2 parents 63a8ac0 + 74907b9 commit a40b57b

File tree

7 files changed

+47
-75
lines changed

7 files changed

+47
-75
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## 0.15.23
4+
5+
- Internal refactor. The changes should not be noticeable to end users. If you experience breakage, please open an [issue](https://github.com/rust-fuzz/afl.rs/issues).
6+
37
## 0.15.22
48

59
- Go back to conventional publishing. Attempting to use trusted publishing caused the AFLplusplus submodule to not be included.

Cargo.lock

Lines changed: 35 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

afl/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "afl"
3-
version = "0.15.22"
3+
version = "0.15.23"
44
readme = "README.md"
55
license = "Apache-2.0"
66
authors = [

cargo-afl/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-afl"
3-
version = "0.15.22"
3+
version = "0.15.23"
44
readme = "README.md"
55
license = "Apache-2.0"
66
authors = [

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!(
@@ -347,9 +347,8 @@ where
347347
let mut rustdocflags = rustflags.clone();
348348

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

355354
// add user provided flags

0 commit comments

Comments
 (0)