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.
This commit is contained in:
Nathan Froyd 2018-09-25 16:37:31 -04:00
parent 31789a658b
commit 2819deffe3
2 changed files with 14 additions and 3 deletions

View File

@ -761,7 +761,7 @@ fn default() -> TargetOptions {
} }
impl Target { impl Target {
/// Given a function ABI, turn "System" into the correct ABI for this target. /// Given a function ABI, turn it into the correct ABI for this target.
pub fn adjust_abi(&self, abi: Abi) -> Abi { pub fn adjust_abi(&self, abi: Abi) -> Abi {
match abi { match abi {
Abi::System => { Abi::System => {
@ -771,6 +771,16 @@ pub fn adjust_abi(&self, abi: Abi) -> Abi {
Abi::C Abi::C
} }
}, },
// These ABI kinds are ignored on non-x86 Windows targets.
// See https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions
// and the individual pages for __stdcall et al.
Abi::Stdcall | Abi::Fastcall | Abi::Vectorcall | Abi::Thiscall => {
if self.options.is_like_windows && self.arch != "x86" {
Abi::C
} else {
abi
}
},
abi => abi abi => abi
} }
} }

View File

@ -8,8 +8,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
// ignore-arm // Test that `extern "stdcall"` is properly translated.
// ignore-aarch64
// only-x86
// compile-flags: -C no-prepopulate-passes // compile-flags: -C no-prepopulate-passes