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

add cargo features for architecture-specific support #61

Open
froydnj opened this issue Mar 29, 2019 · 1 comment
Open

add cargo features for architecture-specific support #61

froydnj opened this issue Mar 29, 2019 · 1 comment

Comments

@froydnj
Copy link
Contributor

froydnj commented Mar 29, 2019

It would be splendid if capstone exposed Cargo features such that you could only compile support in for specific architecture(s)--usually one, but maybe multiple architectures depending on circumstances. I realize this would probably complicate a few things (e.g. using pregenerated bindings could only be done under certain circumstances), but it'd be nice for building things that are guaranteed to only target architecture X and you don't care about disassembling things for not-X.

How complicated do you think this would be to add?

/cc @lars-t-hansen

@tmfink
Copy link
Member

tmfink commented Mar 30, 2019

@froydnj Thanks for your bug report!

I've considered adding this feature, but, depending on the implementation, it's a lot of work. We could have a feature support_all_archs that depends on each arch's feature. By default, the support_all_archs could be enabled.

From there, there are two approaches

  1. Compile Capstone with only the archs specified.
    • Could use the pre-generated bindings.
    • We would have unused Rust code, but at least the Capstone C library would be much smaller, which would cut down on the final binary size.
  2. Same as 1, but also add #[cfg(...)] attributes capstone-rs to conditionally compile Rust code for each architecture.
    • This would additionally reduce Rust compile times
    • This is a lot more work, especially with macros that generate a lot of the architecture-specific code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants