Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
96f385b
RawVecInner: add missing `unsafe` to unsafe fns
btj Aug 7, 2025
42cf78f
llvm: update remarks support on LLVM 22
durin42 Sep 22, 2025
f509dff
f16_f128: enable some more tests in Miri
RalfJung Sep 18, 2025
b2634e3
std: add support for armv7a-vex-v5 target
tropicaaal Sep 24, 2025
a86f140
do not materialise X in [X; 0] when X is unsizing a const
dingxiangfei2009 Aug 11, 2025
120162e
add test fixture for newly allowed const expr
dingxiangfei2009 Aug 12, 2025
b77de83
mark THIR use as candidate for constness check
dingxiangfei2009 Sep 24, 2025
a00f241
unstably constify float mul_add methods
Qelxiros Sep 18, 2025
aa75d34
Small string formatting cleanup
GuillaumeGomez Sep 24, 2025
fe440ec
llvm: add a destructor to call releaseSerializer
cuviper Sep 24, 2025
bc37dd4
Remove an erroneous normalization step in `tests/run-make/linker-warn…
fmease Sep 24, 2025
6de25aa
Rollup merge of #145067 - btj:patch-3, r=tgross35
matthiaskrgr Sep 25, 2025
afef339
Rollup merge of #145277 - dingxiangfei2009:fold-coercion-into-const, …
matthiaskrgr Sep 25, 2025
a4a77e9
Rollup merge of #145973 - vexide:vex-std, r=tgross35
matthiaskrgr Sep 25, 2025
eef61dd
Rollup merge of #146735 - Qelxiros:const_mul_add, r=tgross35,RalfJung
matthiaskrgr Sep 25, 2025
a227044
Rollup merge of #146737 - RalfJung:f16-f128-miri, r=tgross35
matthiaskrgr Sep 25, 2025
fa47398
Rollup merge of #146905 - durin42:llvm-22-bitstream-remarks, r=nikic
matthiaskrgr Sep 25, 2025
a369f41
Rollup merge of #146982 - fmease:fix-rmake-linker-warning, r=bjorn3
matthiaskrgr Sep 25, 2025
12b063e
Rollup merge of #147005 - GuillaumeGomez:string-formatting-cleanup, r…
matthiaskrgr Sep 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
std: add support for armv7a-vex-v5 target
Co-authored-by: Lewis McClelland <lewis@lewismcclelland.me>
  • Loading branch information
tropicaaal and lewisfm committed Sep 24, 2025
commit b2634e31c435aeff149c5660f9329a0578ad1e72
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/targets/armv7a_vex_v5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) fn target() -> Target {
description: Some("ARMv7-A Cortex-A9 VEX V5 Brain".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(false),
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
Expand Down
10 changes: 10 additions & 0 deletions library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ dependencies = [
"rustc-demangle",
"std_detect",
"unwind",
"vex-sdk",
"wasi 0.11.1+wasi-snapshot-preview1",
"wasi 0.14.4+wasi-0.2.4",
"windows-targets 0.0.0",
Expand Down Expand Up @@ -379,6 +380,15 @@ dependencies = [
"rustc-std-workspace-core",
]

[[package]]
name = "vex-sdk"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89f74fce61d7a7ba1589da9634c6305a72befb7cc9150c1f872d87d8060f32b9"
dependencies = [
"rustc-std-workspace-core",
]

[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
Expand Down
7 changes: 6 additions & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ path = "../windows_targets"
rand = { version = "0.9.0", default-features = false, features = ["alloc"] }
rand_xorshift = "0.4.0"

[target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), target_os = "xous", all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
[target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), target_os = "xous", target_os = "vexos", all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
dlmalloc = { version = "0.2.10", features = ['rustc-dep-of-std'] }

[target.x86_64-fortanix-unknown-sgx.dependencies]
Expand All @@ -89,6 +89,11 @@ wasip2 = { version = '0.14.4', features = [
r-efi = { version = "5.2.0", features = ['rustc-dep-of-std'] }
r-efi-alloc = { version = "2.0.0", features = ['rustc-dep-of-std'] }

[target.'cfg(target_os = "vexos")'.dependencies]
vex-sdk = { version = "0.27.0", features = [
'rustc-dep-of-std',
], default-features = false }

[features]
backtrace = [
'addr2line/rustc-dep-of-std',
Expand Down
1 change: 1 addition & 0 deletions library/std/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn main() {
|| target_os == "rtems"
|| target_os == "nuttx"
|| target_os == "cygwin"
|| target_os == "vexos"

// See src/bootstrap/src/core/build_steps/synthetic_targets.rs
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ pub mod consts {
/// * `"redox"`
/// * `"solaris"`
/// * `"solid_asp3`
/// * `"vexos"`
/// * `"vita"`
/// * `"vxworks"`
/// * `"xous"`
Expand Down Expand Up @@ -1148,6 +1149,7 @@ pub mod consts {
///
/// <details><summary>Full list of possible values</summary>
///
/// * `"bin"`
/// * `"exe"`
/// * `"efi"`
/// * `"js"`
Expand Down
3 changes: 3 additions & 0 deletions library/std/src/sys/alloc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ cfg_select! {
target_os = "uefi" => {
mod uefi;
}
target_os = "vexos" => {
mod vexos;
}
target_family = "wasm" => {
mod wasm;
}
Expand Down
96 changes: 96 additions & 0 deletions library/std/src/sys/alloc/vexos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
#![allow(static_mut_refs)]

use crate::alloc::{GlobalAlloc, Layout, System};
use crate::ptr;
use crate::sync::atomic::{AtomicBool, Ordering};

// Symbols for heap section boundaries defined in the target's linkerscript
unsafe extern "C" {
static mut __heap_start: u8;
static mut __heap_end: u8;
}

static mut DLMALLOC: dlmalloc::Dlmalloc<Vexos> = dlmalloc::Dlmalloc::new_with_allocator(Vexos);

struct Vexos;

unsafe impl dlmalloc::Allocator for Vexos {
/// Allocs system resources
fn alloc(&self, _size: usize) -> (*mut u8, usize, u32) {
static INIT: AtomicBool = AtomicBool::new(false);

if !INIT.swap(true, Ordering::Relaxed) {
// This target has no growable heap, as user memory has a fixed
// size/location and VEXos does not manage allocation for us.
unsafe {
(
(&raw mut __heap_start).cast::<u8>(),
(&raw const __heap_end).offset_from_unsigned(&raw const __heap_start),
0,
)
}
} else {
(ptr::null_mut(), 0, 0)
}
}

fn remap(&self, _ptr: *mut u8, _oldsize: usize, _newsize: usize, _can_move: bool) -> *mut u8 {
ptr::null_mut()
}

fn free_part(&self, _ptr: *mut u8, _oldsize: usize, _newsize: usize) -> bool {
false
}

fn free(&self, _ptr: *mut u8, _size: usize) -> bool {
return false;
}

fn can_release_part(&self, _flags: u32) -> bool {
false
}

fn allocates_zeros(&self) -> bool {
false
}

fn page_size(&self) -> usize {
0x1000
}
}

#[stable(feature = "alloc_system_type", since = "1.28.0")]
unsafe impl GlobalAlloc for System {
#[inline]
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
// SAFETY: DLMALLOC access is guaranteed to be safe because we are a single-threaded target, which
// guarantees unique and non-reentrant access to the allocator. As such, no allocator lock is used.
// Calling malloc() is safe because preconditions on this function match the trait method preconditions.
unsafe { DLMALLOC.malloc(layout.size(), layout.align()) }
}

#[inline]
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
// SAFETY: DLMALLOC access is guaranteed to be safe because we are a single-threaded target, which
// guarantees unique and non-reentrant access to the allocator. As such, no allocator lock is used.
// Calling calloc() is safe because preconditions on this function match the trait method preconditions.
unsafe { DLMALLOC.calloc(layout.size(), layout.align()) }
}

#[inline]
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
// SAFETY: DLMALLOC access is guaranteed to be safe because we are a single-threaded target, which
// guarantees unique and non-reentrant access to the allocator. As such, no allocator lock is used.
// Calling free() is safe because preconditions on this function match the trait method preconditions.
unsafe { DLMALLOC.free(ptr, layout.size(), layout.align()) }
}

#[inline]
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
// SAFETY: DLMALLOC access is guaranteed to be safe because we are a single-threaded target, which
// guarantees unique and non-reentrant access to the allocator. As such, no allocator lock is used.
// Calling realloc() is safe because preconditions on this function match the trait method preconditions.
unsafe { DLMALLOC.realloc(ptr, layout.size(), layout.align(), new_size) }
}
}
11 changes: 11 additions & 0 deletions library/std/src/sys/env_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,17 @@ pub mod os {
pub const EXE_EXTENSION: &str = "efi";
}

#[cfg(target_os = "vexos")]
pub mod os {
pub const FAMILY: &str = "";
pub const OS: &str = "vexos";
pub const DLL_PREFIX: &str = "";
pub const DLL_SUFFIX: &str = "";
pub const DLL_EXTENSION: &str = "";
pub const EXE_SUFFIX: &str = ".bin";
pub const EXE_EXTENSION: &str = "bin";
}

#[cfg(target_os = "visionos")]
pub mod os {
pub const FAMILY: &str = "unix";
Expand Down
4 changes: 4 additions & 0 deletions library/std/src/sys/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ cfg_select! {
mod uefi;
use uefi as imp;
}
target_os = "vexos" => {
mod vexos;
use vexos as imp;
}
target_os = "wasi" => {
mod wasi;
use wasi as imp;
Expand Down
Loading
Loading