Skip to content

Commit b02cfad

Browse files
kelnosMabezDev
authored andcommitted
Teach rust core about Xtensa VaListImpl
1 parent b0e355c commit b02cfad

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

library/core/src/ffi.rs

+25-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl fmt::Debug for c_void {
6060
/// Basic implementation of a `va_list`.
6161
// The name is WIP, using `VaListImpl` for now.
6262
#[cfg(any(
63-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
63+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
6464
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
6565
target_arch = "wasm32",
6666
target_arch = "asmjs",
@@ -83,7 +83,7 @@ pub struct VaListImpl<'f> {
8383
}
8484

8585
#[cfg(any(
86-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
86+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
8787
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
8888
target_arch = "wasm32",
8989
target_arch = "asmjs",
@@ -168,6 +168,24 @@ pub struct VaListImpl<'f> {
168168
_marker: PhantomData<&'f mut &'f c_void>,
169169
}
170170

171+
/// xtensa ABI implementation of a `va_list`.
172+
#[cfg(target_arch = "xtensa")]
173+
#[repr(C)]
174+
#[derive(Debug)]
175+
#[unstable(
176+
feature = "c_variadic",
177+
reason = "the `c_variadic` feature has not been properly tested on \
178+
all supported platforms",
179+
issue = "44930"
180+
)]
181+
#[lang = "va_list"]
182+
pub struct VaListImpl<'f> {
183+
stk: *mut i32,
184+
reg: *mut i32,
185+
ndx: i32,
186+
_marker: PhantomData<&'f mut &'f i32>,
187+
}
188+
171189
/// A wrapper for a `va_list`
172190
#[repr(transparent)]
173191
#[derive(Debug)]
@@ -182,7 +200,8 @@ pub struct VaList<'a, 'f: 'a> {
182200
all(
183201
not(target_arch = "aarch64"),
184202
not(target_arch = "powerpc"),
185-
not(target_arch = "x86_64")
203+
not(target_arch = "x86_64"),
204+
not(target_arch = "xtensa")
186205
),
187206
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
188207
target_arch = "wasm32",
@@ -192,7 +211,7 @@ pub struct VaList<'a, 'f: 'a> {
192211
inner: VaListImpl<'f>,
193212

194213
#[cfg(all(
195-
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
214+
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64", target_arch = "xtensa"),
196215
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
197216
not(target_arch = "wasm32"),
198217
not(target_arch = "asmjs"),
@@ -204,7 +223,7 @@ pub struct VaList<'a, 'f: 'a> {
204223
}
205224

206225
#[cfg(any(
207-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
226+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
208227
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
209228
target_arch = "wasm32",
210229
target_arch = "asmjs",
@@ -225,7 +244,7 @@ impl<'f> VaListImpl<'f> {
225244
}
226245

227246
#[cfg(all(
228-
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
247+
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64", target_arch = "xtensa"),
229248
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
230249
not(target_arch = "wasm32"),
231250
not(target_arch = "asmjs"),

0 commit comments

Comments
 (0)