Improve Apple support for libafl_cc dll_extensions (#892)

This commit is contained in:
Dominik Maier 2022-11-15 18:28:52 +01:00 committed by GitHub
parent 2011ed299b
commit a22c76e02e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,10 +16,16 @@ const LLVM_VERSION_MIN: u32 = 6;
/// Get the extension for a shared object /// Get the extension for a shared object
fn dll_extension<'a>() -> &'a str { fn dll_extension<'a>() -> &'a str {
match env::var("CARGO_CFG_TARGET_OS").unwrap().as_str() { if let Ok(vendor) = env::var("CARGO_CFG_TARGET_VENDOR") {
if vendor == "apple" {
return "dylib";
}
}
let family = env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
match family.as_str() {
"windows" => "dll", "windows" => "dll",
"macos" | "ios" => "dylib", "unix" => "so",
_ => "so", _ => panic!("Unsupported target family: {family}"),
} }
} }