Skip to content

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

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

androm3da wants to merge 9 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.

@rustbot

This comment has been minimized.

@rustbot rustbot added the has-merge-commits PR has merge commits, merge with caution. label Oct 8, 2026
@rust-log-analyzer

This comment has been minimized.

@ahmayun
ahmayun force-pushed the bcain/qurt-libstd-support branch from 3b71a89 to a2c73d7 Compare October 8, 2026 20:56
@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. labels Oct 8, 2026
@rust-log-analyzer

This comment has been minimized.

@ahmayun

ahmayun commented Oct 9, 2026 •

Copy link
Copy Markdown

Hi @joboet

I'm taking over this PR from @androm3da. I believe all your comments on the PR have been addressed and I've resolved the merge conflicts with main. Kindly let me know if more changes are needed.

I've built and tested this for hexagon-unknown-qurt. The build does depend on a minor libc change that is currently an open PR (PR has been merged)

@rust-bors

This comment has been minimized.

@ahmayun
ahmayun force-pushed the bcain/qurt-libstd-support branch from 43e9f43 to 84f3301 Compare October 12, 2026 14:02
@rustbot

This comment has been minimized.

@joboet

joboet commented Oct 12, 2026

Copy link
Copy Markdown
Member

@rustbot ready
(I rarely look at things not marked as S-waiting-on-review)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 12, 2026
Comment thread library/std/src/sys/pal/qurt/mod.rs Outdated
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
pub unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
stack_overflow::init();
unsafe { crate::sys::args::init(argc, argv) };

@joboet joboet Oct 20, 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 is a noop and can be removed...

Suggested change
unsafe { crate::sys::args::init(argc, argv) };

View changes since the review

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removed.

Comment thread library/std/src/sys/args/unsupported.rs Outdated
Comment on lines +6 to +10
#[cfg(target_os = "qurt")]
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
// QuRT goes through the unix PAL's `init`, but has no args to record.
}

@joboet joboet Oct 20, 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.

... rendering this unnecessary.

Suggested change
#[cfg(target_os = "qurt")]
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
// QuRT goes through the unix PAL's `init`, but has no args to record.
}

View changes since the review

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removed.

Comment thread library/std/src/sys/pal/qurt/mod.rs Outdated
// SAFETY: must be called only once during runtime initialization.
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
pub unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
stack_overflow::init();

@joboet joboet Oct 20, 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.

And this, too, is redundant.

View changes since the review

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removed.

Comment thread library/std/src/sys/pal/qurt/mod.rs Outdated
Comment on lines +7 to +8
#[path = "../unix/stack_overflow.rs"]
pub mod stack_overflow;

@joboet joboet Oct 20, 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.

Suggested change
#[path = "../unix/stack_overflow.rs"]
pub mod stack_overflow;

View changes since the review

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I decided not to remove this since qurt still reuses some of unix's thread code and removing this will cause an error on this line. I did, however, update the stale path.

Comment thread library/std/src/sys/pal/qurt/mod.rs Outdated
Comment on lines +11 to +12
#[path = "../unix/thread_parking.rs"]
pub mod thread_parking;

@joboet joboet Oct 20, 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 is only relevant for NetBSD.

Suggested change
#[path = "../unix/thread_parking.rs"]
pub mod thread_parking;

View changes since the review

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removed.

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.

Thanks, and no worries!

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.

Since there is now a dedicated PAL module, the changes here can be undone.

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

cfg_select! {
unix => {
any(unix, target_os = "qurt") => {

@joboet joboet Oct 20, 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 seems fishy – the QuRT module will not be used if this conditional is present.

View changes since the review

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, the QuRT PAL module was not being selected.
Fixed this and removed all (now-pointless) QuRT opt-ins from pal/unix/mod.rs

@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 Oct 20, 2026
androm3da and others added 9 commits October 21, 2026 14:12
QuRT is not a unix target, but provides POSIX-compatible threading, file
I/O and synchronization. Drop the unix family from the target spec and
instead opt into the unix PAL, selecting the unix implementation of each
subsystem where QuRT's POSIX layer is sufficient. This follows the
pattern used by other unix-adjacent targets.

Process spawning, networking and pipes remain unsupported.
Update documentation with details about how to leverage qurt, now that
there's some level of libstd support
The SDK's `libc_eh.a` unwinder does not define `_Unwind_GetIPInfo`, which
`eh_personality` needs on every frame, so unwinding cannot work as it
stands: the linker stub the docs previously recommended aborts on the
first frame.

Set `panic_strategy = Abort` and keep the target out of the personality
and `libunwind` arms, as Hermit and UEFI do; `panic_unwind` already falls
through to its aborting implementation. The `_Unwind_*` linker stubs are
no longer needed, so drop them from the documented link flags.
QuRT is not a unix target, but provides POSIX-compatible threading, file
I/O and synchronization. Drop the unix family from the target spec and
instead opt into the unix PAL, selecting the unix implementation of each
subsystem where QuRT has sufficient POSIX compatibility.

Process spawning, networking and pipes remain unsupported.
@ahumayun-qcom
ahumayun-qcom force-pushed the bcain/qurt-libstd-support branch from 84f3301 to 831243f Compare October 21, 2026 21:19
@rustbot

rustbot commented Oct 21, 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.

@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 Oct 22, 2026

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

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.

10 participants