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.
Compiling code like:
https://github.com/jcjones/u2f-hid-rs/blob/ea7244febb010bb8e02c5e01dd6f2b9a0082884a/src/windows/winapi.rs#L22-L49
results in:
presumably because
rustcattempts to translate it into an x86-specific ABI, which the AArch64 backend rightly rejects.clangalready ignores__stdcallfor non-x86 targets:https://reviews.llvm.org/D36105
I'm not completely sure what the right answer for Rust is. I think
Target::adjust_abiis the rough equivalent of the above clang bit and needs to take a few more cases into account for non-x86 Windows:rust/src/librustc_target/spec/mod.rs
Lines 764 to 776 in 31789a6
@alexcrichton does that sound right? If so, I'll code up a patch.