Skip to content

Commit f6d58ea

Browse files
authored
Rollup merge of #111326 - he32:netbsd-aarch64-be, r=oli-obk
Add support for NetBSD/aarch64-be (big-endian arm64).
2 parents 25b5af1 + abb4395 commit f6d58ea

File tree

6 files changed

+134
-6
lines changed

6 files changed

+134
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use crate::abi::Endian;
2+
use crate::spec::{Target, TargetOptions};
3+
4+
pub fn target() -> Target {
5+
Target {
6+
llvm_target: "aarch64_be-unknown-netbsd".into(),
7+
pointer_width: 64,
8+
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
9+
arch: "aarch64".into(),
10+
options: TargetOptions {
11+
mcount: "__mcount".into(),
12+
max_atomic_width: Some(128),
13+
endian: Endian::Big,
14+
..super::netbsd_base::opts()
15+
},
16+
}
17+
}

compiler/rustc_target/src/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,7 @@ supported_targets! {
11941194
("x86_64-unknown-openbsd", x86_64_unknown_openbsd),
11951195

11961196
("aarch64-unknown-netbsd", aarch64_unknown_netbsd),
1197+
("aarch64_be-unknown-netbsd", aarch64_be_unknown_netbsd),
11971198
("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
11981199
("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
11991200
("i686-unknown-netbsd", i686_unknown_netbsd),

src/bootstrap/bootstrap.py

+1
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def default_build_triple(verbose):
323323
cputype_mapper = {
324324
'BePC': 'i686',
325325
'aarch64': 'aarch64',
326+
'aarch64eb': 'aarch64',
326327
'amd64': 'x86_64',
327328
'arm64': 'aarch64',
328329
'i386': 'i686',

src/doc/rustc/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md)
4141
- [*-pc-windows-gnullvm](platform-support/pc-windows-gnullvm.md)
4242
- [\*-nto-qnx-\*](platform-support/nto-qnx.md)
43+
- [\*-unknown-netbsd\*](platform-support/netbsd.md)
4344
- [*-unknown-openbsd](platform-support/openbsd.md)
4445
- [\*-unknown-uefi](platform-support/unknown-uefi.md)
4546
- [wasm64-unknown-unknown](platform-support/wasm64-unknown-unknown.md)

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

+7-6
Original file line numberDiff line numberDiff line change
@@ -224,29 +224,30 @@ target | std | host | notes
224224
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
225225
`aarch64-unknown-hermit` | ✓ | | ARM64 HermitCore
226226
`aarch64-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (ILP32 ABI)
227-
`aarch64-unknown-netbsd` | ✓ | ✓ |
227+
[`aarch64-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | ARM64 NetBSD
228228
[`aarch64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | ARM64 OpenBSD
229229
`aarch64-unknown-redox` | ? | | ARM64 Redox OS
230230
`aarch64-uwp-windows-msvc` | ? | |
231231
`aarch64-wrs-vxworks` | ? | |
232232
`aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI)
233233
`aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian)
234+
[`aarch64_be-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | ARM64 NetBSD (big-endian)
234235
[`arm64_32-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | ARM Apple WatchOS 64-bit with 32-bit pointers
235236
[`armeb-unknown-linux-gnueabi`](platform-support/armeb-unknown-linux-gnueabi.md) | ✓ | ? | ARM BE8 the default ARM big-endian architecture since [ARMv6](https://developer.arm.com/documentation/101754/0616/armlink-Reference/armlink-Command-line-Options/--be8?lang=en).
236237
`armv4t-none-eabi` | * | | ARMv4T A32
237238
`armv4t-unknown-linux-gnueabi` | ? | |
238239
[`armv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | ARMv5TE A32
239240
`armv5te-unknown-linux-uclibceabi` | ? | | ARMv5TE Linux with uClibc
240241
`armv6-unknown-freebsd` | ✓ | ✓ | ARMv6 FreeBSD
241-
`armv6-unknown-netbsd-eabihf` | ? | |
242+
[`armv6-unknown-netbsd-eabihf`](platform-support/netbsd.md) | | ✓ | ARMv6 NetBSD w/hard-float
242243
[`armv6k-nintendo-3ds`](platform-support/armv6k-nintendo-3ds.md) | ? | | ARMv6K Nintendo 3DS, Horizon (Requires devkitARM toolchain)
243244
`armv7-apple-ios` | ✓ | | ARMv7 iOS, Cortex-a8
244245
[`armv7-sony-vita-newlibeabihf`](platform-support/armv7-sony-vita-newlibeabihf.md) | ? | | ARM Cortex-A9 Sony PlayStation Vita (requires VITASDK toolchain)
245246
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | ARMv7 OpenHarmony |
246247
[`armv7-unknown-linux-uclibceabi`](platform-support/armv7-unknown-linux-uclibceabi.md) | ✓ | ✓ | ARMv7 Linux with uClibc, softfloat
247248
[`armv7-unknown-linux-uclibceabihf`](platform-support/armv7-unknown-linux-uclibceabihf.md) | ✓ | ? | ARMv7 Linux with uClibc, hardfloat
248249
`armv7-unknown-freebsd` | ✓ | ✓ | ARMv7 FreeBSD
249-
`armv7-unknown-netbsd-eabihf` | ✓ | ✓ |
250+
[`armv7-unknown-netbsd-eabihf`](platform-support/netbsd.md) | ✓ | ✓ | ARMv7 NetBSD w/hard-float
250251
`armv7-wrs-vxworks-eabihf` | ? | |
251252
[`armv7a-kmc-solid_asp3-eabi`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3
252253
[`armv7a-kmc-solid_asp3-eabihf`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3, hardfloat
@@ -262,7 +263,7 @@ target | std | host | notes
262263
`i686-apple-darwin` | ✓ | ✓ | 32-bit macOS (10.7+, Lion+)
263264
`i686-pc-windows-msvc` | * | | 32-bit Windows XP support
264265
`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku
265-
`i686-unknown-netbsd` | ✓ | ✓ | NetBSD/i386 with SSE2
266+
[`i686-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/i386 with SSE2
266267
[`i686-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 32-bit OpenBSD
267268
`i686-uwp-windows-gnu` | ? | |
268269
`i686-uwp-windows-msvc` | ? | |
@@ -283,7 +284,7 @@ target | std | host | notes
283284
`msp430-none-elf` | * | | 16-bit MSP430 microcontrollers
284285
`powerpc-unknown-linux-gnuspe` | ✓ | | PowerPC SPE Linux
285286
`powerpc-unknown-linux-musl` | ? | |
286-
`powerpc-unknown-netbsd` | ✓ | ✓ |
287+
[`powerpc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD 32-bit powerpc systems
287288
`powerpc-unknown-openbsd` | ? | |
288289
`powerpc-wrs-vxworks-spe` | ? | |
289290
`powerpc-wrs-vxworks` | ? | |
@@ -307,7 +308,7 @@ target | std | host | notes
307308
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
308309
`s390x-unknown-linux-musl` | | | S390x Linux (kernel 3.2, MUSL)
309310
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
310-
`sparc64-unknown-netbsd` | ✓ | ✓ | NetBSD/sparc64
311+
[`sparc64-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/sparc64
311312
[`sparc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/sparc64
312313
`thumbv4t-none-eabi` | * | | ARMv4T T32
313314
[`thumbv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | ARMv5TE T32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# \*-unknown-netbsd
2+
3+
**Tier: 3**
4+
5+
[NetBSD] multi-platform 4.4BSD-based UNIX-like operating system.
6+
7+
[NetBSD]: https://www.NetBSD.org/
8+
9+
The target names follow this format: `$ARCH-unknown-netbsd{-$SUFFIX}`,
10+
where `$ARCH` specifies the target processor architecture and
11+
`-$SUFFIX` (optional) might indicate the ABI. The following targets
12+
are currently defined running NetBSD:
13+
14+
| Target name | NetBSD Platform |
15+
|--------------------------------|-----------------|
16+
| `amd64-unknown-netbsd` | [amd64 / x86_64 systems](https://wiki.netbsd.org/ports/amd64/) |
17+
| `armv7-unknown-netbsd-eabihf` | [32-bit ARMv7 systems with hard-float](https://wiki.netbsd.org/ports/evbarm/) |
18+
| `armv6-unknown-netbsd-eabihf` | [32-bit ARMv6 systems with hard-float](https://wiki.netbsd.org/ports/evbarm/) |
19+
| `aarch64-unknown-netbsd` | [64-bit ARM systems, little-endian](https://wiki.netbsd.org/ports/evbarm/) |
20+
| `aarch64_be-unknown-netbsd` | [64-bit ARM systems, big-endian](https://wiki.netbsd.org/ports/evbarm/) |
21+
| `i586-unknown-netbsd` | [32-bit i386, restricted to Pentium](https://wiki.netbsd.org/ports/i386/) |
22+
| `i686-unknown-netbsd` | [32-bit i386 with SSE](https://wiki.netbsd.org/ports/i386/) |
23+
| `mipsel-unknown-netbsd` | [32-bit mips, requires mips32 cpu support](https://wiki.netbsd.org/ports/evbmips/) |
24+
| `powerpc-unknown-netbsd` | [Various 32-bit PowerPC systems, e.g. MacPPC](https://wiki.netbsd.org/ports/macppc/) |
25+
| `sparc64-unknown-netbsd` | [Sun UltraSPARC systems](https://wiki.netbsd.org/ports/sparc64/) |
26+
27+
All use the "native" `stdc++` library which goes along with the natively
28+
supplied GNU C++ compiler for the given OS version. Many of the bootstraps
29+
are built for NetBSD 9.x, although some exceptions exist (some
30+
are built for NetBSD 8.x but also work on newer OS versions).
31+
32+
33+
## Designated Developers
34+
35+
- [@he32](https://github.com/he32), `[email protected]`
36+
- [NetBSD/pkgsrc-wip's rust](https://github.com/NetBSD/pkgsrc-wip/blob/master/rust/Makefile) maintainer (see MAINTAINER variable). This package is part of "pkgsrc work-in-progress" and is used for deployment and testing of new versions of rust
37+
- [NetBSD's pkgsrc lang/rust](https://github.com/NetBSD/pkgsrc/tree/trunk/lang/rust) for the "proper" package in pkgsrc.
38+
- [NetBSD's pkgsrc lang/rust-bin](https://github.com/NetBSD/pkgsrc/tree/trunk/lang/rust-bin) which re-uses the bootstrap kit as a binary distribution and therefore avoids the rather protracted native build time of rust itself
39+
40+
Fallback to [email protected], or fault reporting via NetBSD's
41+
bug reporting system.
42+
43+
## Requirements
44+
45+
The `amd64-unknown-netbsd` artifacts is being distributed by the
46+
rust project.
47+
48+
The other targets are built by the designated developers (see above),
49+
and the targets are initially cross-compiled, but many if not most
50+
of them are also built natively as part of testing.
51+
52+
53+
## Building
54+
55+
The default build mode for the packages is a native build.
56+
57+
58+
## Cross-compilation
59+
60+
These targets can be cross-compiled, and we do that via the pkgsrc
61+
package(s).
62+
63+
Cross-compilation typically requires the "tools" and "dest" trees
64+
resulting from a normal cross-build of NetBSD itself, ref. our main
65+
build script, `build.sh`.
66+
67+
See e.g. [do-cross.mk
68+
Makefile](https://github.com/NetBSD/pkgsrc/tree/trunk/lang/rust/do-cross.mk)
69+
for the Makefile used to cross-build all the above NetBSD targets
70+
(except for the `amd64` target).
71+
72+
The major option for the rust build is whether to build rust with
73+
the LLVM rust carries in its distribution, or use the LLVM package
74+
installed from pkgsrc. The `PKG_OPTIONS.rust` option is
75+
`rust-internal-llvm`, ref. [the rust package's options.mk make
76+
fragment](https://github.com/NetBSD/pkgsrc/blob/trunk/lang/rust/options.mk).
77+
It defaults to being set for a few of the above platforms, for
78+
various reasons (see comments), but is otherwise unset and therefore
79+
indicates use of the pkgsrc LLVM.
80+
81+
82+
## Testing
83+
84+
The Rust testsuite could presumably be run natively.
85+
86+
For the systems where the maintainer can build natively, the rust
87+
compiler itself is re-built natively. This involves the rust compiler
88+
being re-built with the newly self-built rust compiler, so excercises
89+
the result quite extensively.
90+
91+
Additionally, for some systems we build `librsvg`, and for the more
92+
capable systems we build and test `firefox` (amd64, i386, aarch64).
93+
94+
95+
## Building Rust programs
96+
97+
Rust ships pre-compiled artifacts for the `amd64-unknown-netbsd`
98+
target.
99+
100+
For the other systems mentioned above, using the `pkgsrc` route is
101+
probably the easiest, possibly via the `rust-bin` package to save
102+
time, see the `RUST_TYPE` variable from the `rust.mk` Makefile
103+
fragment.
104+
105+
The pkgsrc rust package has a few files to assist with building
106+
pkgsrc packages written in rust, ref. the `rust.mk` and `cargo.mk`
107+
Makefile fragments in the `lang/rust` package.

0 commit comments

Comments
 (0)