Skip to content

Commit 67f7399

Browse files
deweerdtnagisa
authored andcommitted
Optionally use a custom libFuzzer.a archive
- only use one PathBuf - only remove the 'lib' prefix if present - Add a note saying we're assuming c++ linkage
1 parent 355bc59 commit 67f7399

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

build.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ extern crate gcc;
22

33
fn main() {
44
if let Ok(custom) = ::std::env::var("CUSTOM_LIBFUZZER_PATH") {
5-
let custom_lib_dir = ::std::path::PathBuf::from(&custom);
6-
let custom_lib_dir = custom_lib_dir.parent().unwrap().to_string_lossy();
5+
let custom_lib_path = ::std::path::PathBuf::from(&custom);
6+
let custom_lib_dir = custom_lib_path.parent().unwrap().to_string_lossy();
77

8-
let custom_lib_name = ::std::path::PathBuf::from(&custom);
9-
let custom_lib_name = custom_lib_name.file_stem().unwrap().to_string_lossy();
10-
let custom_lib_name = &custom_lib_name[3..];
8+
let custom_lib_name = custom_lib_path.file_stem().unwrap().to_string_lossy();
9+
let custom_lib_name = custom_lib_name.trim_left_matches("lib");
1110

1211
println!("cargo:rustc-link-search=native={}", custom_lib_dir);
1312
println!("cargo:rustc-link-lib=static={}", custom_lib_name);
13+
/* FIXME: this is assuming a C++ fuzzer, but should be customizable */
1414
println!("cargo:rustc-link-lib=stdc++");
1515
} else {
1616
let mut config = gcc::Config::new();

0 commit comments

Comments
 (0)