|
| 1 | +# aarch64_be-unknown-none-softfloat |
| 2 | + |
| 3 | +**Tier: 3** |
| 4 | + |
| 5 | +Target for freestanding/bare-metal big-endian ARM64 binaries in ELF format: |
| 6 | +firmware, kernels, etc. |
| 7 | + |
| 8 | +## Target maintainers |
| 9 | + |
| 10 | +[@Gelbpunkt](https://github.com/Gelbpunkt) |
| 11 | + |
| 12 | +## Requirements |
| 13 | + |
| 14 | +This target is cross-compiled. There is no support for `std`. There is no |
| 15 | +default allocator, but it's possible to use `alloc` by supplying an allocator. |
| 16 | + |
| 17 | +The target does not assume existence of a FPU and does not make use of any |
| 18 | +non-GPR register. This allows the generated code to run in environments, such |
| 19 | +as kernels, which may need to avoid the use of such registers or which may have |
| 20 | +special considerations about the use of such registers (e.g. saving and |
| 21 | +restoring them to avoid breaking userspace code using the same registers). You |
| 22 | +can change code generation to use additional CPU features via the |
| 23 | +`-C target-feature=` codegen options to rustc, or via the `#[target_feature]` |
| 24 | +mechanism within Rust code. |
| 25 | + |
| 26 | +By default, code generated with the soft-float target should run on any |
| 27 | +big-endian ARM64 hardware, enabling additional target features may raise this |
| 28 | +baseline. |
| 29 | + |
| 30 | +`extern "C"` uses the [architecture's standard calling convention][aapcs64]. |
| 31 | + |
| 32 | +[aapcs64]: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst |
| 33 | + |
| 34 | +The targets generate binaries in the ELF format. Any alternate formats or |
| 35 | +special considerations for binary layout will require linker options or linker |
| 36 | +scripts. |
| 37 | + |
| 38 | +## Building the target |
| 39 | + |
| 40 | +You can build Rust with support for the target by adding it to the `target` |
| 41 | +list in `bootstrap.toml`: |
| 42 | + |
| 43 | +```toml |
| 44 | +[build] |
| 45 | +target = ["aarch64_be-unknown-none-softfloat"] |
| 46 | +``` |
| 47 | + |
| 48 | +## Building Rust programs |
| 49 | + |
| 50 | +Rust does not yet ship pre-compiled artifacts for this target. To compile for |
| 51 | +this target, you will first need to build Rust with the target enabled (see |
| 52 | +"Building the target" above). |
| 53 | + |
| 54 | +## Cross-compilation |
| 55 | + |
| 56 | +For cross builds, you will need an appropriate ARM64 C/C++ toolchain for |
| 57 | +linking, or if you want to compile C code along with Rust (such as for Rust |
| 58 | +crates with C dependencies). |
| 59 | + |
| 60 | +Rust *may* be able to use an `aarch64_be-unknown-linux-{gnu,musl}-` toolchain |
| 61 | +with appropriate standalone flags to build for this target (depending on the |
| 62 | +assumptions of that toolchain, see below), or you may wish to use a separate |
| 63 | +`aarch64_be-unknown-none-softfloat` toolchain. |
| 64 | + |
| 65 | +On some ARM64 hosts that use ELF binaries, you *may* be able to use the host C |
| 66 | +toolchain, if it does not introduce assumptions about the host environment that |
| 67 | +don't match the expectations of a standalone environment. Otherwise, you may |
| 68 | +need a separate toolchain for standalone/freestanding development, just as when |
| 69 | +cross-compiling from a non-ARM64 platform. |
| 70 | + |
| 71 | +## Testing |
| 72 | + |
| 73 | +As the target supports a variety of different environments and does not support |
| 74 | +`std`, it does not support running the Rust test suite. |
0 commit comments