about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2018-12-08 08:43:47 +0100
committerGitHub <noreply@github.com>2018-12-08 08:43:47 +0100
commiteb30d56d3711e6494e4f4dddf8e1af64e492fa1a (patch)
tree2d4efe625b99d6189c9d8cd9d96e0c8a612ea773 /src/libcore
parent253c448886da3eda55bef7bd68245f7d72c2e3b0 (diff)
parent3dfd8f7a64067d8b348ba597db10a06e2eccb773 (diff)
downloadrust-eb30d56d3711e6494e4f4dddf8e1af64e492fa1a.tar.gz
rust-eb30d56d3711e6494e4f4dddf8e1af64e492fa1a.zip
Rollup merge of #56599 - dlrobertson:fix_va_arg, r=eddyb
codegen: Fix va_list - aarch64 iOS/Windows

## Summary

Fix code generated for `VaList` on Aarch64 iOS/Windows.

## Details

According to the [Apple - ARM64 Function Calling Conventions]:

> ... the type va_list is an alias for char * rather than for the struct
> type specified in the generic PCS.

The current implementation uses the generic Aarch64 structure for `VaList`
for Aarch64 iOS. Switch to using the `char *` variant of the `VaList`
and use the corresponding `emit_ptr_va_arg` for the `va_arg` intrinsic.

Windows always uses the `char *` variant of the `VaList`. Update the `va_arg`
intrinsic to use `emit_ptr_va_arg`.

[Apple - ARM64 Function Calling Conventions]: https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ffi.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs
index 1dbf03923e1..d7a112eb90d 100644
--- a/src/libcore/ffi.rs
+++ b/src/libcore/ffi.rs
@@ -45,6 +45,7 @@ impl fmt::Debug for c_void {
 /// Basic implementation of a `va_list`.
 #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
               not(target_arch = "x86_64")),
+          all(target_arch = "aarch4", target_os = "ios"),
           windows))]
 #[unstable(feature = "c_variadic",
            reason = "the `c_variadic` feature has not been properly tested on \
@@ -192,6 +193,7 @@ impl<'a> VaList<'a> {
             where F: for<'copy> FnOnce(VaList<'copy>) -> R {
         #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
                       not(target_arch = "x86_64")),
+                  all(target_arch = "aarch4", target_os = "ios"),
                   windows))]
         let mut ap = va_copy(self);
         #[cfg(all(any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),