Skip to content

Conversation

androm3da
Copy link
Contributor

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Sep 30, 2025

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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 30, 2025

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
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.

@rust-log-analyzer

This comment has been minimized.

@tgross35
Copy link
Contributor

Procedurally, adding a new T3 target requires a MCP (Major Change Proposal), which is an issue template at https://github.com/rust-lang/compiler-team/issues. See rust-lang/compiler-team#911 for a recent example.

@jieyouxu
Copy link
Member

Procedurally, adding a new T3 target requires a MCP (Major Change Proposal), which is an issue template at rust-lang/compiler-team/issues. See rust-lang/compiler-team#911 for a recent example.

(I believe that was revised to only require a PR (with the target tier policy for T3 filled out), and assigned to one of the compiler co-leads. For certain targets (especially the more obscure ones) we may ask for an MCP for further discusssions. This target seems... rather obscure, so an MCP seems beneficial.)

r? compiler_leads

@rustbot rustbot assigned davidtwco and unassigned BoxyUwU Sep 30, 2025

## Cross-compilation toolchains and C code

This target requires the [Hexagon SDK toolchain for C interoperability](https://softwarecenter.qualcomm.com/api/download/software/sdks/Hexagon_SDK/Linux/Debian/6.3.0.0/Hexagon_SDK.zip):
Copy link
Member

Choose a reason for hiding this comment

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

What is the license of this SDK? Maybe you could link to the page that links to the zip file and presumably also the license.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a proprietary SDK, hopefully the change makes this clearer.

@rust-log-analyzer

This comment has been minimized.

@androm3da
Copy link
Contributor Author

androm3da commented Sep 30, 2025

Procedurally, adding a new T3 target requires a MCP (Major Change Proposal), which is an issue template at rust-lang/compiler-team/issues. See rust-lang/compiler-team#911 for a recent example.

(I believe that was revised to only require a PR (with the target tier policy for T3 filled out), and assigned to one of the compiler co-leads. For certain targets (especially the more obscure ones) we may ask for an MCP for further discusssions. This target seems... rather obscure, so an MCP seems beneficial.)

r? compiler_leads

Happy to fill out an MCP - that makes sense to me.

But in filling it out, I think I've hit a roadblock that makes me consider abandoning this PR.

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.

Of course - this policy makes perfect sense. For this particular target, it's generally targeted using the hexagon-unknown-elf triple when using clang -- not hexagon-unknown-qurt. This is unfortunate because it also means that clang doesn't emit preprocessor defines like __QURT__ because there's no distinction. But in places like Rust's libc, I want to be able to guard things with #[cfg(target_os = "qurt")].

Sorry - perhaps this discussion might be better on the MCP issue rather than this PR. We already have an hexagon-unknown-none-elf target in rustc. Should I just use that one instead or does this constitute a "very good reason to diverge"? It's definitely the case that some folks use other non-QuRT, non-Linux OSs on Hexagon DSPs, but -- for now -- this is probably only internal to Qualcomm.

@rust-log-analyzer

This comment has been minimized.

@tgross35
Copy link
Contributor

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.

Of course - this policy makes perfect sense. For this particular target, it's generally targeted using the hexagon-unknown-elf triple when using clang -- not hexagon-unknown-qurt. This is unfortunate because it also means that clang doesn't emit preprocessor defines like __QURT__ because there's no distinction. But in places like Rust's libc, I want to be able to guard things with #[cfg(target_os = "qurt")].

Why doesn't Clang have a -qurt target, or why isn't it used? If there is a need to configure on qurt vs. not qurt (e.g. different system interfaces) then that's probably enough to justify a new Rust target. It just seems weird that Clang doesn't have the target if it's useful.

@androm3da
Copy link
Contributor Author

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.

Of course - this policy makes perfect sense. For this particular target, it's generally targeted using the hexagon-unknown-elf triple when using clang -- not hexagon-unknown-qurt. This is unfortunate because it also means that clang doesn't emit preprocessor defines like __QURT__ because there's no distinction. But in places like Rust's libc, I want to be able to guard things with #[cfg(target_os = "qurt")].

Why doesn't Clang have a -qurt target, or why isn't it used? If there is a need to configure on qurt vs. not qurt (e.g. different system interfaces) then that's probably enough to justify a new Rust target.

The Hexagon SDK toolchain ships with hexagon-clang -- this canonicalizes as hexagon-unknown-elf. By default hexagon-clang builds with a common C library and links in a crt0 for a baremetal OS. But for targeting QuRT, that behavior is explicitly overridden when invoking hexagon-clang to compile or link to additionally use QuRT include paths and link against QuRT libraries/crt0 instead. I don't know for sure but I suppose it's "simpler" this way -- or maybe it's just a historical thing that stays that way due to momentum.

If there is a need to configure on qurt vs. not qurt (e.g. different system interfaces) then that's probably enough to justify a new Rust target.

The Hexagon Linux target is not supported by the Hexagon SDK and so far that's really the only toolchain that's used to target QuRT. In practice, no commercial users of Hexagon target anything other than QuRT on Hexagon architecture. So IMO it's an oversimplification that happens to work. The opensource clang+llvm toolchain (see build recipe ) could conceivably target QuRT but is missing a C library that would work with QuRT, so in practice no one uses it for that -- yet.

It just seems weird that Clang doesn't have the target if it's useful.

My understanding is that clang could take a hexagon-unknown-qurt triple and it would probably work reasonably well if it were interpreted as having the same behavior as hexagon-unknown-none-elf / hexagon-unknown-elf. I don't recall for sure but I suppose the clang driver might do just that. And if not, it's not hard to change it to do so. But -- it's untested and definitely not how it's been done by the Hexagon SDK over the years. I hope I am just being overly cautious here but Rust's policy regarding target names makes a lot of sense to me.

@androm3da
Copy link
Contributor Author

This target seems... rather obscure, so an MCP seems beneficial.)

Thanks - MCP created rust-lang/compiler-team#919

Comment on lines 49 to 57
[target.hexagon-qurt]
cc = "hexagon-clang"
cxx = "hexagon-clang++"
ranlib = "hexagon-ranlib"
ar = "hexagon-ar"
llvm-libunwind = 'in-tree'
Copy link
Contributor

Choose a reason for hiding this comment

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

These all come from the hexagon toolchain, right? If they are needed then it's probably worth mentioning the toolchain in the "requirements" section. If not, maybe add a comment here that the defaults also work or provide an alt setup.

Copy link
Contributor

Choose a reason for hiding this comment

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

src/doc/rustc/src/platform-support.md will also need to be updated

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Oct 3, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

LGTM when @tgross35's comments are resolved, tests are blessed and MCP is finished

View changes since this review

@rustbot
Copy link
Collaborator

rustbot commented Oct 17, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@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.144 [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:13380: broken link - `rustc/platform-support/hexagon-qurt.html` rustc/platform-support.html:455: broken link - `rustc/platform-support/hexagon-qurt.html` checked links in: 21.9s number of HTML files scanned: 46144 number of HTML redirects found: 14536 number of links checked: 2534732 number of links ignored due to external: 121465 number of links ignored due to exceptions: 24 number of intra doc links ignored: 9 errors found: 2 found some broken links NOTE: if you are adding or renaming a markdown file in a mdBook, don't forget to register the page in SUMMARY.md 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:1549:23 Executed at: src/bootstrap/src/core/build_steps/test.rs:171: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:38:50 local time: Fri Oct 17 18:03:55 UTC 2025 network time: Fri, 17 Oct 2025 18:03:55 GMT ##[error]Process completed with exit code 1. 
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.

8 participants