Gate FDE finder under features
This commit is contained in:
parent
c195fc91eb
commit
83537e0211
@ -6,12 +6,16 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
gimli = { version = "0.25.0", default-features = false, features = ["read"] }
|
||||
libc = "0.2"
|
||||
libc = { version = "0.2", optional = true }
|
||||
once_cell = { version = "1.8", optional = true }
|
||||
spin = { version = "0.9", default-features = false, features = ["lazy", "mutex", "spin_mutex"] }
|
||||
|
||||
[features]
|
||||
std = ["once_cell"]
|
||||
alloc = []
|
||||
fde-phdr = ["libc"]
|
||||
fde-registry = ["alloc"]
|
||||
default = ["fde-phdr"]
|
||||
|
||||
[profile.release]
|
||||
debug = true
|
||||
|
@ -1,4 +1,6 @@
|
||||
#[cfg(feature = "fde-phdr")]
|
||||
mod phdr;
|
||||
#[cfg(feature = "fde-registry")]
|
||||
mod registry;
|
||||
|
||||
use crate::util::*;
|
||||
@ -19,9 +21,11 @@ pub struct GlobalFinder(());
|
||||
|
||||
impl FDEFinder for GlobalFinder {
|
||||
fn find_fde(&self, pc: usize) -> Option<FDESearchResult> {
|
||||
#[cfg(feature = "fde-registry")]
|
||||
if let Some(v) = registry::get_finder().find_fde(pc) {
|
||||
return Some(v);
|
||||
}
|
||||
#[cfg(feature = "fde-phdr")]
|
||||
if let Some(v) = phdr::get_finder().find_fde(pc) {
|
||||
return Some(v);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#![warn(unsafe_op_in_unsafe_fn)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
extern crate alloc;
|
||||
|
||||
mod abi;
|
||||
|
Loading…
Reference in New Issue
Block a user