Skip to content

Commit b09408e

Browse files
authored
Rollup merge of rust-lang#54576 - froydnj:non-x86-abi-adjustment, r=alexcrichton
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.
2 parents 762fc05 + c0ac5ba commit b09408e

File tree

1 file changed

+11
-1
lines changed
  • src/librustc_target/spec

1 file changed

+11
-1
lines changed

src/librustc_target/spec/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ impl Default for TargetOptions {
761761
}
762762

763763
impl Target {
764-
/// Given a function ABI, turn "System" into the correct ABI for this target.
764+
/// Given a function ABI, turn it into the correct ABI for this target.
765765
pub fn adjust_abi(&self, abi: Abi) -> Abi {
766766
match abi {
767767
Abi::System => {
@@ -771,6 +771,16 @@ impl Target {
771771
Abi::C
772772
}
773773
},
774+
// These ABI kinds are ignored on non-x86 Windows targets.
775+
// See https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions
776+
// and the individual pages for __stdcall et al.
777+
Abi::Stdcall | Abi::Fastcall | Abi::Vectorcall | Abi::Thiscall => {
778+
if self.options.is_like_windows && self.arch != "x86" {
779+
Abi::C
780+
} else {
781+
abi
782+
}
783+
},
774784
abi => abi
775785
}
776786
}

0 commit comments

Comments
 (0)