Skip to content

Commit 63b95b7

Browse files
jhprattgitbot
authored and
gitbot
committed
Rollup merge of rust-lang#127565 - esp-rs:xtensa-vaargs, r=workingjubilee
Teach rustc about the Xtensa VaListImpl Following on from the target Xtensa target PRs (rust-lang#125141, rust-lang#126380), this PR teaches rustc about the structure of the VA list on the Xtensa arch, as well as adding the required lowering to be able to actually use it.
2 parents 7dfb4de + 2a81578 commit 63b95b7

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

core/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ check-cfg = [
4343
'cfg(bootstrap)',
4444
'cfg(no_fp_fmt_parse)',
4545
'cfg(stdarch_intel_sde)',
46+
'cfg(target_arch, values("xtensa"))',
4647
# core use #[path] imports to portable-simd `core_simd` crate
4748
# and to stdarch `core_arch` crate which messes-up with Cargo list
4849
# of declared features, we therefor expect any feature cfg

core/src/ffi/va_list.rs

+19
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,18 @@ 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+
#[lang = "va_list"]
123+
pub struct VaListImpl<'f> {
124+
stk: *mut i32,
125+
reg: *mut i32,
126+
ndx: i32,
127+
_marker: PhantomData<&'f mut &'f c_void>,
128+
}
129+
116130
/// A wrapper for a `va_list`
117131
#[repr(transparent)]
118132
#[derive(Debug)]
@@ -124,6 +138,7 @@ pub struct VaList<'a, 'f: 'a> {
124138
not(target_arch = "s390x"),
125139
not(target_arch = "x86_64")
126140
),
141+
target_arch = "xtensa",
127142
all(target_arch = "aarch64", target_vendor = "apple"),
128143
target_family = "wasm",
129144
target_os = "uefi",
@@ -138,6 +153,7 @@ pub struct VaList<'a, 'f: 'a> {
138153
target_arch = "s390x",
139154
target_arch = "x86_64"
140155
),
156+
not(target_arch = "xtensa"),
141157
any(not(target_arch = "aarch64"), not(target_vendor = "apple")),
142158
not(target_family = "wasm"),
143159
not(target_os = "uefi"),
@@ -155,6 +171,7 @@ pub struct VaList<'a, 'f: 'a> {
155171
not(target_arch = "s390x"),
156172
not(target_arch = "x86_64")
157173
),
174+
target_arch = "xtensa",
158175
all(target_arch = "aarch64", target_vendor = "apple"),
159176
target_family = "wasm",
160177
target_os = "uefi",
@@ -173,8 +190,10 @@ impl<'f> VaListImpl<'f> {
173190
target_arch = "aarch64",
174191
target_arch = "powerpc",
175192
target_arch = "s390x",
193+
target_arch = "xtensa",
176194
target_arch = "x86_64"
177195
),
196+
not(target_arch = "xtensa"),
178197
any(not(target_arch = "aarch64"), not(target_vendor = "apple")),
179198
not(target_family = "wasm"),
180199
not(target_os = "uefi"),

0 commit comments

Comments
 (0)