Skip to content

std: add platform support for hexagon-unknown-qurt#152084

Open
androm3da wants to merge 2 commits into
rust-lang:mainfrom
androm3da:bcain/qurt-libstd-support
Open

std: add platform support for hexagon-unknown-qurt#152084
androm3da wants to merge 2 commits into
rust-lang:mainfrom
androm3da:bcain/qurt-libstd-support

Conversation

@androm3da
Copy link
Copy Markdown
Contributor

@androm3da androm3da commented Feb 4, 2026

View all comments

QuRT is not a unix target but provides POSIX-compatible threading, file I/O, and synchronization APIs. This implementation does not declare unix as a target family. Instead, it explicitly opts into the unix PAL and selects unix-based implementations for individual subsystems where QuRT's POSIX layer is sufficient.

Supported: alloc, threading, mutex, condvar, rwlock, once, thread parking, TLS, file system, file descriptors, stdio, I/O slices, I/O errors, is_terminal, env, paths, time, exit, personality/unwinding, backtrace

Stubbed; returns Err: process spawning, networking, pipes, hostname
Stubbed; returns empty: command-line args
Stubbed; panics: random

Platform modules:

  • New os::qurt module with platform-specific extensions (ffi, fs, io, raw)

@rustbot rustbot added O-unix Operating system: Unix-like 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-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 4, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 4, 2026

r? @joboet

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

@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from 791d71f to 3201966 Compare February 4, 2026 15:11
@androm3da
Copy link
Copy Markdown
Contributor Author

This PR depends on a newer version of the libc crate - maybe I'll let this PR hang here for a bit and check back in when it gets released and promoted?

@rust-log-analyzer

This comment has been minimized.

@joboet
Copy link
Copy Markdown
Member

joboet commented Feb 7, 2026

This PR depends on a newer version of the libc crate - maybe I'll let this PR hang here for a bit and check back in when it gets released and promoted?

You need libc at 0.2.179, right? You can update libc here – but please keep it in a separate commit.

@joboet
Copy link
Copy Markdown
Member

joboet commented Feb 7, 2026

@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 Feb 7, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 7, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@androm3da
Copy link
Copy Markdown
Contributor Author

This PR depends on a newer version of the libc crate - maybe I'll let this PR hang here for a bit and check back in when it gets released and promoted?

You need libc at 0.2.179, right? You can update libc here – but please keep it in a separate commit.

The commit I need - rust-lang/libc@9934c04 is not yet tagged/released. Or rather there is a ctest-* tag but I suspect that doesn't apply/not intended use for that tag. Should I try to execute a tag/release of libc, or just wait for that to happen naturally?

@rust-bors

This comment has been minimized.

@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from 3201966 to 5adcafb Compare February 10, 2026 19:47
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@androm3da
Copy link
Copy Markdown
Contributor Author

androm3da commented Feb 17, 2026

This PR depends on a newer version of the libc crate - maybe I'll let this PR hang here for a bit and check back in when it gets released and promoted?

You need libc at 0.2.179, right? You can update libc here – but please keep it in a separate commit.

The commit I need - rust-lang/libc@9934c04 is not yet tagged/released. Or rather there is a ctest-* tag but I suspect that doesn't apply/not intended use for that tag. Should I try to execute a tag/release of libc, or just wait for that to happen naturally?

Ah - I see now that it appears in 0.2.181 and there's already a PR open for that (#150752). I'll rebase when that lands.

@rust-bors

This comment has been minimized.

@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from 5adcafb to caab9c9 Compare March 31, 2026 23:16
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from caab9c9 to 3749f50 Compare April 1, 2026 03:17
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@androm3da
Copy link
Copy Markdown
Contributor Author

gentle ping @joboet

Comment thread library/test/src/lib.rs Outdated
@quic-mliebel
Copy link
Copy Markdown

LGTM once libc::stat and raw::stat match

@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from 53a33f8 to c526632 Compare April 13, 2026 23:06
@rustbot

This comment has been minimized.

@androm3da
Copy link
Copy Markdown
Contributor Author

LGTM once libc::stat and raw::stat match

Fixed

@quic-mliebel
Copy link
Copy Markdown

Looks like blkcnt_t and blksize_t are needed:

python3 x.py check library --target hexagon-unknown-qurt

...

error[E0432]: unresolved import `super::platform::raw::blkcnt_t`
  --> library/std/src/os/unix/raw.rs:30:32
   |
30 | pub use super::platform::raw::{blkcnt_t, time_t};
   |                                ^^^^^^^^ no `blkcnt_t` in `os::qurt::raw`
   |
   = help: consider importing this type alias instead:
           libc::blkcnt_t

error[E0432]: unresolved import `super::platform::raw::blksize_t`
  --> library/std/src/os/unix/raw.rs:33:32
   |
33 | pub use super::platform::raw::{blksize_t, dev_t, ino_t, mode_t, nlink_t, off_t};
   |                                ^^^^^^^^^ no `blksize_t` in `os::qurt::raw`
   |
   = help: consider importing this type alias instead:
           libc::blksize_t

@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from c526632 to 1325ffa Compare April 16, 2026 19:58
@androm3da
Copy link
Copy Markdown
Contributor Author

Looks like blkcnt_t and blksize_t are needed:

python3 x.py check library --target hexagon-unknown-qurt

...

error[E0432]: unresolved import `super::platform::raw::blkcnt_t`
  --> library/std/src/os/unix/raw.rs:30:32
   |
30 | pub use super::platform::raw::{blkcnt_t, time_t};
   |                                ^^^^^^^^ no `blkcnt_t` in `os::qurt::raw`
   |
   = help: consider importing this type alias instead:
           libc::blkcnt_t

error[E0432]: unresolved import `super::platform::raw::blksize_t`
  --> library/std/src/os/unix/raw.rs:33:32
   |
33 | pub use super::platform::raw::{blksize_t, dev_t, ino_t, mode_t, nlink_t, off_t};
   |                                ^^^^^^^^^ no `blksize_t` in `os::qurt::raw`
   |
   = help: consider importing this type alias instead:
           libc::blksize_t

Fixed, thanks

@androm3da
Copy link
Copy Markdown
Contributor Author

ping @joboet

@joboet
Copy link
Copy Markdown
Member

joboet commented May 5, 2026

Sorry for the delay, I was taking a bit of a break from reviewing.

Could you provide a bit more context on QuRT? It looks like quite a lot of UNIX stuff is stubbed out here. How much UNIX-compatibility does QuRT actually provide? I'm asking because we have some similar UNIX-adjacent targets (e.g. Hermit, TEEOS) that don't list UNIX as their target family and instead just reuse the UNIX code in std where applicable.

@rustbot label +I-libs-nominated
I think this question has come up before, but how much UNIX-compatibility do you want to require for the UNIX target family?

@rustbot rustbot added the I-libs-nominated Nominated for discussion during a libs team meeting. label May 5, 2026
@androm3da
Copy link
Copy Markdown
Contributor Author

Sorry for the delay, I was taking a bit of a break from reviewing.

Could you provide a bit more context on QuRT? It looks like quite a lot of UNIX stuff is stubbed out here. How much UNIX-compatibility does QuRT actually provide? I'm asking because we have some similar UNIX-adjacent targets (e.g. Hermit, TEEOS) that don't list UNIX as their target family and instead just reuse the UNIX code in std where applicable.

QuRT is a proprietary RTOS for Hexagon, ARM, RISC-V architectures that is usually focused on embedded DSP/uC devices without a direct storage device, without an interactive terminal/shell/UART. It has memory-protected processes, some POSIX capability like pthreads/mutexes. QuRT lacks SysV IPC. QuRT provides an indirect access to a filesystem via calls to some-other-SoC-node-with-a-disk.

But yeah - I'm totally fine w/redoing this PR to avoid touching UNIX and making it look more like hermit/teeos. Will take a look and update the PR.

@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from 1325ffa to 1bd87eb Compare May 6, 2026 01:43
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 6, 2026

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

cc @Noratrieb

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

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 6, 2026

This PR was rebased onto a different main 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.

@the8472
Copy link
Copy Markdown
Member

the8472 commented May 6, 2026

Platform modules:

* New os::qurt module with platform-specific extensions to ffi, fs, io, raw

* QuRT-specific file handling for ino, dev, mode, nlink, etc.

Unsupported: Networking, fork/exec, pipe, chown/fchown/lchown/chroot/mkfifo

Can you provide some more details? By expanding the "etc.". For example time and randomness aren't covered by your list.
And want to know which APIs are stubbed in a way that results in panics vs. those that return Err results.

@androm3da
Copy link
Copy Markdown
Contributor Author

androm3da commented May 6, 2026

Can you provide some more details? By expanding the "etc.". For example time and randomness aren't covered by your list. And want to know which APIs are stubbed in a way that results in panics vs. those that return Err results.

I've updated the PR description like so:

Supported: alloc, threading, mutex, condvar, rwlock, once, thread parking, TLS, file system, file descriptors, stdio, I/O slices, I/O errors, is_terminal, env, paths, time, exit, personality/unwinding, backtrace

Stubbed; returns Err: process spawning, networking, pipes, hostname
Stubbed; returns empty: command-line args
Stubbed; panics: random

Comment thread library/test/src/test_result.rs Outdated
@@ -114,7 +114,7 @@ pub(crate) fn get_result_from_exit_code(
Some(TR_OK) => TestResult::TrOk,
#[cfg(windows)]
Some(STATUS_FAIL_FAST_EXCEPTION) => TestResult::TrFailed,
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "qurt")))]
Copy link
Copy Markdown
Member

@nia-e nia-e May 13, 2026

Choose a reason for hiding this comment

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

So, is qurt unix or not for cfg purposes? This seems to not be consistent throughout the PR

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I'll make it consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread library/std/src/sys/pipe/mod.rs Outdated
@@ -1,6 +1,11 @@
#![forbid(unsafe_op_in_unsafe_fn)]

cfg_select! {
// QuRT uses unsupported pipes since it doesn't support process spawning
target_os = "qurt" => {
Copy link
Copy Markdown
Member

@joshtriplett joshtriplett May 13, 2026

Choose a reason for hiding this comment

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

This is no longer needed since qurt is no longer unix.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks

@nia-e
Copy link
Copy Markdown
Member

nia-e commented May 13, 2026

The conclusion from today's libs meeting was that this target is (given what we're seeing) Not Unix, but properly defining what is unix is best left for a refactor of the cfgs we expose

@nia-e nia-e removed the I-libs-nominated Nominated for discussion during a libs team meeting. label May 13, 2026
@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch 2 times, most recently from aa6be17 to 45894d0 Compare May 13, 2026 21:01
@rust-log-analyzer

This comment has been minimized.

@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from 45894d0 to 2db6d1f Compare May 13, 2026 21:26
@rust-log-analyzer

This comment has been minimized.

androm3da added 2 commits May 13, 2026 14:34
Remove unix family from hexagon-unknown-qurt target spec and instead
explicitly opt into unix implementations where applicable, following the
pattern used by similar unix-adjacent targets.

The target uses the unix PAL and explicitly selects unix implementations
for the supported features.

Modules that remain unsupported for qurt: process spawning, networking
and pipes.
Update documentation with details about how to leverage qurt, now that
there's some level of libstd support
@androm3da androm3da force-pushed the bcain/qurt-libstd-support branch from 2db6d1f to 091e154 Compare May 13, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix Operating system: Unix-like 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-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.

8 participants