Skip to content

Commit fb025b4

Browse files
authored
Auto merge of #37814 - japaric:aapcs, r=alexcrichton
fix `extern "aapcs" fn` to actually use the AAPCS calling convention closes #37810 This is technically a [breaking-change] because it changes the ABI of `extern "aapcs"` functions that (a) involve `f32`/`f64` arguments/return values and (b) are compiled for arm-eabihf targets from "aapcs-vfp" (wrong) to "aapcs" (correct). Appendix: What these ABIs mean? - In the "aapcs-vfp" ABI or "hard float" calling convention: Floating point values are passed/returned through FPU registers (s0, s1, d0, etc.) - Whereas, in the "aapcs" ABI or "soft float" calling convention: Floating point values are passed/returned through general purpose registers (r0, r1, etc.) Mixing these ABIs can cause problems if the caller assumes that the routine is using one of these ABIs but it's actually using the other one. --- r? @alexcrichton We are going this `extern "aapcs" fn` thing to implement some intrinsics (floatundidf) for the eabihf targets in order to comply with LLVM's calling convention of intrinsics. Oh, and the value of the enum came from [here](http://llvm.org/docs/doxygen/html/namespacellvm_1_1CallingConv.html). cc @TimNN @parched
2 parents aa97daf + 456ceba commit fb025b4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/librustc_llvm/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub enum CallConv {
4141
ColdCallConv = 9,
4242
X86StdcallCallConv = 64,
4343
X86FastcallCallConv = 65,
44+
ArmAapcsCallConv = 67,
4445
X86_64_SysV = 78,
4546
X86_64_Win64 = 79,
4647
X86_VectorCall = 80,

src/librustc_trans/abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ impl FnType {
274274
C => llvm::CCallConv,
275275
Win64 => llvm::X86_64_Win64,
276276
SysV64 => llvm::X86_64_SysV,
277+
Aapcs => llvm::ArmAapcsCallConv,
277278

278279
// These API constants ought to be more specific...
279280
Cdecl => llvm::CCallConv,
280-
Aapcs => llvm::CCallConv,
281281
};
282282

283283
let mut inputs = &sig.inputs[..];

0 commit comments

Comments
 (0)