diff --git a/Cargo.toml b/Cargo.toml index 995dad53e..e95cf93f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ default_features = false default = ["std", "elf32", "elf64", "mach32", "mach64", "pe32", "pe64", "archive", "endian_fd"] std = ["alloc", "scroll/std"] alloc = ["scroll/derive", "log"] -endian_fd = ["alloc", "elf32", "elf64", "mach32", "mach64", "pe32", "pe64", "archive"] +endian_fd = ["alloc"] elf32 = [] elf64 = [] # for now we will require mach and pe to be alloc + endian_fd diff --git a/Makefile b/Makefile index 805b28550..a1c7c7efe 100644 --- a/Makefile +++ b/Makefile @@ -25,24 +25,28 @@ example: api: cargo build --no-default-features cargo build --no-default-features --features="std" + cargo build --no-default-features --features="endian_fd std" cargo build --no-default-features --features="elf32" cargo build --no-default-features --features="elf32 elf64" cargo build --no-default-features --features="elf32 elf64 std" + cargo build --no-default-features --features="elf32 elf64 endian_fd std" cargo build --no-default-features --features="archive std" + cargo build --no-default-features --features="mach64 std" + cargo build --no-default-features --features="mach32 std" cargo build --no-default-features --features="mach64 mach32 std" + cargo build --no-default-features --features="pe32 std" cargo build --no-default-features --features="pe32 pe64 std" - cargo build --no-default-features --features="endian_fd std" cargo build nightly_api: cargo build --no-default-features --features="alloc" - cargo build --no-default-features --features="elf32 elf64 alloc" + cargo build --no-default-features --features="endian_fd" + cargo build --no-default-features --features="elf32 elf64 endian_fd" cargo build --no-default-features --features="archive" cargo build --no-default-features --features="mach64" cargo build --no-default-features --features="mach32" cargo build --no-default-features --features="mach64 mach32" cargo build --no-default-features --features="pe32" cargo build --no-default-features --features="pe32 pe64" - cargo build --no-default-features --features="endian_fd" .PHONY: clean test example doc diff --git a/src/elf/mod.rs b/src/elf/mod.rs index 820e612ee..d631b5dd9 100644 --- a/src/elf/mod.rs +++ b/src/elf/mod.rs @@ -52,8 +52,14 @@ pub mod dyn; pub mod reloc; pub mod note; +macro_rules! if_sylvan { + ($($i:item)*) => ($( + #[cfg(all(feature = "elf32", feature = "elf64", feature = "endian_fd"))] + $i + )*) +} -if_endian_fd! { +if_sylvan! { use scroll::{self, ctx, Pread, Endian}; use strtab::Strtab; use error; diff --git a/src/lib.rs b/src/lib.rs index f7b65b93d..31ed64a51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -125,14 +125,6 @@ macro_rules! if_alloc { )*) } -#[allow(unused)] -macro_rules! if_endian_fd { - ($($i:item)*) => ($( - #[cfg(feature = "endian_fd")] - $i - )*) -} - #[cfg(feature = "alloc")] pub mod error; @@ -222,6 +214,13 @@ pub mod container { } } +macro_rules! if_endian_fd { + ($($i:item)*) => ($( + #[cfg(all(feature = "endian_fd", feature = "elf64", feature = "elf32", feature = "pe64", feature = "pe32", feature = "mach64", feature = "mach32", feature = "archive"))] + $i + )*) +} + if_endian_fd! { #[derive(Debug, Default)]