Skip to content

Commit 1351f0b

Browse files
kelnosjothan
authored andcommitted
Teach rust core about Xtensa VaListImpl
Co-authored-by: Jonathan Bastien-Filiatrault <[email protected]>
1 parent cf675c3 commit 1351f0b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

library/core/src/ffi/va_list.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::ops::{Deref, DerefMut};
1515
not(target_arch = "aarch64"),
1616
not(target_arch = "powerpc"),
1717
not(target_arch = "s390x"),
18+
not(target_arch = "xtensa"),
1819
not(target_arch = "x86_64")
1920
),
2021
all(target_arch = "aarch64", target_vendor = "apple"),
@@ -37,6 +38,7 @@ pub struct VaListImpl<'f> {
3738
not(target_arch = "aarch64"),
3839
not(target_arch = "powerpc"),
3940
not(target_arch = "s390x"),
41+
not(target_arch = "xtensa"),
4042
not(target_arch = "x86_64")
4143
),
4244
all(target_arch = "aarch64", target_vendor = "apple"),
@@ -113,6 +115,24 @@ pub struct VaListImpl<'f> {
113115
_marker: PhantomData<&'f mut &'f c_void>,
114116
}
115117

118+
/// Xtensa ABI implementation of a `va_list`.
119+
#[cfg(target_arch = "xtensa")]
120+
#[repr(C)]
121+
#[derive(Debug)]
122+
#[unstable(
123+
feature = "c_variadic",
124+
reason = "the `c_variadic` feature has not been properly tested on \
125+
all supported platforms",
126+
issue = "44930"
127+
)]
128+
#[lang = "va_list"]
129+
pub struct VaListImpl<'f> {
130+
stk: *mut i32,
131+
reg: *mut i32,
132+
ndx: i32,
133+
_marker: PhantomData<&'f mut &'f i32>,
134+
}
135+
116136
/// A wrapper for a `va_list`
117137
#[repr(transparent)]
118138
#[derive(Debug)]
@@ -124,6 +144,7 @@ pub struct VaList<'a, 'f: 'a> {
124144
not(target_arch = "s390x"),
125145
not(target_arch = "x86_64")
126146
),
147+
target_arch = "xtensa",
127148
all(target_arch = "aarch64", target_vendor = "apple"),
128149
target_family = "wasm",
129150
target_os = "uefi",
@@ -138,6 +159,7 @@ pub struct VaList<'a, 'f: 'a> {
138159
target_arch = "s390x",
139160
target_arch = "x86_64"
140161
),
162+
not(target_arch = "xtensa"),
141163
any(not(target_arch = "aarch64"), not(target_vendor = "apple")),
142164
not(target_family = "wasm"),
143165
not(target_os = "uefi"),
@@ -155,6 +177,7 @@ pub struct VaList<'a, 'f: 'a> {
155177
not(target_arch = "s390x"),
156178
not(target_arch = "x86_64")
157179
),
180+
target_arch = "xtensa",
158181
all(target_arch = "aarch64", target_vendor = "apple"),
159182
target_family = "wasm",
160183
target_os = "uefi",
@@ -173,8 +196,10 @@ impl<'f> VaListImpl<'f> {
173196
target_arch = "aarch64",
174197
target_arch = "powerpc",
175198
target_arch = "s390x",
199+
target_arch = "xtensa",
176200
target_arch = "x86_64"
177201
),
202+
not(target_arch = "xtensa"),
178203
any(not(target_arch = "aarch64"), not(target_vendor = "apple")),
179204
not(target_family = "wasm"),
180205
not(target_os = "uefi"),

0 commit comments

Comments
 (0)