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

Unnecessary bindings for target_arch = "armv7" #10

Closed
katyo opened this issue Jan 6, 2020 · 4 comments · Fixed by #13
Closed

Unnecessary bindings for target_arch = "armv7" #10

katyo opened this issue Jan 6, 2020 · 4 comments · Fixed by #13

Comments

@katyo
Copy link
Contributor

katyo commented Jan 6, 2020

As I know in rust target_arch = "arm" actually corresponding to armv7, so second bindings completely useless.
https://github.com/rust-windowing/android-ndk-rs/blob/a8ddfa4f7b510923cd69ded0f7e8492711b0af88/android-ndk-sys/src/lib.rs#L21-L28
Fix me if I'm wrong.

@dvc94ch
Copy link
Contributor

dvc94ch commented Jan 6, 2020

maybe one is for thumb instructions and the other for the regular arm instructions, but not sure

@katyo
Copy link
Contributor Author

katyo commented Jan 6, 2020

Rust:

target notes
arm-linux-androideabi ARMv7 Android
armv7-linux-androideabi ARMv7a Android
thumbv7neon-linux-androideabi Thumb2-mode ARMv7a Android with NEON

https://forge.rust-lang.org/release/platform-support.html

Android NDK:

target notes
armeabi-v7a armeabi Thumb-2 VFPv3-D16

https://developer.android.com/ndk/guides/abis

I guess that generated bindings for all 32-bit ARMs will be the same.

@katyo
Copy link
Contributor Author

katyo commented Jan 6, 2020

target_arch =

"x86"
"x86_64"
"mips"
"powerpc"
"powerpc64"
"arm"
"aarch64"

https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch

@katyo
Copy link
Contributor Author

katyo commented Jan 6, 2020

I look at the compiler specs, the arch and data layout actually is same for all 32-bit ARMs:
arm, armv7, thumbv7neon.
To differentiate bindings by target kind we should check target_feature (ex. target_feature = "v7", target_feature = "thumb2", target_feature = "neon", and etc.)
But because generated bindings will be the same, so we actually don't need second section.

$ diff src/ffi_arm.rs src/ffi_armv7.rs

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

Successfully merging a pull request may close this issue.

2 participants