Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add default compiler prefixes for thumbv7a/thumbv7r/thumbv8r bare-metal targets#1742

Merged
NobodyXu merged 1 commit into
rust-lang:mainfrom
cezarbbb:add-thumb-target-prefixes
Jun 4, 2026
Merged

Add default compiler prefixes for thumbv7a/thumbv7r/thumbv8r bare-metal targets#1742
NobodyXu merged 1 commit into
rust-lang:mainfrom
cezarbbb:add-thumb-target-prefixes

Conversation

@cezarbbb

@cezarbbb cezarbbb commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

These five Thumb-mode bare-metal Arm targets were recently promoted to Tier 2 in
rust-lang/rust(MCP is here). Without entries in get_default_prefix, the cc crate falls back to
the host compiler, which errors on -mthumb.

@NobodyXu NobodyXu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Just a question

Comment thread src/lib.rs
"armv7r-none-eabihf" => Some("arm-none-eabi"),
"armv8r-none-eabihf" => Some("arm-none-eabi"),
"thumbv7a-none-eabi" => Some("arm-none-eabi"),
"thumbv7a-none-eabihf" => Some("arm-none-eabi"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The description of the pr linked seems to match it to a arm-none-eabihf, as well as any target ends with hf

@cezarbbb

cezarbbb commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Thank you so much for your review! I thought so too before, but the existing entries in this match arm already map all eabihf targets to arm-none-eabi — for example armv7a-none-eabihf, armv7r-none-eabihf, armv8r-none-eabihf, thumbv7em-none-eabihf, thumbv8m.main-none-eabihf all use arm-none-eabi. In fact I found that arm-none-eabihf is never used as a prefix anywhere in this crate. It seems the bare-metal toolchain ships as a single arm-none-eabi-gcc binary and handles hard-float via compiler flags (-mfloat-abi=hard) rather than a separate prefix. Therefore, I simply referred to the processing methods of other existing *-none-eabihf targets.

@cezarbbb cezarbbb requested a review from NobodyXu June 4, 2026 06:22
@NobodyXu

NobodyXu commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Thank you!

I just remember that we use mfloat-abi instead of hf suffiz

cc-rs/src/lib.rs

Line 2384 in b49589a

cmd.args.push("-mfloat-abi=hard".into());

@NobodyXu NobodyXu merged commit b2e811e into rust-lang:main Jun 4, 2026
79 checks passed
@cezarbbb cezarbbb deleted the add-thumb-target-prefixes branch June 4, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants