Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 560136f

Browse files
Rollup merge of #113356 - he32:netbsd-riscv64, r=oli-obk
Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd.
2 parents 6f9addf + 6cc37bb commit 560136f

File tree

6 files changed

+32
-2
lines changed

6 files changed

+32
-2
lines changed

‎compiler/rustc_target/src/spec/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ supported_targets! {
13251325
("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
13261326
("i686-unknown-netbsd", i686_unknown_netbsd),
13271327
("powerpc-unknown-netbsd", powerpc_unknown_netbsd),
1328+
("riscv64gc-unknown-netbsd", riscv64gc_unknown_netbsd),
13281329
("sparc64-unknown-netbsd", sparc64_unknown_netbsd),
13291330
("x86_64-unknown-netbsd", x86_64_unknown_netbsd),
13301331

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use crate::spec::{CodeModel, Target, TargetOptions};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "riscv64-unknown-netbsd".into(),
6+
pointer_width: 64,
7+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
8+
arch: "riscv64".into(),
9+
options: TargetOptions {
10+
code_model: Some(CodeModel::Medium),
11+
cpu: "generic-rv64".into(),
12+
features: "+m,+a,+f,+d,+c".into(),
13+
llvm_abiname: "lp64d".into(),
14+
max_atomic_width: Some(64),
15+
mcount: "__mcount".into(),
16+
..super::netbsd_base::opts()
17+
},
18+
}
19+
}

‎library/core/src/ffi/mod.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ mod c_char_definition {
132132
),
133133
all(
134134
target_os = "netbsd",
135-
any(target_arch = "aarch64", target_arch = "arm", target_arch = "powerpc")
135+
any(
136+
target_arch = "aarch64",
137+
target_arch = "arm",
138+
target_arch = "powerpc",
139+
target_arch = "riscv64"
140+
)
136141
),
137142
all(
138143
target_os = "vxworks",

‎src/bootstrap/llvm.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ impl Step for Llvm {
380380
cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
381381
}
382382

383-
if target.starts_with("riscv") && !target.contains("freebsd") && !target.contains("openbsd")
383+
if target.starts_with("riscv")
384+
&& !target.contains("freebsd")
385+
&& !target.contains("openbsd")
386+
&& !target.contains("netbsd")
384387
{
385388
// RISC-V GCC erroneously requires linking against
386389
// `libatomic` when using 1-byte and 2-byte C++

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ target | std | host | notes
305305
`riscv64gc-unknown-freebsd` | | | RISC-V FreeBSD
306306
`riscv64gc-unknown-fuchsia` | | | RISC-V Fuchsia
307307
`riscv64gc-unknown-linux-musl` | | | RISC-V Linux (kernel 4.20, musl 1.2.0)
308+
[`riscv64gc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ? | RISC-V NetBSD
308309
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
309310
`s390x-unknown-linux-musl` | | | S390x Linux (kernel 3.2, MUSL)
310311
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ are currently defined running NetBSD:
2222
| `i686-unknown-netbsd` | [32-bit i386 with SSE](https://wiki.netbsd.org/ports/i386/) |
2323
| `mipsel-unknown-netbsd` | [32-bit mips, requires mips32 cpu support](https://wiki.netbsd.org/ports/evbmips/) |
2424
| `powerpc-unknown-netbsd` | [Various 32-bit PowerPC systems, e.g. MacPPC](https://wiki.netbsd.org/ports/macppc/) |
25+
| `riscv64gc-unknown-netbsd` | [64-bit RISC-V](https://wiki.netbsd.org/ports/riscv/)
2526
| `sparc64-unknown-netbsd` | [Sun UltraSPARC systems](https://wiki.netbsd.org/ports/sparc64/) |
2627

2728
All use the "native" `stdc++` library which goes along with the natively

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /