Rollup merge of #148137 - bjorn3:redox_fixes, r=mati865

Couple of changes for Redox OS

This upstreams all redox patches that can be upstreamed.

cc ```@jackpot51```
This commit is contained in:
Jacob Pratt
2025-10-30 02:43:44 -04:00
committed by GitHub
7 changed files with 34 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ pub(crate) fn opts() -> TargetOptions {
has_thread_local: true,
crt_static_default: true,
crt_static_respected: true,
crt_static_allows_dylibs: true,
crt_static_allows_dylibs: false,
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-lgcc"]),
..Default::default()
}

View File

@@ -1553,6 +1553,7 @@ supported_targets! {
("aarch64-unknown-redox", aarch64_unknown_redox),
("i586-unknown-redox", i586_unknown_redox),
("riscv64gc-unknown-redox", riscv64gc_unknown_redox),
("x86_64-unknown-redox", x86_64_unknown_redox),
("x86_64-unknown-managarm-mlibc", x86_64_unknown_managarm_mlibc),

View File

@@ -0,0 +1,25 @@
use crate::spec::{CodeModel, Target, TargetMetadata, base};
pub(crate) fn target() -> Target {
let mut base = base::redox::opts();
base.code_model = Some(CodeModel::Medium);
base.cpu = "generic-rv64".into();
base.features = "+m,+a,+f,+d,+c".into();
base.llvm_abiname = "lp64d".into();
base.plt_by_default = false;
base.max_atomic_width = Some(64);
Target {
llvm_target: "riscv64-unknown-redox".into(),
metadata: TargetMetadata {
description: Some("Redox OS".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 64,
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
arch: "riscv64".into(),
options: base,
}
}

View File

@@ -34,6 +34,7 @@ pub struct Finder {
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
const STAGE0_MISSING_TARGETS: &[&str] = &[
// just a dummy comment so the list doesn't get onelined
"riscv64gc-unknown-redox",
];
/// Minimum version threshold for libstdc++ required when using prebuilt LLVM

View File

@@ -393,6 +393,7 @@ target | std | host | notes
[`riscv64gc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | RISC-V NetBSD
[`riscv64gc-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
[`riscv64gc-unknown-redox`](platform-support/redox.md) | ✓ | | RISC-V 64bit Redox OS
[`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX
[`riscv64a23-unknown-linux-gnu`](platform-support/riscv64a23-unknown-linux-gnu.md) | ✓ | ✓ | RISC-V Linux (kernel 6.8.0+, glibc 2.39)
[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.3)

View File

@@ -10,6 +10,7 @@ Target triplets available so far:
- `x86_64-unknown-redox` (tier 2)
- `aarch64-unknown-redox` (tier 3)
- `i586-unknown-redox` (tier 3)
- `riscv64gc-unknown-redox` (tier 3)
## Target maintainers
@@ -37,6 +38,7 @@ target = [
"x86_64-unknown-redox",
"aarch64-unknown-redox",
"i586-unknown-redox",
"riscv64gc-unknown-redox",
]
```

View File

@@ -505,6 +505,9 @@
//@ revisions: riscv64gc_unknown_openbsd
//@ [riscv64gc_unknown_openbsd] compile-flags: --target riscv64gc-unknown-openbsd
//@ [riscv64gc_unknown_openbsd] needs-llvm-components: riscv
//@ revisions: riscv64gc_unknown_redox
//@ [riscv64gc_unknown_redox] compile-flags: --target riscv64gc-unknown-redox
//@ [riscv64gc_unknown_redox] needs-llvm-components: riscv
//@ revisions: riscv64imac_unknown_none_elf
//@ [riscv64imac_unknown_none_elf] compile-flags: --target riscv64imac-unknown-none-elf
//@ [riscv64imac_unknown_none_elf] needs-llvm-components: riscv