Skip to content

Commit 2909b96

Browse files
committed
custom VaList layout for Hexagon
1 parent ce63e5d commit 2909b96

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

library/core/src/ffi/va_list.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ use crate::marker::PhantomCovariantLifetime;
3131
// the pointer decay behavior in Rust, while otherwise matching Rust semantics.
3232
// This attribute ensures that the compiler uses the correct ABI for functions
3333
// like `extern "C" fn takes_va_list(va: VaList<'_>)` by passing `va` indirectly.
34+
//
35+
// The LLVM `BuiltinVaListKind` enumerates the `va_list` variations that LLVM supports.
3436
crate::cfg_select! {
3537
all(
3638
target_arch = "aarch64",
@@ -124,6 +126,23 @@ crate::cfg_select! {
124126
}
125127
}
126128

129+
all(target_arch = "hexagon", target_env = "musl") => {
130+
/// Hexagon Musl implementation of a `va_list`.
131+
///
132+
/// See the [LLVM source] for more details. On bare metal Hexagon uses an opaque pointer.
133+
///
134+
/// [LLVM source]:
135+
/// https://github.com/llvm/llvm-project/blob/0cdc1b6dd4a870fc41d4b15ad97e0001882aba58/clang/lib/CodeGen/Targets/Hexagon.cpp#L407-L417
136+
#[repr(C)]
137+
#[derive(Debug)]
138+
#[rustc_pass_indirectly_in_non_rustic_abis]
139+
struct VaListInner {
140+
__current_saved_reg_area_pointer: *const c_void,
141+
__saved_reg_area_end_pointer: *const c_void,
142+
__overflow_area_pointer: *const c_void,
143+
}
144+
}
145+
127146
// The fallback implementation, used for:
128147
//
129148
// - apple aarch64 (see https://github.com/rust-lang/rust/pull/56599)

0 commit comments

Comments
 (0)