Skip to content

Commit cf52c0f

Browse files
committed
add tier 3 HelenOS compiler targets
1 parent b8005bf commit cf52c0f

File tree

15 files changed

+288
-2
lines changed

15 files changed

+288
-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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,13 @@ supported_targets! {
18381838
("i686-unknown-haiku", i686_unknown_haiku),
18391839
("x86_64-unknown-haiku", x86_64_unknown_haiku),
18401840

1841+
("aarch64-unknown-helenos", aarch64_unknown_helenos),
1842+
("armv5te-unknown-helenos-eabi", armv5te_unknown_helenos_eabi),
1843+
("i686-unknown-helenos", i686_unknown_helenos),
1844+
("powerpc-unknown-helenos", powerpc_unknown_helenos),
1845+
("sparc64-unknown-helenos", sparc64_unknown_helenos),
1846+
("x86_64-unknown-helenos", x86_64_unknown_helenos),
1847+
18411848
("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
18421849
("x86_64-unknown-hurd-gnu", x86_64_unknown_hurd_gnu),
18431850

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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, Target, base};
2+
3+
pub(crate) fn target() -> Target {
4+
let mut base = base::helenos::opts();
5+
base.abi = "eabi".into();
6+
base.llvm_floatabi = Some(FloatAbi::Soft);
7+
base.max_atomic_width = Some(32);
8+
base.features = "+soft-float,+strict-align,+atomics-32".into();
9+
base.has_thumb_interworking = true;
10+
base.linker = Some("arm-helenos-gcc".into());
11+
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv5te"]);
12+
13+
// FIXME: these 3 flags are a hack to avoid generating R_*_RELATIVE relocations in code segment,
14+
// which cause the HelenOS loader to segfault. I believe the underlying issue is that HelenOS
15+
// doesn't map the code segment as writable, so the loader can't apply the relocations.
16+
// The same issue was with the i686-helenos target, I don't recall why the current combination
17+
// of flags avoids the issue there.
18+
base.crt_static_default = true;
19+
base.crt_static_respected = false;
20+
base.crt_static_allows_dylibs = true;
21+
22+
Target {
23+
llvm_target: "armv5te-unknown-helenos-eabi".into(),
24+
metadata: crate::spec::TargetMetadata {
25+
description: Some("ARMv5te HelenOS".into()),
26+
tier: Some(3),
27+
host_tools: Some(false),
28+
std: Some(true),
29+
},
30+
pointer_width: 32,
31+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
32+
arch: "arm".into(),
33+
options: base,
34+
}
35+
}
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ 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+
"armv5te-unknown-helenos-eabi",
38+
"i686-unknown-helenos",
39+
"x86_64-unknown-helenos",
40+
"powerpc-unknown-helenos",
41+
"sparc64-unknown-helenos",
3642
// just a dummy comment so the list doesn't get onelined
3743
"x86_64-lynx-lynxos178",
3844
];

0 commit comments

Comments
 (0)