Skip to content

Commit

Permalink
Revert endian_fd dependency changes
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc committed Feb 2, 2018
1 parent 916bc1a commit b864469
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 7 additions & 1 deletion src/elf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 7 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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"))]

This comment has been minimized.

Copy link
@m4b

m4b Feb 2, 2018

Owner

This still isn’t right i think.

It means in order to use the parse functions in the elf module you have to also have enabled PE, etc. whereas before you could enable the endian ELF parser and not have mach or PE enabled.

I think this union of features only ever applies to the goblin::Object and its impl block.

This comment has been minimized.

Copy link
@philipc

philipc Feb 2, 2018

Author Collaborator

This is only used in this file, not the elf module, so you should still be able to get the ELF parser. That's why I changed the if_endian_fd in elf/mod.rs back to using if_sylvan.

This comment has been minimized.

Copy link
@philipc

philipc Feb 2, 2018

Author Collaborator

Note that I have changed HintData and Hint to required all file formats, but as far as I can tell they are only used with goblin::Object. I can revert that bit too if you want, but they seem useless on their own to me.

$i
)*)
}

if_endian_fd! {

#[derive(Debug, Default)]
Expand Down

1 comment on commit b864469

@m4b
Copy link
Owner

@m4b m4b commented on b864469 Feb 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. No let’s make the hints require parser. That’s what they’re for primarily

I’m thinking about moving hint + object into an object module and reexport it but can worry about it later.

Please sign in to comment.