Skip to content

aarch64-pc-windows-msvc target needs to treat extern "stdcall" like extern "C" #54569

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

Closed
froydnj opened this issue Sep 25, 2018 · 1 comment
Closed

Comments

@froydnj
Copy link
Contributor

froydnj commented Sep 25, 2018

Compiling code like:

https://github.com/jcjones/u2f-hid-rs/blob/ea7244febb010bb8e02c5e01dd6f2b9a0082884a/src/windows/winapi.rs#L22-L49

results in:

LLVM ERROR: Unsupported calling convention

presumably because rustc attempts to translate it into an x86-specific ABI, which the AArch64 backend rightly rejects.

clang already ignores __stdcall for non-x86 targets:

https://reviews.llvm.org/D36105

I'm not completely sure what the right answer for Rust is. I think Target::adjust_abi is the rough equivalent of the above clang bit and needs to take a few more cases into account for non-x86 Windows:

/// Given a function ABI, turn "System" into the correct ABI for this target.
pub fn adjust_abi(&self, abi: Abi) -> Abi {
match abi {
Abi::System => {
if self.options.is_like_windows && self.arch == "x86" {
Abi::Stdcall
} else {
Abi::C
}
},
abi => abi
}
}

@alexcrichton does that sound right? If so, I'll code up a patch.

@alexcrichton
Copy link
Member

Sounds like a good place to me!

froydnj added a commit to froydnj/rust that referenced this issue Sep 25, 2018
MSVC ignores these keywords for C/C++ and uses the standard system
calling convention.  Rust should do so as well.

Fixes rust-lang#54569.
kennytm added a commit to kennytm/rust that referenced this issue Sep 27, 2018
…lexcrichton

ignore {std,fast,vector,this}call on non-x86 windows

MSVC ignores these keywords for C/C++ and uses the standard system
calling convention.  Rust should do so as well.

Fixes rust-lang#54569.
froydnj added a commit to froydnj/rust that referenced this issue Sep 27, 2018
MSVC ignores these keywords for C/C++ and uses the standard system
calling convention.  Rust should do so as well.

Fixes rust-lang#54569.
bors added a commit that referenced this issue Sep 29, 2018
ignore {std,fast,vector,this}call on non-x86 windows

MSVC ignores these keywords for C/C++ and uses the standard system
calling convention.  Rust should do so as well.

Fixes #54569.
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

No branches or pull requests

2 participants