Skip to content

Commit a749188

Browse files
authored
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```
2 parents 35fcb55 + fa0f163 commit a749188

File tree

7 files changed

+34
-1
lines changed

7 files changed

+34
-1
lines changed

compiler/rustc_target/src/spec/base/redox.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) fn opts() -> TargetOptions {
1212
has_thread_local: true,
1313
crt_static_default: true,
1414
crt_static_respected: true,
15-
crt_static_allows_dylibs: true,
15+
crt_static_allows_dylibs: false,
1616
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-lgcc"]),
1717
..Default::default()
1818
}

compiler/rustc_target/src/spec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,7 @@ supported_targets! {
15531553

15541554
("aarch64-unknown-redox", aarch64_unknown_redox),
15551555
("i586-unknown-redox", i586_unknown_redox),
1556+
("riscv64gc-unknown-redox", riscv64gc_unknown_redox),
15561557
("x86_64-unknown-redox", x86_64_unknown_redox),
15571558

15581559
("x86_64-unknown-managarm-mlibc", x86_64_unknown_managarm_mlibc),
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use crate::spec::{CodeModel, Target, TargetMetadata, base};
2+
3+
pub(crate) fn target() -> Target {
4+
let mut base = base::redox::opts();
5+
base.code_model = Some(CodeModel::Medium);
6+
base.cpu = "generic-rv64".into();
7+
base.features = "+m,+a,+f,+d,+c".into();
8+
base.llvm_abiname = "lp64d".into();
9+
base.plt_by_default = false;
10+
base.max_atomic_width = Some(64);
11+
12+
Target {
13+
llvm_target: "riscv64-unknown-redox".into(),
14+
metadata: TargetMetadata {
15+
description: Some("Redox OS".into()),
16+
tier: Some(3),
17+
host_tools: Some(false),
18+
std: Some(true),
19+
},
20+
pointer_width: 64,
21+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
22+
arch: "riscv64".into(),
23+
options: base,
24+
}
25+
}

src/bootstrap/src/core/sanity.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub struct Finder {
3434
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
3535
const STAGE0_MISSING_TARGETS: &[&str] = &[
3636
// just a dummy comment so the list doesn't get onelined
37+
"riscv64gc-unknown-redox",
3738
];
3839

3940
/// Minimum version threshold for libstdc++ required when using prebuilt LLVM

src/doc/rustc/src/platform-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ target | std | host | notes
393393
[`riscv64gc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | RISC-V NetBSD
394394
[`riscv64gc-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX
395395
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
396+
[`riscv64gc-unknown-redox`](platform-support/redox.md) | ✓ | | RISC-V 64bit Redox OS
396397
[`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX
397398
[`riscv64a23-unknown-linux-gnu`](platform-support/riscv64a23-unknown-linux-gnu.md) | ✓ | ✓ | RISC-V Linux (kernel 6.8.0+, glibc 2.39)
398399
[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.3)

src/doc/rustc/src/platform-support/redox.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Target triplets available so far:
1010
- `x86_64-unknown-redox` (tier 2)
1111
- `aarch64-unknown-redox` (tier 3)
1212
- `i586-unknown-redox` (tier 3)
13+
- `riscv64gc-unknown-redox` (tier 3)
1314

1415
## Target maintainers
1516

@@ -37,6 +38,7 @@ target = [
3738
"x86_64-unknown-redox",
3839
"aarch64-unknown-redox",
3940
"i586-unknown-redox",
41+
"riscv64gc-unknown-redox",
4042
]
4143
```
4244

tests/assembly-llvm/targets/targets-elf.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@
505505
//@ revisions: riscv64gc_unknown_openbsd
506506
//@ [riscv64gc_unknown_openbsd] compile-flags: --target riscv64gc-unknown-openbsd
507507
//@ [riscv64gc_unknown_openbsd] needs-llvm-components: riscv
508+
//@ revisions: riscv64gc_unknown_redox
509+
//@ [riscv64gc_unknown_redox] compile-flags: --target riscv64gc-unknown-redox
510+
//@ [riscv64gc_unknown_redox] needs-llvm-components: riscv
508511
//@ revisions: riscv64imac_unknown_none_elf
509512
//@ [riscv64imac_unknown_none_elf] compile-flags: --target riscv64imac-unknown-none-elf
510513
//@ [riscv64imac_unknown_none_elf] needs-llvm-components: riscv

0 commit comments

Comments
 (0)