Skip to content

Commit b808c9b

Browse files
committed
add tier 3 HelenOS compiler targets
Targets theoretically possible, but not provided yet: - 32-bit arm See also notes in the PR, I was unable to run anything non-trivial on ARM HelenOS, there are issues with the linker/loader, incomplete support of atomics, and overall a lot of confusion about the precise version of ARM architecture that the HelenOS builds target. - riscv, mips (These targets currently don't run HelenOS at all. HelenOS says it should work, but the builds are broken for quite some time now.)
1 parent 425e142 commit b808c9b

File tree

14 files changed

+243
-2
lines changed

14 files changed

+243
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use crate::spec::{PanicStrategy, RelroLevel, StackProbeType, TargetOptions};
2+
3+
pub(crate) fn opts() -> TargetOptions {
4+
TargetOptions {
5+
os: "helenos".into(),
6+
7+
dynamic_linking: true,
8+
// we need the linker to keep libgcc and friends
9+
no_default_libraries: false,
10+
has_rpath: true,
11+
relro_level: RelroLevel::Full,
12+
panic_strategy: PanicStrategy::Abort,
13+
stack_probes: StackProbeType::Inline,
14+
15+
..Default::default()
16+
}
17+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub(crate) mod dragonfly;
88
pub(crate) mod freebsd;
99
pub(crate) mod fuchsia;
1010
pub(crate) mod haiku;
11+
pub(crate) mod helenos;
1112
pub(crate) mod hermit;
1213
pub(crate) mod hurd;
1314
pub(crate) mod hurd_gnu;

compiler/rustc_target/src/spec/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,12 @@ supported_targets! {
18411841
("i686-unknown-haiku", i686_unknown_haiku),
18421842
("x86_64-unknown-haiku", x86_64_unknown_haiku),
18431843

1844+
("aarch64-unknown-helenos", aarch64_unknown_helenos),
1845+
("i686-unknown-helenos", i686_unknown_helenos),
1846+
("powerpc-unknown-helenos", powerpc_unknown_helenos),
1847+
("sparc64-unknown-helenos", sparc64_unknown_helenos),
1848+
("x86_64-unknown-helenos", x86_64_unknown_helenos),
1849+
18441850
("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
18451851
("x86_64-unknown-hurd-gnu", x86_64_unknown_hurd_gnu),
18461852

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use crate::spec::{Target, base};
2+
3+
pub(crate) fn target() -> Target {
4+
let mut base = base::helenos::opts();
5+
base.max_atomic_width = Some(128);
6+
base.features = "+v8a".into();
7+
base.linker = Some("aarch64-helenos-gcc".into());
8+
9+
Target {
10+
llvm_target: "aarch64-unknown-helenos".into(),
11+
metadata: crate::spec::TargetMetadata {
12+
description: Some("ARM64 HelenOS".into()),
13+
tier: Some(3),
14+
host_tools: Some(false),
15+
std: Some(true),
16+
},
17+
pointer_width: 64,
18+
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
19+
arch: "aarch64".into(),
20+
options: base,
21+
}
22+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use crate::spec::{Cc, LinkerFlavor, Lld, RustcAbi, Target, base};
2+
3+
pub(crate) fn target() -> Target {
4+
let mut base = base::helenos::opts();
5+
base.cpu = "pentium4".into();
6+
base.max_atomic_width = Some(64);
7+
base.linker = Some("i686-helenos-gcc".into());
8+
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
9+
base.rustc_abi = Some(RustcAbi::X86Sse2);
10+
11+
Target {
12+
llvm_target: "i686-unknown-helenos".into(),
13+
metadata: crate::spec::TargetMetadata {
14+
description: Some("IA-32 (i686) HelenOS".into()),
15+
tier: Some(3),
16+
host_tools: Some(false),
17+
std: Some(true),
18+
},
19+
pointer_width: 32,
20+
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
21+
i128:128-f64:32:64-f80:32-n8:16:32-S128"
22+
.into(),
23+
arch: "x86".into(),
24+
options: base,
25+
}
26+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use rustc_abi::Endian;
2+
3+
use crate::spec::{Target, TargetMetadata, base};
4+
5+
pub(crate) fn target() -> Target {
6+
let mut base = base::helenos::opts();
7+
base.endian = Endian::Big;
8+
base.max_atomic_width = Some(32);
9+
base.linker = Some("ppc-helenos-gcc".into());
10+
11+
Target {
12+
llvm_target: "powerpc-unknown-helenos".into(),
13+
metadata: TargetMetadata {
14+
description: Some("PowerPC HelenOS".into()),
15+
tier: Some(3),
16+
host_tools: Some(false),
17+
std: Some(true),
18+
},
19+
pointer_width: 32,
20+
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
21+
arch: "powerpc".into(),
22+
options: base,
23+
}
24+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use rustc_abi::Endian;
2+
3+
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, base};
4+
5+
pub(crate) fn target() -> Target {
6+
let mut base = base::helenos::opts();
7+
base.endian = Endian::Big;
8+
base.cpu = "v9".into();
9+
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
10+
base.max_atomic_width = Some(64);
11+
base.linker = Some("sparc64-helenos-gcc".into());
12+
13+
Target {
14+
llvm_target: "sparc64-unknown-helenos".into(),
15+
metadata: TargetMetadata {
16+
description: Some("SPARC HelenOS".into()),
17+
tier: Some(3),
18+
host_tools: Some(false),
19+
std: Some(true),
20+
},
21+
pointer_width: 64,
22+
data_layout: "E-m:e-i64:64-i128:128-n32:64-S128".into(),
23+
arch: "sparc64".into(),
24+
options: base,
25+
}
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
2+
3+
pub(crate) fn target() -> Target {
4+
let mut base = base::helenos::opts();
5+
base.cpu = "x86-64".into();
6+
base.plt_by_default = false;
7+
base.max_atomic_width = Some(64);
8+
base.linker = Some("amd64-helenos-gcc".into());
9+
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
10+
11+
Target {
12+
llvm_target: "x86_64-unknown-helenos".into(),
13+
metadata: crate::spec::TargetMetadata {
14+
description: Some("64-bit HelenOS".into()),
15+
tier: Some(3),
16+
host_tools: Some(false),
17+
std: Some(true),
18+
},
19+
pointer_width: 64,
20+
data_layout:
21+
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
22+
arch: "x86_64".into(),
23+
options: base,
24+
}
25+
}

src/bootstrap/src/core/sanity.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ pub struct Finder {
3333
//
3434
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
3535
const STAGE0_MISSING_TARGETS: &[&str] = &[
36+
"aarch64-unknown-helenos",
37+
"i686-unknown-helenos",
38+
"x86_64-unknown-helenos",
39+
"powerpc-unknown-helenos",
40+
"sparc64-unknown-helenos",
3641
// just a dummy comment so the list doesn't get onelined
3742
];
3843

src/doc/rustc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
- [solaris](platform-support/solaris.md)
108108
- [\*-nto-qnx-\*](platform-support/nto-qnx.md)
109109
- [\*-unikraft-linux-musl](platform-support/unikraft-linux-musl.md)
110+
- [\*-unknown-helenos](platform-support/helenos.md)
110111
- [\*-unknown-hermit](platform-support/hermit.md)
111112
- [\*-unknown-freebsd](platform-support/freebsd.md)
112113
- [\*-unknown-netbsd\*](platform-support/netbsd.md)

0 commit comments

Comments
 (0)