Skip to content

Commit 1ab0e6c

Browse files
committed
added support for GNU/Hurd on x86_64
1 parent 56c698c commit 1ab0e6c

File tree

5 files changed

+35
-3
lines changed

5 files changed

+35
-3
lines changed

compiler/rustc_target/src/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,7 @@ supported_targets! {
16441644
("x86_64-unknown-haiku", x86_64_unknown_haiku),
16451645

16461646
("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
1647+
("x86_64-unknown-hurd-gnu", x86_64_unknown_hurd_gnu),
16471648

16481649
("aarch64-apple-darwin", aarch64_apple_darwin),
16491650
("arm64e-apple-darwin", arm64e_apple_darwin),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
2+
3+
pub fn target() -> Target {
4+
let mut base = base::hurd_gnu::opts();
5+
base.cpu = "x86-64".into();
6+
base.plt_by_default = false;
7+
base.max_atomic_width = Some(64);
8+
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
9+
base.stack_probes = StackProbeType::Inline;
10+
base.supports_xray = true;
11+
12+
Target {
13+
llvm_target: "x86_64-unknown-hurd-gnu".into(),
14+
metadata: crate::spec::TargetMetadata {
15+
description: Some("64-bit GNU/Hurd".into()),
16+
tier: Some(3),
17+
host_tools: Some(true),
18+
std: Some(true),
19+
},
20+
pointer_width: 64,
21+
data_layout:
22+
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
23+
arch: "x86_64".into(),
24+
options: base,
25+
}
26+
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ target | std | host | notes
377377
[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.3
378378
`x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD
379379
`x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku
380+
[`x86_64-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 64-bit GNU/Hurd
380381
[`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit
381382
`x86_64-unknown-l4re-uclibc` | ? | |
382383
[`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# `i686-unknown-hurd-gnu`
1+
# `i686-unknown-hurd-gnu` and `x86_64-unknown-hurd-gnu`
22

33
**Tier: 3**
44

@@ -16,7 +16,8 @@ The GNU/Hurd target supports `std` and uses the standard ELF file format.
1616

1717
## Building the target
1818

19-
This target can be built by adding `i686-unknown-hurd-gnu` as target in the rustc list.
19+
This target can be built by adding `i686-unknown-hurd-gnu` and
20+
`x86_64-unknown-hurd-gnu` as targets in the rustc list.
2021

2122
## Building Rust programs
2223

@@ -32,4 +33,4 @@ Tests can be run in the same way as a regular binary.
3233
## Cross-compilation toolchains and C code
3334

3435
The target supports C code, the GNU toolchain calls the target
35-
`i686-unknown-gnu`.
36+
`i686-unknown-gnu` and `x86_64-unknown-gnu`.

tests/assembly/targets/targets-elf.rs

+3
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@
537537
//@ revisions: x86_64_unknown_haiku
538538
//@ [x86_64_unknown_haiku] compile-flags: --target x86_64-unknown-haiku
539539
//@ [x86_64_unknown_haiku] needs-llvm-components: x86
540+
//@ revisions: x86_64_unknown_hurd_gnu
541+
//@ [x86_64_unknown_hurd_gnu] compile-flags: --target x86_64-unknown-hurd-gnu
542+
//@ [x86_64_unknown_hurd_gnu] needs-llvm-components: x86
540543
//@ revisions: x86_64_unknown_hermit
541544
//@ [x86_64_unknown_hermit] compile-flags: --target x86_64-unknown-hermit
542545
//@ [x86_64_unknown_hermit] needs-llvm-components: x86

0 commit comments

Comments
 (0)