Skip to content

Commit 10ae04a

Browse files
committed
add missing description of the target aarch64-unknown-none-hermitkernel
1 parent 0b269f3 commit 10ae04a

File tree

2 files changed

+81
-3
lines changed

2 files changed

+81
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ target | std | host | notes
204204
`aarch64-apple-tvos` | * | | ARM64 tvOS
205205
[`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3
206206
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
207-
`aarch64-unknown-hermit` | ? | |
207+
`aarch64_unknown_hermit` | ✓ | |ARM64 HermitCore
208+
[`aarch64_unknown_none_hermitkernel`](platform-support/aarch64-unknown-none-hermitkernel.md) | * | | ARM64 HermitCore kernel
208209
`aarch64-unknown-uefi` | * | | ARM64 UEFI
209210
`aarch64-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (ILP32 ABI)
210211
`aarch64-unknown-netbsd` | ✓ | ✓ |
@@ -286,10 +287,10 @@ target | std | host | notes
286287
`x86_64-sun-solaris` | ? | | Deprecated target for 64-bit Solaris 10/11, illumos
287288
`x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD
288289
`x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku
289-
`x86_64-unknown-hermit` | ? | |
290+
`x86_64-unknown-hermit` | | | HermitCore
290291
`x86_64-unknown-l4re-uclibc` | ? | |
291292
[`x86_64-unknown-none`](platform-support/x86_64-unknown-none.md) | * | | Freestanding/bare-metal x86_64, softfloat
292-
`x86_64-unknown-none-hermitkernel` | ? | | HermitCore kernel
293+
`x86_64-unknown-none-hermitkernel` | * | | HermitCore kernel
293294
`x86_64-unknown-none-linuxkernel` | * | | Linux kernel modules
294295
[`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD
295296
`x86_64-unknown-uefi` | * | | 64-bit UEFI
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# `aarch64-unknown-none-hermitkernel`
2+
3+
**Tier: 3**
4+
5+
Required to build the kernel for [HermitCore](https://github.com/hermitcore/hermit-playground)
6+
or [RustyHermit](https://github.com/hermitcore/rusty-hermit).
7+
The result is a bare-metal aarch64 binary in ELF format.
8+
9+
## Target maintainers
10+
11+
- Stefan Lankes, https://github.com/stlankes
12+
13+
## Requirements
14+
15+
This target is cross-compiled. There is no support for `std`, but the
16+
library operating system provides a simple allocator to use `alloc`.
17+
18+
By default, Rust code generated for this target does not use any vector or
19+
floating-point registers. This allows the generated code to build the library
20+
operaring system, which may need to avoid the use of such
21+
registers or which may have special considerations about the use of such
22+
registers (e.g. saving and restoring them to avoid breaking userspace code
23+
using the same registers). In contrast to `aarch64-unknown-none-softfloat`,
24+
the target is completly relocatable, which is a required feature of RustyHermit.
25+
26+
By default, code generated with this target should run on any `aarch64`
27+
hardware; enabling additional target features may raise this baseline.
28+
On `aarch64-unknown-none-hermitkernel`, `extern "C"` uses the [standard System V calling
29+
convention](https://github.com/ARM-software/abi-aa/releases/download/2021Q3/sysvabi64.pdf),
30+
without red zones.
31+
32+
This target generated binaries in the ELF format.
33+
34+
## Building the target
35+
36+
Typical you should not use the target directly. The target `aarch64-unknown-hermit`
37+
builds the _user space_ of RustyHermit and supports red zones and floating-point
38+
operations.
39+
To build and link the kernel to the application, the crate
40+
[hermit-sys](https://github.com/hermitcore/rusty-hermit/tree/master/hermit-sys)
41+
should be used by adding the following lines to the `Cargo.toml` file of
42+
your application.
43+
44+
```toml
45+
[target.'cfg(target_os = "hermit")'.dependencies]
46+
hermit-sys = "0.1.*"
47+
```
48+
49+
The crate `hermit-sys` uses the target `aarch64-unknown-none-hermitkernel`
50+
to build the kernel.
51+
52+
## Building Rust programs
53+
54+
Rust does not yet ship pre-compiled artifacts for this target. To compile for
55+
this target, you need to build the crate `hermit-sys` (see
56+
"Building the target" above).
57+
58+
## Testing
59+
60+
As `aarch64-unknown-none-hermitkernel` does not support `std`
61+
and does not support running any Rust testsuite.
62+
63+
## Cross-compilation toolchains and C code
64+
65+
If you want to compile C code along with Rust you will need an
66+
appropriate `aarch64` toolchain.
67+
68+
Rust *may* be able to use an `aarch64-linux-gnu-` toolchain with appropriate
69+
standalone flags to build for this toolchain (depending on the assumptions of
70+
that toolchain, see below), or you may wish to use a separate
71+
`aarch64-unknown-none` (or `aarch64-elf-`) toolchain.
72+
73+
On some `aarch64` hosts that use ELF binaries, you *may* be able to use the host
74+
C toolchain, if it does not introduce assumptions about the host environment
75+
that don't match the expectations of a standalone environment. Otherwise, you
76+
may need a separate toolchain for standalone/freestanding development, just as
77+
when cross-compiling from a non-`aarch64` platform.

0 commit comments

Comments
 (0)