Skip to content

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

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

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

Conversation

@androm3da

@androm3da androm3da commented Feb 4, 2026 •

Copy link
Copy Markdown
Contributor

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

rustbot commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

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

joboet commented Feb 7, 2026

Copy link
Copy Markdown
Member

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

joboet commented Feb 7, 2026

Copy link
Copy Markdown
Member

@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

rustbot commented Feb 7, 2026

Copy link
Copy Markdown
Collaborator

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

androm3da commented Feb 17, 2026 •

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?

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.

@ahumayun-qcom
ahumayun-qcom force-pushed the bcain/qurt-libstd-support branch from 831243f to a61647f Compare November 9, 2026 15:17
@rustbot rustbot added A-allocators Area: Custom and system allocators A-backtrace Area: Backtraces A-env Area: `std::env` (note: `std::process` is A-process) A-filesystem Area: `std::fs` A-io Area: `std::io` (note: `std::fs`, `std::net`, `std::path` are A-filesystem, A-net, A-path) A-libtest Area: `#[test]` / the `test` library A-path Area: `std::path` (note: `std::fs` is A-filesystem) A-process Area: `std::process` (note: `std::env` is A-env) A-random Area: random data generation support A-thread Area: `std::thread` A-time Area: `std::time` labels Nov 9, 2026
@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

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.

@joboet joboet left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for taking so long to respond. Unfortunately, the change is so large that it's really hard to keep track of everything; and I want to make sure we get it right, especially the public API changes. We've added support for some other targets incrementally in the past, but I'm not sure if that's sensible at this point. Anyway, here's a quick pass...

View changes since this review

Comment thread library/std/src/sys/env/unix.rs Outdated

#[cfg(target_os = "qurt")]
pub unsafe fn unsetenv(_n: &OsStr) -> io::Result<()> {
panic!("remove_var is not supported on this platform")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it'd be better to return io::Error::UNSUPPORTED_PLATFORM here, the panic message in remove_env is a bit nicer.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Returned Err(io::Error::UNSUPPORTED_PLATFORM) instead.

Comment thread library/std/src/sys/thread_local/mod.rs Outdated
all(not(target_thread_local), target_vendor = "apple"),
target_os = "qurt",
target_os = "teeos",
target_os = "qurt",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a duplicate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apologies. Removed.

Comment thread library/std/src/sys/pal/qurt/mod.rs Outdated
}
}

#[allow(dead_code)] // Not used on all platforms.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this used on QuRT?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You are right. #[allow(dead_code)] was unnecessary here.

Comment thread library/std/src/sys/fs/unix.rs Resolved
@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 Nov 13, 2026
@ahumayun-qcom

Copy link
Copy Markdown

Sorry for taking so long to respond. Unfortunately, the change is so large that it's really hard to keep track of everything; and I want to make sure we get it right, especially the public API changes. We've added support for some other targets incrementally in the past, but I'm not sure if that's sensible at this point. Anyway, here's a quick pass...

View changes since this review

No worries at all. I understand this is a big change and it's in everyone's best interest that it is done right. Thank you for all the feedback.

@ahumayun-qcom

Copy link
Copy Markdown

@rustbot ready

@rustbot rustbot 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 Nov 18, 2026
@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

debug_assert_eq!(ret, 0);
#[cfg(not(target_os = "qurt"))]
{
let ret = unsafe { libc::sched_yield() };

@joboet joboet Nov 25, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like QuRT defines a sched_yield symbol? Or am I missing something.

View changes since the review

@ahumayun-qcom ahumayun-qcom Nov 25, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The repository you have linked to is the hexagon-hypervisor (colloquially h2), which is separate from QuRT. Catering for it would be a new hexagon-unknown-h2 target rather than a hexagon-unknown-qurt thing. QuRT is what the public Hexagon SDK currently ships with and defines sched_yield as:

static inline int sched_yield(void)

So it is never exported as a linkable symbol. More details are noted in the rust-lang/libc crate at src/new/qurt/sys/sched.rs:21-24.

If you wish to independently verify sched_yield's static inline qualifiers for QuRT, you may use the following one-liner shell command for your convenience:

curl -L -o /tmp/hexagon_sdk.zip "https://softwarecenter.qualcomm.com/api/download/software/sdks/Hexagon_SDK/Windows/6.7.0.0/Hexagon_SDK_WinNT_6.7.0.zip" && unzip -p /tmp/hexagon_sdk.zip '*posix/sys/sched.h' | grep -A3 sched_yield

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is still unresolved.

Comment on lines +7 to +8
#[path = "../unix/stack_overflow/mod.rs"]
pub mod stack_overflow;

@joboet joboet Nov 25, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a heads-up that this will be made unnecessary by #166389.

View changes since the review

@@ -0,0 +1,21 @@
//! QuRT-specific definitions.

#![stable(feature = "raw_ext", since = "1.1.0")]

@joboet joboet Nov 25, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please leave these as unstable for now, that would make me a bit more relaxed about merging this without having to hold a FCP.

View changes since the review

}

#[cfg(not(target_os = "trusty"))]
#[cfg(not(any(target_os = "qurt", target_os = "trusty")))]

@joboet joboet Nov 25, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This shouldn't apply to File, should it?

View changes since the review

@joboet joboet Nov 25, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you rebase this on top of #166395? That should make this more trivial.

View changes since the review

@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 Nov 25, 2026
@ahumayun-qcom ahumayun-qcom mentioned this pull request Nov 25, 2026
1 of 4 tasks

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocators Area: Custom and system allocators A-backtrace Area: Backtraces A-env Area: `std::env` (note: `std::process` is A-process) A-filesystem Area: `std::fs` A-io Area: `std::io` (note: `std::fs`, `std::net`, `std::path` are A-filesystem, A-net, A-path) A-libtest Area: `#[test]` / the `test` library A-path Area: `std::path` (note: `std::fs` is A-filesystem) A-process Area: `std::process` (note: `std::env` is A-env) A-random Area: random data generation support A-thread Area: `std::thread` A-time Area: `std::time` O-unix Operating system: Unix-like S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

10 participants