-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Add managarm as a tier 3 target #123319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add managarm as a tier 3 target #123319
Changes from 2 commits
dedc082
eba9cc1
2a74533
6883e01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::spec::{cvs, RelroLevel, TargetOptions}; | ||
|
||
pub fn opts() -> TargetOptions { | ||
TargetOptions { | ||
os: "managarm".to_string().into(), | ||
env: "mlibc".to_string().into(), | ||
dynamic_linking: true, | ||
executables: true, | ||
families: cvs!["unix"], | ||
has_rpath: true, | ||
position_independent_executables: true, | ||
relro_level: RelroLevel::Full, | ||
has_thread_local: true, | ||
crt_static_respected: true, | ||
..Default::default() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata}; | ||
|
||
pub fn target() -> Target { | ||
let mut base = base::managarm_mlibc::opts(); | ||
base.cpu = "x86-64".to_string().into(); | ||
base.max_atomic_width = Some(64); | ||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); | ||
// don't use probe-stack=inline-asm until rust-lang/rust#83139 is resolved. | ||
base.stack_probes = StackProbeType::Call; | ||
|
||
Target { | ||
llvm_target: "x86_64-unknown-managarm-mlibc".to_string().into(), | ||
pointer_width: 64, | ||
data_layout: | ||
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" | ||
.to_string() | ||
.into(), | ||
arch: "x86_64".to_string().into(), | ||
options: base, | ||
metadata: TargetMetadata { std: Some(false), tier: Some(3), ..Default::default() }, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# `*-unknown-managarm-mlibc` | ||
|
||
**Tier: 3** | ||
|
||
## Target Maintainers | ||
|
||
- [@no92](https://github.com/no92) | ||
- [@64](https://github.com/64) | ||
- [@Dennisbonke](https://github.com/Dennisbonke) | ||
|
||
## Requirements | ||
|
||
This target is cross-compiled. There is currently no support for `std` yet. It generates binaries in the ELF format. | ||
|
||
## Building the target | ||
|
||
For now, building a patched LLVM with [our patches located here](https://github.com/managarm/bootstrap-managarm/tree/master/patches/llvm) is necessary. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wesleywiser do we have any other targets which need a patched LLVM? I think we might want this to wait for support to exist in LLVM? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think any other targets currently need a patched LLVM to build (of course, newer LLVMs might work better). If I remember correctly, the loongarch targets waited until we had updated to a version of LLVM with sufficient support to link @no92 is there urgency to land this PR now or can we wait until an LLVM release picks up support for managarm? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no urgency, so we're happy to merge our changes into LLVM first if that makes more sense. But it would be nice if we could get this merged fairly soon after our changes hit LLVM master, because it blocks us upstreaming our changes to other Rust crates, and that's the bulk of the maintenance effort on our end: supporting locally patched crates (and sometimes multiple versions thereof!) has proved quite tricky to manage Anyway, we'll check back once our LLVM changes are merged and see how people feel :) |
||
|
||
Once that is done, set up your `config.toml` like this: | ||
|
||
```toml | ||
change-id = 102579 | ||
|
||
[llvm] | ||
targets = "X86" | ||
download-ci-llvm = false | ||
|
||
[build] | ||
target = ["x86_64-unknown-managarm-mlibc", "x86_64-unknown-linux-gnu"] | ||
build-dir = "/path/to/the/build/dir" | ||
docs = false | ||
|
||
[install] | ||
prefix = "/path/to/the/prefix" | ||
sysconfdir = "etc" | ||
no92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[rust] | ||
codegen-tests = false | ||
no92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
deny-warnings = false | ||
no92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[target.x86_64-unknown-linux-gnu] | ||
llvm-config = "/path/to/your/llvm/bin/llvm-config" | ||
|
||
[target.x86_64-unknown-managarm-mlibc] | ||
llvm-config = "/path/to/your/llvm/bin/llvm-config" | ||
``` | ||
|
||
## Building Rust programs | ||
|
||
Build a `x86_64-managarm-gcc` using our [gcc fork](https://github.com/managarm/gcc). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does lld not work for this target? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
|
||
```toml | ||
[build] | ||
rustc = "/path/to/the/rust-prefix/bin/rustc" | ||
target = "x86_64-unknown-managarm-mlibc" | ||
|
||
[target.x86_64-unknown-managarm-mlibc] | ||
linker = "/path/to/the/managarm-gcc/bin/x86_64-managarm-gcc" | ||
``` | ||
|
||
## Testing | ||
|
||
This target does not support running the Rust testsuite yet. |
Uh oh!
There was an error while loading. Please reload this page.