diff options
| author | yrp <yrp604@protonmail.com> | 2021-02-14 21:41:02 -0800 |
|---|---|---|
| committer | Kyle Martin <krm504@nyu.edu> | 2021-02-26 21:29:59 -0500 |
| commit | 04597e06cdb05948fb145378d23a4cb5a90f3c0f (patch) | |
| tree | c46971c0c86d556ff3d1e951dacf2f4b51b26709 /rust | |
| parent | 99758cde539320e7d5bf546954993771bb427b23 (diff) | |
Fix rust plugin linking on Windows
Windows requires the symbols from the core to crate the plugin dll. As
these were gated behind the headless feature, these didn't exist, and
thus linking failed. Enabling the headless feature was also
insufficient, as headless features disabled CorePluginABIVersion
function.
This patch turns all the headless cfgs into headless or windows cfgs.
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/binaryninjacore-sys/build.rs | 14 | ||||
| -rw-r--r-- | rust/src/lib.rs | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/rust/binaryninjacore-sys/build.rs b/rust/binaryninjacore-sys/build.rs index 24be4dac..126077d6 100644 --- a/rust/binaryninjacore-sys/build.rs +++ b/rust/binaryninjacore-sys/build.rs @@ -3,11 +3,11 @@ extern crate bindgen; use std::env; use std::path::PathBuf; -#[cfg(feature = "headless")] +#[cfg(any(windows, feature = "headless"))] use std::fs::File; -#[cfg(feature = "headless")] +#[cfg(any(windows, feature = "headless"))] use std::io::prelude::*; -#[cfg(feature = "headless")] +#[cfg(any(windows, feature = "headless"))] use std::io::BufReader; #[cfg(all(target_os = "macos", feature = "headless"))] @@ -16,10 +16,10 @@ static LASTRUN_PATH: (&str, &str) = ("HOME", "Library/Application Support/Binary #[cfg(all(target_os = "linux", feature = "headless"))] static LASTRUN_PATH: (&str, &str) = ("HOME", ".binaryninja/lastrun"); -#[cfg(all(windows, feature = "headless"))] +#[cfg(windows)] static LASTRUN_PATH: (&str, &str) = ("APPDATA", "Binary Ninja\\lastrun"); -#[cfg(feature = "headless")] +#[cfg(any(windows, feature = "headless"))] fn link_path() -> PathBuf { let home = PathBuf::from(env::var(LASTRUN_PATH.0).unwrap()); let lastrun = PathBuf::from(&home).join(LASTRUN_PATH.1); @@ -52,7 +52,7 @@ fn main() { // otherwise search the usual install paths let out_dir = env::var("OUT_DIR").unwrap(); - #[cfg(feature = "headless")] + #[cfg(any(windows, feature = "headless"))] let link_path = env::var("BINARYNINJADIR") .map(PathBuf::from) .unwrap_or_else(|_| link_path()); @@ -140,7 +140,7 @@ fn main() { println!("cargo:rustc-link-search={}", out_dir); } - #[cfg(feature = "headless")] + #[cfg(any(windows, feature = "headless"))] { println!("cargo:rustc-link-lib=binaryninjacore"); println!("cargo:rustc-link-search={}", link_path.to_str().unwrap()); diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 3d287321..eba2d8ee 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -233,7 +233,7 @@ pub fn core_abi_minimum_version() -> u32 { } // Provide ABI version automatically so that the core can verify binary compatibility -#[cfg(not(feature = "headless"))] +#[cfg(any(windows, not(feature = "headless")))] #[no_mangle] #[allow(non_snake_case)] pub extern "C" fn CorePluginABIVersion() -> u32 { plugin_abi_version() } |
