Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make normalization APK exports conditional on 'apk' feature #1025

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Unreleased
into account system KASLR state
- Added `kaslr_offset` member to `symbolize::Kernel`
- Moved symbolization and inspection sources into `source` sub-module
- Moved `normalize::Apk` behind existing `apk` feature
- Changed `inspect::SymInfo::size` to be an `Option`


Expand Down
6 changes: 6 additions & 0 deletions src/normalize/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use super::buildid::BuildId;
use super::Reason;


cfg_apk! {
/// Meta information about an APK.
///
/// This type is used in the [`UserMeta::Apk`] variant.
Expand Down Expand Up @@ -45,6 +46,7 @@ pub struct Apk {
#[doc(hidden)]
pub _non_exhaustive: (),
}
}


/// Meta information about an ELF file (executable, shared object, ...).
Expand Down Expand Up @@ -103,6 +105,8 @@ impl From<Unknown> for UserMeta<'_> {
#[non_exhaustive]
pub enum UserMeta<'src> {
/// The address belongs to an APK file.
#[cfg(feature = "apk")]
#[cfg_attr(docsrs, doc(cfg(feature = "apk")))]
Apk(Apk),
/// The address belongs to an ELF file.
Elf(Elf<'src>),
Expand All @@ -112,6 +116,8 @@ pub enum UserMeta<'src> {

impl<'src> UserMeta<'src> {
/// Retrieve the [`Apk`] of this enum, if this variant is active.
#[cfg(feature = "apk")]
#[cfg_attr(docsrs, doc(cfg(feature = "apk")))]
#[inline]
pub fn as_apk(&self) -> Option<&Apk> {
match self {
Expand Down
2 changes: 2 additions & 0 deletions src/normalize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ use std::fmt::Formatter;
use std::fmt::Result as FmtResult;
use std::str;

cfg_apk! {
pub use meta::Apk;
}
pub use meta::Elf;
pub use meta::Unknown;
pub use meta::UserMeta;
Expand Down
1 change: 1 addition & 0 deletions src/normalize/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::Error;
use crate::Result;

use super::buildid::BuildIdReader;
#[cfg(feature = "apk")]
use super::meta::Apk;
use super::meta::Elf;
use super::meta::Unknown;
Expand Down