-
Notifications
You must be signed in to change notification settings - Fork 13.3k
fns using c-stack-cdecl native ABI cannot be called from outside crate #1059
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
Comments
I don't see how this works for "cdecl" functions. |
Maybe cdecl functions have a wrapper... |
First question: do cdecl functions work? I would be happy to investigate this further, should be easy to port the test over to cdecl. |
Yeah, native "cdecl" functions do work across crates. Some of the stdtest::run tests rely on this. I'm thinking of just working around the problem in order to eliminate the last usages of "cdecl". |
Oh, ok. Yeah, that's annoying. I didn't trace the path through the code that cdecl functions take, clearly something different though. On Nov 7, 2011, at 7:45 PM, Brian Anderson wrote:
|
Fixed in @b6af844 |
* Add --enable-unstable option Unstable options now require users to explicitly enable them. This is important because the unstable options can be unsound or give spurious CEX. * Disable spurious pointer checks by default We have been seeing a lot of spurious CEX related to pointer out of bounds checks in arithmetic operations. It is actually valid rust in some cases, and we can't differentiate the valid ones from the invalid ones today. Thus, I'm disabling them by default. Note that dereferencing invalid pointers is caught by different checks and they should not be affected by this change. This changes fixes rust-lang#563 and rust-lang#763. Co-authored-by: Zyad Hassan <[email protected]>
Calling a native function declared with "c-stack-cdecl" ABI from outside the create fails in LLVM. The type of the function includes the implicit parameters when it should not. The path through the code is: The code path is that when we look up the external identifier we go through
trans_external_path()
->type_of_ty_param_kinds_and_ty()
->type_of_fn_from_ty()
->type_of_fn()
, andtype_of_fn()
adds the implicit parameters.I added a test:
src/test/run-pass/invoke-external-native.rs
The text was updated successfully, but these errors were encountered: