Skip to content

Commit 4e28292

Browse files
committed
Add GNU/Hurd target
The actual support will follow once the stage0 compiler has caught up with this definition.
1 parent 01ce2d0 commit 4e28292

File tree

7 files changed

+47
-3
lines changed

7 files changed

+47
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use crate::spec::{cvs, RelroLevel, TargetOptions};
2+
3+
pub fn opts() -> TargetOptions {
4+
TargetOptions {
5+
os: "hurd".into(),
6+
dynamic_linking: true,
7+
families: cvs!["unix"],
8+
has_rpath: true,
9+
position_independent_executables: true,
10+
relro_level: RelroLevel::Full,
11+
has_thread_local: true,
12+
crt_static_respected: true,
13+
..Default::default()
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use crate::spec::TargetOptions;
2+
3+
pub fn opts() -> TargetOptions {
4+
TargetOptions { env: "gnu".into(), ..super::hurd_base::opts() }
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target};
2+
3+
pub fn target() -> Target {
4+
let mut base = super::hurd_gnu_base::opts();
5+
base.cpu = "pentiumpro".into();
6+
base.max_atomic_width = Some(64);
7+
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
8+
base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };
9+
10+
Target {
11+
llvm_target: "i686-unknown-hurd-gnu".into(),
12+
pointer_width: 32,
13+
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
14+
f64:32:64-f80:32-n8:16:32-S128"
15+
.into(),
16+
arch: "x86".into(),
17+
options: base,
18+
}
19+
}

compiler/rustc_target/src/spec/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ mod freebsd_base;
7171
mod fuchsia_base;
7272
mod haiku_base;
7373
mod hermit_base;
74+
mod hurd_base;
75+
mod hurd_gnu_base;
7476
mod illumos_base;
7577
mod l4re_base;
7678
mod linux_base;
@@ -1367,6 +1369,8 @@ supported_targets! {
13671369
("i686-unknown-haiku", i686_unknown_haiku),
13681370
("x86_64-unknown-haiku", x86_64_unknown_haiku),
13691371

1372+
("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
1373+
13701374
("aarch64-apple-darwin", aarch64_apple_darwin),
13711375
("x86_64-apple-darwin", x86_64_apple_darwin),
13721376
("x86_64h-apple-darwin", x86_64h_apple_darwin),

src/bootstrap/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
133133
// #[cfg(bootstrap)]
134134
(Some(Mode::Std), "target_vendor", Some(&["unikraft"])),
135135
(Some(Mode::Std), "target_env", Some(&["libnx"])),
136-
(Some(Mode::Std), "target_os", Some(&["teeos"])),
136+
// #[cfg(bootstrap)] hurd
137+
(Some(Mode::Std), "target_os", Some(&["teeos", "hurd"])),
137138
// #[cfg(bootstrap)] mips32r6, mips64r6
138139
(
139140
Some(Mode::Std),

tests/ui/check-cfg/values-target-json.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
66
| |
77
| help: there is a expected value with a similar name: `"linux"`
88
|
9-
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
9+
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: 1 warning emitted

tests/ui/check-cfg/well-known-values.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
66
| |
77
| help: there is a expected value with a similar name: `"linux"`
88
|
9-
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
9+
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value

0 commit comments

Comments
 (0)