-
Notifications
You must be signed in to change notification settings - Fork 688
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
Fail to generate bindings for functions with calling convention "aapcs-vfp" for armv7a #1607
Comments
Does Rust support this ABI? |
Honestly I don't know. I've never heard of it. I just encountered it while trying to create rust bindings from the vulkan headers in the Android NDK. Rust does support armv7-linux-androideabi, however I am not sure about this exact calling convention. Somewhat difficult to find any documentation about what it is or whether or not rust supports it. I found this post which talks about adding support for aapcs-vfp: rust-lang/rust#37810 |
Oh so it looks like You need to add diff --git a/src/ir/function.rs b/src/ir/function.rs
index b8af9213..de3c3e8b 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -175,6 +175,8 @@ pub enum Abi {
ThisCall,
/// The "aapcs" ABI.
Aapcs,
+ /// The "aapcs-vfp" ABI.
+ AapcsVfp,
/// The "win64" ABI.
Win64,
/// An unknown or invalid ABI.
@@ -199,6 +201,7 @@ impl quote::ToTokens for Abi {
Abi::Fastcall => quote! { "fastcall" },
Abi::ThisCall => quote! { "thiscall" },
Abi::Aapcs => quote! { "aapcs" },
+ Abi::AapcsVfp => quote! { "aapcs-vfp" },
Abi::Win64 => quote! { "win64" },
Abi::Unknown(cc) => panic!(
"Cannot turn unknown calling convention to tokens: {:?}",
@@ -237,6 +240,7 @@ fn get_abi(cc: CXCallingConv) -> Abi {
CXCallingConv_X86FastCall => Abi::Fastcall,
CXCallingConv_X86ThisCall => Abi::ThisCall,
CXCallingConv_AAPCS => Abi::Aapcs,
+ CXCallingConv_AAPCS_VFP => Abi::AapcsVfp,
CXCallingConv_X86_64Win64 => Abi::Win64,
other => Abi::Unknown(other),
} But making bindgen generate the |
Closing this as aapcs-vfp support has not been added to rustc yet. Feel free to reopen it if that changes. |
Input C/C++ Header
__attribute__((pcs("aapcs-vfp"))) float square_root(float input);
Bindgen Invocation
NOTE! The bug only occurs when cargo is invoked with the
--target armv7-linux-androideabi
flag because aapcs-vfp is ignored for all other platforms.Actual Results
Expected Results
Expect it to be able to generate rust bindings of this simple header.
The text was updated successfully, but these errors were encountered: