Rollup merge of #139310 - mvolfik:helenos-compiler, r=wesleywiser
add first HelenOS compilation targets
I'm working on adding a HelenOS compilation target for Rust as my bachelor thesis. I understood that the policy for tier 3 targets is quite liberal, so here's my attempt at upstreaming the initial support. I'm quite new to Rust internals, so thanks in advance for all assistance with my stupid questions :)
libstd support is coming, but I understood compiler support must come first before libc bindings can get merged (https://github.com/rust-lang/libc/pull/4355#issuecomment-2768489857)
Locally, I also needed to update `cc-rs`, to do two things:
- add [here](59578addda/src/lib.rs (L3397)) the binutils prefixes (`x86_64-unknown-helenos` -> `amd64-helenos`
- add the targets to `generated.rs`
From the "Adding tier 3 target" guide it sound like the latter will happen automatically, the first I need to do manually? I'm not sure if the test suite will pass or fail without it.
I'm also quite unsure about all the target spec configuration flags. I copied the specs from other small OSs with some tweaks and things seems to work now, but I have no idea how to better judge if it's correct.
Finally, I'm also working on support for arm (32-bit and 64), but there I'm currently running into some issues with linking, so I'll send that later, if I figure it out.
---
<details>
<summary>Tier 3 policy "form"</summary>
> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)
That would be me, I suppose. I agree.
> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.
I'm using the standard Rust conventions.
> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.
> - The target must not introduce license incompatibilities.
> - Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).
I am not aware of any legal issues. HelenOS itself is open-source under BSD license. All code contributed in this PR (and later for libstd) is either fully my own or an adaptation of existing code from this repo (some PAL pieces).
> - The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.
I am not adding any new dependencies.
> - Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.
The HelenOS build tools consist of open-source patches to GCC and binutils, so I suppose we're fine.
> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.
Understood.
> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.
The libstd PR will fully support core+alloc, and enough of std to run interesting programs (stdio, argv and fs) - so we can run tools like [imagecli](https://github.com/theotherphil/imagecli). But yes, major parts of std are missing - pipe, process and net are currently forwarded to `unsupported()`. Some barebones `net` should be possible, but e.g. cloning of the descriptor is unheard of in HelenOS, so it won't be as straightforward as the rest. Also, some places of the `fs` and `thread` module are also quite stubby (but part of it is just because HelenOS has no file permissions, for example). HelenOS is a small, experimental OS, so its own libc is stubbed out as well in some places. I hope this state is acceptable?
> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.
I hope the guide in doc is sufficient.
> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via ```@)``` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.
Understood.
> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.
Understood.
> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.)
Umm, I think this is satisfied? Code generation works with the default LLVM backend, even though it has no idea about HelenOS. And our GCC patch is then used only for linking.
</details>
This commit is contained in:
commit
652e5cb1e3
15 changed files with 244 additions and 3 deletions
17
compiler/rustc_target/src/spec/base/helenos.rs
Normal file
17
compiler/rustc_target/src/spec/base/helenos.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use crate::spec::{PanicStrategy, RelroLevel, StackProbeType, TargetOptions};
|
||||
|
||||
pub(crate) fn opts() -> TargetOptions {
|
||||
TargetOptions {
|
||||
os: "helenos".into(),
|
||||
|
||||
dynamic_linking: true,
|
||||
// we need the linker to keep libgcc and friends
|
||||
no_default_libraries: false,
|
||||
has_rpath: true,
|
||||
relro_level: RelroLevel::Full,
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
stack_probes: StackProbeType::Inline,
|
||||
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ pub(crate) mod dragonfly;
|
|||
pub(crate) mod freebsd;
|
||||
pub(crate) mod fuchsia;
|
||||
pub(crate) mod haiku;
|
||||
pub(crate) mod helenos;
|
||||
pub(crate) mod hermit;
|
||||
pub(crate) mod hurd;
|
||||
pub(crate) mod hurd_gnu;
|
||||
|
|
|
|||
|
|
@ -1534,6 +1534,12 @@ supported_targets! {
|
|||
("i686-unknown-haiku", i686_unknown_haiku),
|
||||
("x86_64-unknown-haiku", x86_64_unknown_haiku),
|
||||
|
||||
("aarch64-unknown-helenos", aarch64_unknown_helenos),
|
||||
("i686-unknown-helenos", i686_unknown_helenos),
|
||||
("powerpc-unknown-helenos", powerpc_unknown_helenos),
|
||||
("sparc64-unknown-helenos", sparc64_unknown_helenos),
|
||||
("x86_64-unknown-helenos", x86_64_unknown_helenos),
|
||||
|
||||
("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
|
||||
("x86_64-unknown-hurd-gnu", x86_64_unknown_hurd_gnu),
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
use crate::spec::{Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let mut base = base::helenos::opts();
|
||||
base.max_atomic_width = Some(128);
|
||||
base.features = "+v8a".into();
|
||||
base.linker = Some("aarch64-helenos-gcc".into());
|
||||
|
||||
Target {
|
||||
llvm_target: "aarch64-unknown-helenos".into(),
|
||||
metadata: crate::spec::TargetMetadata {
|
||||
description: Some("ARM64 HelenOS".into()),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(true),
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: "aarch64".into(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
use crate::spec::{Cc, LinkerFlavor, Lld, RustcAbi, Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let mut base = base::helenos::opts();
|
||||
base.cpu = "pentium4".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
base.linker = Some("i686-helenos-gcc".into());
|
||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
|
||||
base.rustc_abi = Some(RustcAbi::X86Sse2);
|
||||
|
||||
Target {
|
||||
llvm_target: "i686-unknown-helenos".into(),
|
||||
metadata: crate::spec::TargetMetadata {
|
||||
description: Some("IA-32 (i686) HelenOS".into()),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(true),
|
||||
},
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
|
||||
i128:128-f64:32:64-f80:32-n8:16:32-S128"
|
||||
.into(),
|
||||
arch: "x86".into(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetMetadata, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let mut base = base::helenos::opts();
|
||||
base.endian = Endian::Big;
|
||||
base.max_atomic_width = Some(32);
|
||||
base.linker = Some("ppc-helenos-gcc".into());
|
||||
|
||||
Target {
|
||||
llvm_target: "powerpc-unknown-helenos".into(),
|
||||
metadata: TargetMetadata {
|
||||
description: Some("PowerPC HelenOS".into()),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(true),
|
||||
},
|
||||
pointer_width: 32,
|
||||
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
|
||||
arch: "powerpc".into(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let mut base = base::helenos::opts();
|
||||
base.endian = Endian::Big;
|
||||
base.cpu = "v9".into();
|
||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
||||
base.max_atomic_width = Some(64);
|
||||
base.linker = Some("sparc64-helenos-gcc".into());
|
||||
|
||||
Target {
|
||||
llvm_target: "sparc64-unknown-helenos".into(),
|
||||
metadata: TargetMetadata {
|
||||
description: Some("SPARC HelenOS".into()),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(true),
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout: "E-m:e-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: "sparc64".into(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let mut base = base::helenos::opts();
|
||||
base.cpu = "x86-64".into();
|
||||
base.plt_by_default = false;
|
||||
base.max_atomic_width = Some(64);
|
||||
base.linker = Some("amd64-helenos-gcc".into());
|
||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
||||
|
||||
Target {
|
||||
llvm_target: "x86_64-unknown-helenos".into(),
|
||||
metadata: crate::spec::TargetMetadata {
|
||||
description: Some("64-bit HelenOS".into()),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(true),
|
||||
},
|
||||
pointer_width: 64,
|
||||
data_layout:
|
||||
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
|
||||
arch: "x86_64".into(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,11 @@ 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] = &[
|
||||
"aarch64-unknown-helenos",
|
||||
"i686-unknown-helenos",
|
||||
"x86_64-unknown-helenos",
|
||||
"powerpc-unknown-helenos",
|
||||
"sparc64-unknown-helenos",
|
||||
// just a dummy comment so the list doesn't get onelined
|
||||
"riscv64gc-unknown-redox",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@
|
|||
- [solaris](platform-support/solaris.md)
|
||||
- [\*-nto-qnx-\*](platform-support/nto-qnx.md)
|
||||
- [\*-unikraft-linux-musl](platform-support/unikraft-linux-musl.md)
|
||||
- [\*-unknown-helenos](platform-support/helenos.md)
|
||||
- [\*-unknown-hermit](platform-support/hermit.md)
|
||||
- [\*-unknown-freebsd](platform-support/freebsd.md)
|
||||
- [\*-unknown-managarm-mlibc](platform-support/managarm.md)
|
||||
|
|
|
|||
|
|
@ -255,6 +255,7 @@ target | std | host | notes
|
|||
[`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3
|
||||
[`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon
|
||||
[`aarch64-unknown-freebsd`](platform-support/freebsd.md) | ✓ | ✓ | ARM64 FreeBSD
|
||||
[`aarch64-unknown-helenos`](platform-support/helenos.md) | ✓ | | ARM64 HelenOS
|
||||
[`aarch64-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit
|
||||
[`aarch64-unknown-illumos`](platform-support/illumos.md) | ✓ | ✓ | ARM64 illumos
|
||||
`aarch64-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (ILP32 ABI)
|
||||
|
|
@ -320,6 +321,7 @@ target | std | host | notes
|
|||
[`i686-apple-darwin`](platform-support/apple-darwin.md) | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+, Penryn) [^x86_32-floats-return-ABI]
|
||||
[`i686-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS (Pentium 4) [^x86_32-floats-return-ABI]
|
||||
`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku (Pentium 4) [^x86_32-floats-return-ABI]
|
||||
[`i686-unknown-helenos`](platform-support/helenos.md) | ✓ | | HelenOS IA-32 (see docs for pending issues)
|
||||
[`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (Pentium 4) [^x86_32-floats-return-ABI]
|
||||
[`i686-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/i386 (Pentium 4) [^x86_32-floats-return-ABI]
|
||||
[`i686-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 32-bit OpenBSD (Pentium 4) [^x86_32-floats-return-ABI]
|
||||
|
|
@ -356,6 +358,7 @@ target | std | host | notes
|
|||
[`mipsisa64r6el-unknown-linux-gnuabi64`](platform-support/mips-release-6.md) | ✓ | ✓ | 64-bit MIPS Release 6 Little Endian
|
||||
`msp430-none-elf` | * | | 16-bit MSP430 microcontrollers
|
||||
[`powerpc-unknown-freebsd`](platform-support/freebsd.md) | ? | | PowerPC FreeBSD
|
||||
[`powerpc-unknown-helenos`](platform-support/helenos.md) | ✓ | | PowerPC HelenOS
|
||||
[`powerpc-unknown-linux-gnuspe`](platform-support/powerpc-unknown-linux-gnuspe.md) | ✓ | | PowerPC SPE Linux
|
||||
`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.3
|
||||
[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.3
|
||||
|
|
@ -399,6 +402,7 @@ target | std | host | notes
|
|||
[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.3)
|
||||
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
|
||||
[`sparc-unknown-none-elf`](./platform-support/sparc-unknown-none-elf.md) | * | | Bare 32-bit SPARC V7+
|
||||
[`sparc64-unknown-helenos`](platform-support/helenos.md) | ✓ | | sparc64 HelenOS
|
||||
[`sparc64-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/sparc64
|
||||
[`sparc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/sparc64
|
||||
[`thumbv4t-none-eabi`](platform-support/armv4t-none-eabi.md) | * | | Thumb-mode Bare Armv4T
|
||||
|
|
@ -429,6 +433,7 @@ target | std | host | notes
|
|||
`x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD
|
||||
`x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku
|
||||
[`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit
|
||||
[`x86_64-unknown-helenos`](platform-support/helenos.md) | ✓ | | x86_64 (amd64) HelenOS
|
||||
[`x86_64-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 64-bit GNU/Hurd
|
||||
`x86_64-unknown-l4re-uclibc` | ? | |
|
||||
[`x86_64-unknown-linux-none`](platform-support/x86_64-unknown-linux-none.md) | * | | 64-bit Linux with no libc
|
||||
|
|
|
|||
68
src/doc/rustc/src/platform-support/helenos.md
Normal file
68
src/doc/rustc/src/platform-support/helenos.md
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
# `*-unknown-helenos`
|
||||
|
||||
**Tier: 3**
|
||||
|
||||
Targets for [HelenOS](https://www.helenos.org).
|
||||
These targets allow compiling user-space applications, that you can then copy into your HelenOS ISO image to run them.
|
||||
|
||||
Target triplets available:
|
||||
|
||||
- `x86_64-unknown-helenos`
|
||||
- `sparc64-unknown-helenos`
|
||||
- `powerpc-unknown-helenos`
|
||||
- `aarch64-unknown-helenos`
|
||||
- `i686-unknown-helenos`*
|
||||
|
||||
|
||||
On i686, some portions of native HelenOS libraries run into issues due to vector instructions accessing variables from the stack that seems
|
||||
to be misaligned. It is not clear if this is fault of HelenOS or Rust. Most programs work, but for example calling `ui_window_create` from HelenOS
|
||||
libui does not work.
|
||||
|
||||
## Target maintainers
|
||||
|
||||
- Matěj Volf ([@mvolfik](https://github.com/mvolfik))
|
||||
|
||||
## Requirements
|
||||
|
||||
These targets only support cross-compilation. The targets will[^helenos-libstd-pending] support libstd, although support of some platform features (filesystem, networking) may be limited.
|
||||
|
||||
You need to have a local clone of the HelenOS repository and the HelenOS toolchain set up, no HelenOS-Rust development artifacts are available.
|
||||
|
||||
[^helenos-libstd-pending]: libstd is not yet available, because it needs to be done in a separate PR, because compiler support needs to be merged first to allow creating libc bindings
|
||||
|
||||
## Building
|
||||
|
||||
If you want to avoid the full setup, fully automated Docker-based build system is available at https://github.com/mvolfik/helenos-rust-autobuild
|
||||
|
||||
### HelenOS toolchain setup
|
||||
|
||||
For compilation of standard library, you need to build the HelenOS toolchain (because Rust needs to use `*-helenos-gcc` as linker) and its libraries (libc and a few others). See [this HelenOS wiki page](https://www.helenos.org/wiki/UsersGuide/CompilingFromSource#a2.Buildasupportedcross-compiler) for instruction on setting up the build. At the end of step 4 (_Configure and build_), after `ninja image_path`, invoke `ninja export-dev` to build the shared libraries.
|
||||
|
||||
Copy the libraries to the path where the compiler automatically searches for them. This will be the directory where you installed the toolchain (for example `~/.local/share/HelenOS/cross/i686-helenos/lib`). In the folder where you built HelenOS, you can run these commands:
|
||||
|
||||
```sh
|
||||
touch /tmp/test.c
|
||||
HELENOS_LIB_PATH="$(realpath "$(amd64-helenos-gcc -v -c /tmp/test.c 2>&1 | grep LIBRARY_PATH | cut -d= -f2 | cut -d: -f2)")"
|
||||
# use sparc64-helenos-gcc above for the SPARC toolchain, etc
|
||||
cp -P export-dev/lib/* "$HELENOS_LIB_PATH"
|
||||
```
|
||||
|
||||
### Building the target
|
||||
|
||||
When you have the HelenOS toolchain set up and installed in your path, you can build the Rust toolchain using the standard procedure. See [rustc dev guide](https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html).
|
||||
|
||||
In the most simple case, this means that you can run `./x build library --stage 1 --target x86_64-unknown-linux-gnu,<arch>-unknown-helenos` (the first target triple should be your host machine, adjust accordingly). Then run `rustup toolchain link mytoolchain build/host/stage1` to allow using your toolchain for building Rust programs.
|
||||
|
||||
### Building Rust programs
|
||||
|
||||
If you linked the toolchain above as `mytoolchain`, run `cargo +mytoolchain build --target <arch>-unknown-helenos`.
|
||||
|
||||
## Testing
|
||||
|
||||
After you build a Rust program for HelenOS, you can put it into the `dist` directory of the HelenOS build, build the ISO image, and then run it either in an emulator, or on real hardware. See HelenOS wiki for further instructions on running the OS.
|
||||
|
||||
Running the Rust testsuite has not been attempted yet due to missing host tools (thus the test suite can't be run natively) and insufficient networking support (thus we can't use the `remote-test-server` tool).
|
||||
|
||||
## Cross-compilation toolchains and C code
|
||||
|
||||
You should be able to cross-compile and link any needed C code using `<arch>-helenos-gcc` that you built above. However, note that clang support is highly lacking. Therefore, to run tools such as `bindgen`, you will need to provide flag `-nostdinc` and manually specify the include paths to HelenOS headers, which you will find in the `export-dev` folder + in the cross-compilation toolchain (e.g. `~/.local/share/HelenOS/cross/lib/gcc/i686-helenos/14.2.0/include`). You can see an example of proper build.rs at https://github.com/mvolfik/helenos-ui-rs/blob/master/build.rs
|
||||
|
|
@ -34,6 +34,9 @@
|
|||
//@ revisions: aarch64_unknown_fuchsia
|
||||
//@ [aarch64_unknown_fuchsia] compile-flags: --target aarch64-unknown-fuchsia
|
||||
//@ [aarch64_unknown_fuchsia] needs-llvm-components: aarch64
|
||||
//@ revisions: aarch64_unknown_helenos
|
||||
//@ [aarch64_unknown_helenos] compile-flags: --target aarch64-unknown-helenos
|
||||
//@ [aarch64_unknown_helenos] needs-llvm-components: aarch64
|
||||
//@ revisions: aarch64_unknown_hermit
|
||||
//@ [aarch64_unknown_hermit] compile-flags: --target aarch64-unknown-hermit
|
||||
//@ [aarch64_unknown_hermit] needs-llvm-components: aarch64
|
||||
|
|
@ -256,6 +259,9 @@
|
|||
//@ revisions: i686_unknown_haiku
|
||||
//@ [i686_unknown_haiku] compile-flags: --target i686-unknown-haiku
|
||||
//@ [i686_unknown_haiku] needs-llvm-components: x86
|
||||
//@ revisions: i686_unknown_helenos
|
||||
//@ [i686_unknown_helenos] compile-flags: --target i686-unknown-helenos
|
||||
//@ [i686_unknown_helenos] needs-llvm-components: x86
|
||||
//@ revisions: i686_unknown_hurd_gnu
|
||||
//@ [i686_unknown_hurd_gnu] compile-flags: --target i686-unknown-hurd-gnu
|
||||
//@ [i686_unknown_hurd_gnu] needs-llvm-components: x86
|
||||
|
|
@ -394,6 +400,9 @@
|
|||
//@ revisions: powerpc_unknown_freebsd
|
||||
//@ [powerpc_unknown_freebsd] compile-flags: --target powerpc-unknown-freebsd
|
||||
//@ [powerpc_unknown_freebsd] needs-llvm-components: powerpc
|
||||
//@ revisions: powerpc_unknown_helenos
|
||||
//@ [powerpc_unknown_helenos] compile-flags: --target powerpc-unknown-helenos
|
||||
//@ [powerpc_unknown_helenos] needs-llvm-components: powerpc
|
||||
//@ revisions: powerpc_unknown_linux_gnu
|
||||
//@ [powerpc_unknown_linux_gnu] compile-flags: --target powerpc-unknown-linux-gnu
|
||||
//@ [powerpc_unknown_linux_gnu] needs-llvm-components: powerpc
|
||||
|
|
@ -517,6 +526,9 @@
|
|||
//@ revisions: s390x_unknown_linux_musl
|
||||
//@ [s390x_unknown_linux_musl] compile-flags: --target s390x-unknown-linux-musl
|
||||
//@ [s390x_unknown_linux_musl] needs-llvm-components: systemz
|
||||
//@ revisions: sparc64_unknown_helenos
|
||||
//@ [sparc64_unknown_helenos] compile-flags: --target sparc64-unknown-helenos
|
||||
//@ [sparc64_unknown_helenos] needs-llvm-components: sparc
|
||||
//@ revisions: sparc64_unknown_linux_gnu
|
||||
//@ [sparc64_unknown_linux_gnu] compile-flags: --target sparc64-unknown-linux-gnu
|
||||
//@ [sparc64_unknown_linux_gnu] needs-llvm-components: sparc
|
||||
|
|
@ -634,6 +646,9 @@
|
|||
//@ revisions: x86_64_unknown_haiku
|
||||
//@ [x86_64_unknown_haiku] compile-flags: --target x86_64-unknown-haiku
|
||||
//@ [x86_64_unknown_haiku] needs-llvm-components: x86
|
||||
//@ revisions: x86_64_unknown_helenos
|
||||
//@ [x86_64_unknown_helenos] compile-flags: --target x86_64-unknown-helenos
|
||||
//@ [x86_64_unknown_helenos] needs-llvm-components: x86
|
||||
//@ revisions: x86_64_unknown_hurd_gnu
|
||||
//@ [x86_64_unknown_hurd_gnu] compile-flags: --target x86_64-unknown-hurd-gnu
|
||||
//@ [x86_64_unknown_hurd_gnu] needs-llvm-components: x86
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ warning: unexpected `cfg` condition value: `does_not_exist`
|
|||
LL | #![cfg(not(target(os = "does_not_exist")))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, and `trusty` and 12 more
|
||||
= note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, and `teeos` and 13 more
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
|||
LL | target_os = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm`
|
||||
= note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
|
|
@ -274,7 +274,7 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux`
|
|||
| |
|
||||
| help: there is a expected value with a similar name: `"linux"`
|
||||
|
|
||||
= note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm`
|
||||
= note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: 28 warnings emitted
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue