Skip to content

Conversation

@thejpster
Copy link
Contributor

Adds three new targets to support ARMv6 processors running bare-metal:

  • armv6-none-eabi - Arm ISA, soft-float
  • armv6-none-eabihf - Arm ISA, hard-float
  • thumbv6-none-eabi - Thumb-1 ISA, soft-float

There is no thumbv6-none-eabihf target because as far as I can tell, hard-float isn't support with the Thumb-1 instruction set (and you need the ARMv6T2 extension to enable Thumb-2 support).

The targets require ARMv6K as a minimum, which allows the two Arm ISA targets to have full CAS atomics. LLVM has a bug which means it emits some ARMv6K instructions even if you only call for ARMv6, and as no-one else has noticed the bug, and because basically all ARMv6 processors have ARMv6K, I think this is fine. The Thumb target also doesn't have any kind of atomics, just like the Armv5TE and Armv4 targets, because LLVM was emitting library calls to emulate them.

Testing will be added to https://github.com/rust-embedded/aarch32 once the target is accepted. I already have tests for the other non-M arm-none-eabi targets, and those tests pass on these targets.

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.)

I have listed myself. If accepted, I'll talk to the Embedded Devices Working Group about adding this one to the rosta with all the others they support.

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.

You might prefer arm-none-eabi, because arm-unknown-linux-gnu is an ARMv6 target - the implicit rule seems to be that if the Arm architecture version isn't specified, it's assumed to be v6. However, armv6-none-eabi seemed to fit better between armv5te-none-eabi and armv7a/armv7r-none-eabi.

The hamming distance between thumbv6-none-eabi and thumbv6m-none-eabi is unfortunately low, but I don't know how to make it better. They are the ARMv6 and ARMv6-M targets, and its perhaps not worse than armv7a-none-eabi and armv7r-none-eabi.

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.

No different to any other arm-none-eabi 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.

Noted.

Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate...

Same as other arm-none-eabi targets.

The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible.

Same as other arm-none-eabi targets.

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.

Noted.

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.

Noted

Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.)

Noted

@rustbot
Copy link
Collaborator

rustbot commented Dec 18, 2025

stdarch is developed in its own repository. If possible, consider making this change to rust-lang/stdarch instead.

cc @Amanieu, @folkertdev, @sayantn

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

Some changes occurred in src/doc/rustc/src/platform-support

cc @Noratrieb

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 18, 2025

r? @madsmtm

rustbot has assigned @madsmtm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

Three targets, covering A32 and T32 instructions, and soft-float and
hard-float ABIs. Hard-float and atomics not available in Thumb mode.
@thejpster thejpster force-pushed the add-armv6-bare-metal branch from 696697d to 32cd8e5 Compare December 18, 2025 21:29
@thejpster
Copy link
Contributor Author

Force pushed with fixed formatting

thejpster added a commit to thejpster/aarch32 that referenced this pull request Dec 18, 2025
Targets added in rust-lang/rust#150138. Tested with local build of rustc.
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[endgroup]
[TIMING:end] tool::ToolBuild { build_compiler: Compiler { stage: 0, host: aarch64-unknown-linux-gnu, forced_compiler: false }, target: aarch64-unknown-linux-gnu, tool: "linkchecker", path: "src/tools/linkchecker", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 0.146
[TIMING:end] tool::Linkchecker { compiler: Compiler { stage: 0, host: aarch64-unknown-linux-gnu, forced_compiler: false }, target: aarch64-unknown-linux-gnu } -- 0.000
##[group]Testing stage1 Linkcheck (aarch64-unknown-linux-gnu)
rustc/print.html:15622: broken intra-doc link - [<code>AtomicU8</code>] and [<code>AtomicI8</code>]
rustc/platform-support/armv6-none-eabi.html:195: broken intra-doc link - [<code>AtomicU8</code>] and [<code>AtomicI8</code>]
checked links in: 22.9s
number of HTML files scanned: 46427
number of HTML redirects found: 14548
number of links checked: 2563503
number of links ignored due to external: 123266
---
Command `/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-tools-bin/linkchecker /checkout/obj/build/aarch64-unknown-linux-gnu/doc` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1612:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:190:77

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Build completed unsuccessfully in 0:39:06
  local time: Thu Dec 18 22:12:45 UTC 2025
  network time: Thu, 18 Dec 2025 22:12:46 GMT
##[error]Process completed with exit code 1.

Comment on lines -87 to +91
target_feature = "v6",
all(target_feature = "v6k", not(target_feature = "thumb-mode")),
target_feature = "v6t2",
all(target_feature = "v6", target_feature = "mclass"),
target_feature = "v7",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: I believe that it is, but where would I go to verify that the cfg here is correct?

Comment on lines +28 to +29
[`AtomicU8`](https://docs.rust-lang.org/stable/core/sync/atomic/struct.AtomicU8.html)
[`AtomicI8`](https://docs.rust-lang.org/stable/core/sync/atomic/struct.AtomicI8.html)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Fix broken doc links:

Suggested change
[`AtomicU8`](https://docs.rust-lang.org/stable/core/sync/atomic/struct.AtomicU8.html)
[`AtomicI8`](https://docs.rust-lang.org/stable/core/sync/atomic/struct.AtomicI8.html)
[`AtomicU8`]: https://docs.rust-lang.org/stable/core/sync/atomic/struct.AtomicU8.html
[`AtomicI8`]: https://docs.rust-lang.org/stable/core/sync/atomic/struct.AtomicI8.html

@madsmtm
Copy link
Contributor

madsmtm commented Dec 19, 2025

I think the naming is good.

I have reviewed it myself, and would r+, but our policy is that new targets should be approved by a compiler lead, so:

r? compiler_leads

@rustbot rustbot assigned wesleywiser and unassigned madsmtm Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants