Skip to content
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

Add illumos aarch64 target for rust. #112936

Merged
merged 3 commits into from Dec 23, 2023

Conversation

Toasterson
Copy link
Contributor

This adds the newly being developed illumos aarch64 target to the rust compiler.

@rmustacc @citrus-it @richlowe As promissed before my hiatus :)

@rustbot
Copy link
Collaborator

rustbot commented Jun 22, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @fee1-dead (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 22, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jun 22, 2023

These commits modify compiler targets.
(See the Target Tier Policy.)

@compiler-errors
Copy link
Member

I think this needs an MCP since it's adding a new tier 3 target, right? (coincidentally just asked the same thing for another target proposal this morning -- #112930 (comment))

@Toasterson
Copy link
Contributor Author

I don't see a reason not to make one. I'll gladly talk about the project and what one can expect where this target goes :) I'll have to sync with people a bit to have the plans in details but could do it in a couple days time.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

Alright, marking this as waiting on author until this gets an MCP

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 23, 2023
@Toasterson
Copy link
Contributor Author

Added a new MCP for this and the probable other PR's for the illumos Tier3 Targets. rust-lang/compiler-team#644

@workingjubilee
Copy link
Contributor

An MCP is technically not required. Rather, what is actually important is the requirements of the target tier policy are addressed by the author and the compiler team reviews it. An MCP is simply a vessel for that review.

@fee1-dead
Copy link
Member

cc #115089

r? compiler

@rustbot rustbot assigned jackh726 and unassigned fee1-dead Aug 22, 2023
@apiraino
Copy link
Contributor

Waiting for MCP compiler-team#644 to complete.

@rustbot label +s-waiting-on-mcp -s-waiting-on-author

@rustbot rustbot added the S-waiting-on-MCP Status: PR has a compiler MCP and is waiting for the compiler MCP to complete. label Aug 23, 2023
@apiraino apiraino removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 23, 2023
@workingjubilee
Copy link
Contributor

Accepted, so all this needs is a rebase.

@workingjubilee workingjubilee added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-MCP Status: PR has a compiler MCP and is waiting for the compiler MCP to complete. labels Oct 10, 2023
@Toasterson
Copy link
Contributor Author

Done, I hope I did everything right here.

@rust-log-analyzer

This comment has been minimized.

@workingjubilee workingjubilee added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 28, 2023
@Nilstrieb
Copy link
Member

you have a merge commit: b16a66f
we don't accept merge commits here, you should to rebase it away

@Toasterson
Copy link
Contributor Author

you have a merge commit: b16a66f we don't accept merge commits here, you should to rebase it away

Done. Let me know if anything else is missing.

@wesleywiser
Copy link
Member

Hi @Toasterson, sorry for the delay on this! I think this is pretty much ready to be merged but we need an explicit signoff from you that this target adheres to the tier 3 target policy. Could you please quote the corresponding requirements verbatim from the tier 3 target tier policy to explain how the target meets those requirements (leaving a new comment here is fine). You can find an example of this in the PR description for #86191. Thank you!

@jackh726 jackh726 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2023
Signed-off-by: Till Wegmueller <toasterson@gmail.com>
Signed-off-by: Till Wegmueller <toasterson@gmail.com>
…freebsd

Signed-off-by: Till Wegmueller <toasterson@gmail.com>
@Toasterson
Copy link
Contributor Author

Sorry for the delay, I lost my notes and needed to rebuild the Guide from scratch.
Along the way I also rebased the changes and updates some bugs that happened with the rebased that I don't remember if they existed before or not. In any case, I can get binaries cross compiled, but not the compiler as the psm crate aborts while calling GCC.

So let's get down to the Target tier policy

A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

That would be me and the other illumos developers. You can add me to CC on the other illumos target aswell, I am a primary rust user and will use illumos in the future.

Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.
- Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.
- If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo.

Done

Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.
- The target must not introduce license incompatibilities.
- Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).
- The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.
- Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.
- "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

No problem for any illumos target.

Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.
- This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

No problem here.

Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

All the existing illumos x86_64 support works here aswell. We just add a Processor architecture.

The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

Cross compilation Guide: https://gist.github.com/Toasterson/90d19ecf4e0b69cfbcd9566a7c098eb8

Any native toolchains will be available via packages. So that people can test rust releases if they want. Request other guides as needed. I'll happily provide starter images aswell if people want some base VM's for ARM. For x86 vagrant images are available via

vagrant init openindiana/hipster
vagrant up

Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via @) to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.
- Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

Ok, will do

Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.
- In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

Will do.

Ok, Last part. I currently run into the following problem when cross compiling rustc.

error: failed to run custom build command for `psm v0.1.21`

Caused by:
  process didn't exit successfully: `/var/lib/abuild/rust/build/x86_64-unknown-illumos/stage1-rustc/release/build/psm-61c9c6ef89c427d5/build-script-build` (exit status: 1)
  --- stdout
  OPT_LEVEL = Some("3")
  TARGET = Some("aarch64-unknown-illumos")
  HOST = Some("x86_64-unknown-illumos")
  cargo:rerun-if-env-changed=CC_aarch64-unknown-illumos
  CC_aarch64-unknown-illumos = None
  cargo:rerun-if-env-changed=CC_aarch64_unknown_illumos
  CC_aarch64_unknown_illumos = Some("gcc")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-illumos
  CFLAGS_aarch64-unknown-illumos = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_illumos
  CFLAGS_aarch64_unknown_illumos = Some("-ffunction-sections -fdata-sections -fPIC")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  cargo:rustc-cfg=asm
  cargo:rustc-cfg=switchable_stack
  running: "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "-xassembler-with-cpp" "-DCFG_TARGET_OS_illumos" "-DCFG_TARGET_ARCH_aarch64" "-DCFG_TARGET_ENV_" "-o" "/var/lib/abuild/rust/build/x86_64-unknown-illumos/stage1-rustc/aarch64-unknown-illumos/release/build/psm-a54651dd69990eb0/out/src/arch/aarch_aapcs64.o" "-c" "src/arch/aarch_aapcs64.s"
  cargo:warning=src/arch/aarch_aapcs64.s: Assembler messages:
  cargo:warning=src/arch/aarch_aapcs64.s:35: Error: no such instruction: `orr w0,wzr,'
  cargo:warning=src/arch/aarch_aapcs64.s:48: Error: operand size mismatch for `mov'
  cargo:warning=src/arch/aarch_aapcs64.s:62: Error: operand size mismatch for `mov'
  cargo:warning=src/arch/aarch_aapcs64.s:63: Error: no such instruction: `br x1'
  cargo:warning=src/arch/aarch_aapcs64.s:75: Error: no such instruction: `stp x29,x30,[sp,'
  cargo:warning=src/arch/aarch_aapcs64.s:76: Error: bad register expression
  cargo:warning=src/arch/aarch_aapcs64.s:77: Error: operand size mismatch for `mov'
  cargo:warning=src/arch/aarch_aapcs64.s:78: Error: bad register expression
  cargo:warning=src/arch/aarch_aapcs64.s:79: Error: bad register expression
  cargo:warning=src/arch/aarch_aapcs64.s:80: Error: bad register expression
  cargo:warning=src/arch/aarch_aapcs64.s:81: Error: operand size mismatch for `mov'
  cargo:warning=src/arch/aarch_aapcs64.s:82: Error: no such instruction: `blr x2'
  cargo:warning=src/arch/aarch_aapcs64.s:83: Error: operand size mismatch for `mov'
  cargo:warning=src/arch/aarch_aapcs64.s:84: Error: bad register expression
  cargo:warning=src/arch/aarch_aapcs64.s:85: Error: no such instruction: `ldp x29,x30,[sp],'
  cargo:warning=src/arch/aarch_aapcs64.s:86: Error: bad register expression
  cargo:warning=src/arch/aarch_aapcs64.s:87: Error: bad register expression
  cargo:warning=src/arch/aarch_aapcs64.s:88: Error: bad register expression
  exit status: 1

  --- stderr


  error occurred: Command "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "-xassembler-with-cpp" "-DCFG_TARGET_OS_illumos" "-DCFG_TARGET_ARCH_aarch64" "-DCFG_TARGET_ENV_" "-o" "/var/lib/abuild/rust/build/x86_64-unknown-illumos/stage1-rustc/aarch64-unknown-illumos/release/build/psm-a54651dd69990eb0/out/src/arch/aarch_aapcs64.o" "-c" "src/arch/aarch_aapcs64.s" with args "gcc" did not execute successfully (status code exit status: 1).

But I can produce a hello-world binary.
Any Project will need the following .cargo/config to cross compile from illumos x86.

[target.aarch64-unknown-illumos]
linker = "/var/lib/abuild/arm64-gate/build/cross/bin/aarch64-unknown-solaris2.11-gcc"
rustflags = [ "-Clink-arg=--sysroot=/var/lib/abuild/arm64-gate/build/sysroot" ]

@jackh726
Copy link
Contributor

Thanks! That's all we need for @bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 23, 2023

📌 Commit 074809b has been approved by jackh726

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 23, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#112936 (Add illumos aarch64 target for rust.)
 - rust-lang#119153 (stabilize `file_create_new`)
 - rust-lang#119246 ([rustdoc] Add `is_object_safe` information for traits in JSON output)
 - rust-lang#119254 (Remove an unused diagnostic struct)
 - rust-lang#119255 (add a test for ICE rust-lang#112822)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5459247 into rust-lang:master Dec 23, 2023
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Dec 23, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2023
Rollup merge of rust-lang#112936 - Toasterson:illumos-aarch64-target, r=jackh726

Add illumos aarch64 target for rust.

This adds the newly being developed illumos aarch64 target to the rust compiler.

`@rmustacc` `@citrus-it` `@richlowe` As promissed before my hiatus :)
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Mar 29, 2024
Pkgsrc changes:
 * Adapt checksums and patches.

Upstream chnages:

Version 1.77.0 (2024-03-21)
==========================

- [Reveal opaque types within the defining body for exhaustiveness checking.]
  (rust-lang/rust#116821)
- [Stabilize C-string literals.]
  (rust-lang/rust#117472)
- [Stabilize THIR unsafeck.]
  (rust-lang/rust#117673)
- [Add lint `static_mut_refs` to warn on references to mutable statics.]
  (rust-lang/rust#117556)
- [Support async recursive calls (as long as they have indirection).]
  (rust-lang/rust#117703)
- [Undeprecate lint `unstable_features` and make use of it in the compiler.]
  (rust-lang/rust#118639)
- [Make inductive cycles in coherence ambiguous always.]
  (rust-lang/rust#118649)
- [Get rid of type-driven traversal in const-eval interning]
  (rust-lang/rust#119044),
  only as a [future compatiblity lint]
  (rust-lang/rust#122204) for now.
- [Deny braced macro invocations in let-else.]
  (rust-lang/rust#119062)

Compiler
--------

- [Include lint `soft_unstable` in future breakage reports.]
  (rust-lang/rust#116274)
- [Make `i128` and `u128` 16-byte aligned on x86-based targets.]
  (rust-lang/rust#116672)
- [Use `--verbose` in diagnostic output.]
  (rust-lang/rust#119129)
- [Improve spacing between printed tokens.]
  (rust-lang/rust#120227)
- [Merge the `unused_tuple_struct_fields` lint into `dead_code`.]
  (rust-lang/rust#118297)
- [Error on incorrect implied bounds in well-formedness check]
  (rust-lang/rust#118553),
  with a temporary exception for Bevy.
- [Fix coverage instrumentation/reports for non-ASCII source code.]
  (rust-lang/rust#119033)
- [Fix `fn`/`const` items implied bounds and well-formedness check.]
  (rust-lang/rust#120019)
- [Promote `riscv32{im|imafc}-unknown-none-elf` targets to tier 2.]
  (rust-lang/rust#118704)
- Add several new tier 3 targets:
  - [`aarch64-unknown-illumos`]
    (rust-lang/rust#112936)
  - [`hexagon-unknown-none-elf`]
    (rust-lang/rust#117601)
  - [`riscv32imafc-esp-espidf`]
    (rust-lang/rust#119738)
  - [`riscv32im-risc0-zkvm-elf`]
    (rust-lang/rust#117958)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

Libraries
---------

- [Implement `From<&[T; N]>` for `Cow<[T]>`.]
  (rust-lang/rust#113489)
- [Remove special-case handling of `vec.split_off
  (0)`.](rust-lang/rust#119917)

Stabilized APIs
---------------

- [`array::each_ref`]
  (https://doc.rust-lang.org/stable/std/primitive.array.html#method.each_ref)
- [`array::each_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.array.html#method.each_mut)
- [`core::net`]
  (https://doc.rust-lang.org/stable/core/net/index.html)
- [`f32::round_ties_even`]
  (https://doc.rust-lang.org/stable/std/primitive.f32.html#method.round_ties_even)
- [`f64::round_ties_even`]
  (https://doc.rust-lang.org/stable/std/primitive.f64.html#method.round_ties_even)
- [`mem::offset_of!`]
  (https://doc.rust-lang.org/stable/std/mem/macro.offset_of.html)
- [`slice::first_chunk`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.first_chunk)
- [`slice::first_chunk_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.first_chunk_mut)
- [`slice::split_first_chunk`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_first_chunk)
- [`slice::split_first_chunk_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_first_chunk_mut)
- [`slice::last_chunk`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.last_chunk)
- [`slice::last_chunk_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.last_chunk_mut)
- [`slice::split_last_chunk`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_last_chunk)
- [`slice::split_last_chunk_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_last_chunk_mut)
- [`slice::chunk_by`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.chunk_by)
- [`slice::chunk_by_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.chunk_by_mut)
- [`Bound::map`]
  (https://doc.rust-lang.org/stable/std/ops/enum.Bound.html#method.map)
- [`File::create_new`]
  (https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.create_new)
- [`Mutex::clear_poison`]
  (https://doc.rust-lang.org/stable/std/sync/struct.Mutex.html#method.clear_poison)
- [`RwLock::clear_poison`]
  (https://doc.rust-lang.org/stable/std/sync/struct.RwLock.html#method.clear_poison)

Cargo
-----

- [Extend the build directive syntax with `cargo::`.]
  (rust-lang/cargo#12201)
- [Stabilize metadata `id` format as `PackageIDSpec`.]
  (rust-lang/cargo#12914)
- [Pull out as `cargo-util-schemas` as a crate.]
  (rust-lang/cargo#13178)
- [Strip all debuginfo when debuginfo is not requested.]
  (rust-lang/cargo#13257)
- [Inherit jobserver from env for all kinds of runners.]
  (rust-lang/cargo#12776)
- [Deprecate rustc plugin support in cargo.]
  (rust-lang/cargo#13248)

Rustdoc
-----

- [Allows links in markdown headings.]
  (rust-lang/rust#117662)
- [Search for tuples and unit by type with `()`.]
  (rust-lang/rust#118194)
- [Clean up the source sidebar's hide button.]
  (rust-lang/rust#119066)
- [Prevent JS injection from `localStorage`.]
  (rust-lang/rust#120250)

Misc
----

- [Recommend version-sorting for all sorting in style guide.]
  (rust-lang/rust#115046)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Add more weirdness to `weird-exprs.rs`.]
  (rust-lang/rust#119028)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet