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