std: add platform support for hexagon-unknown-qurt#152084
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
791d71f to
3201966
Compare
|
This PR depends on a newer version of the |
This comment has been minimized.
This comment has been minimized.
You need |
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
The commit I need - rust-lang/libc@9934c04 is not yet tagged/released. Or rather there is a |
This comment has been minimized.
This comment has been minimized.
3201966 to
5adcafb
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Ah - I see now that it appears in |
This comment has been minimized.
This comment has been minimized.
5adcafb to
caab9c9
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
caab9c9 to
3749f50
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
53a33f8 to
c526632
Compare
This comment has been minimized.
This comment has been minimized.
Fixed |
|
Looks like |
c526632 to
1325ffa
Compare
Fixed, thanks |
|
ping @joboet |
|
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 @rustbot label +I-libs-nominated |
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. |
1325ffa to
1bd87eb
Compare
|
Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb These commits modify compiler targets. |
|
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. |
Can you provide some more details? By expanding the "etc.". For example time and randomness aren't covered by your list. |
I've updated the PR description like so:
|
| @@ -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")))] | |||
There was a problem hiding this comment.
So, is qurt unix or not for cfg purposes? This seems to not be consistent throughout the PR
There was a problem hiding this comment.
Sorry, I'll make it consistent.
| @@ -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" => { | |||
There was a problem hiding this comment.
This is no longer needed since qurt is no longer unix.
|
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 |
aa6be17 to
45894d0
Compare
This comment has been minimized.
This comment has been minimized.
45894d0 to
2db6d1f
Compare
This comment has been minimized.
This comment has been minimized.
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
2db6d1f to
091e154
Compare
| - **`thread::yield_now()`**: Calls `sched_yield` which is stubbed to `abort`; | ||
| use `thread::sleep(Duration::from_millis(0))` as an alternative |
There was a problem hiding this comment.
Couldn't std do that? yield_now aborting seems bad, even having it be a noop is better.
| @@ -227,6 +231,7 @@ impl<'a> AsRawFd for io::StdinLock<'a> { | |||
| } | |||
|
|
|||
| #[stable(feature = "asraw_stdio_locks", since = "1.35.0")] | |||
| #[cfg(not(target_os = "qurt"))] | |||
There was a problem hiding this comment.
But stdio is supported, right? Why wouldn't this be available?
There was a problem hiding this comment.
This isn't used anymore, right? If so, then could you remove this change please?
| @@ -3,6 +3,10 @@ use crate::fmt; | |||
|
|
|||
| pub struct Args {} | |||
|
|
|||
| pub unsafe fn init(_argc: isize, _argv: *const *const u8) { | |||
There was a problem hiding this comment.
This should be gated for QuRT, otherwise other unsupported targets will complain about the unused function.
| @@ -124,6 +129,7 @@ pub fn set_permissions(path: &Path, perm: FilePermissions) -> io::Result<()> { | |||
| pub fn set_permissions_nofollow(path: &Path, perm: crate::fs::Permissions) -> io::Result<()> { | |||
| use crate::fs::OpenOptions; | |||
|
|
|||
| #[cfg_attr(any(target_os = "espidf", target_os = "horizon"), allow(unused_mut))] | |||
There was a problem hiding this comment.
Thanks! I suggest #[expect] instead of #[allow], it means we'll notice if the attribute becomes unnecessary.
There was a problem hiding this comment.
Please undo this change, this is no longer needed.
There was a problem hiding this comment.
Insert the config here instead of adding a manual fallback.
| #[cfg(target_os = "qurt")] | ||
| pub fn set_name(_name: &CStr) { | ||
| // QuRT doesn't support pthread_setname_np | ||
| } | ||
|
|
There was a problem hiding this comment.
| #[cfg(target_os = "qurt")] | |
| pub fn set_name(_name: &CStr) { | |
| // QuRT doesn't support pthread_setname_np | |
| } |
| -C "link-args=${QURTLIB}/crt1.o ${HEXLIB}/crt0.o ${HEXLIB}/init.o ${QURTLIB}/debugmon.o" \ | ||
| -C "link-args=-Wl,--section-start=.start=0x40000" \ | ||
| -C "link-args=-Wl,--defsym=sched_yield=abort" \ | ||
| -C "link-args=-Wl,--defsym=unsetenv=abort" \ |
There was a problem hiding this comment.
Making remove_env panic seems like a much nicer way of handling this.
| @@ -31,9 +31,9 @@ cfg_select! { | |||
| unix, | |||
| windows, | |||
| target_os = "psp", | |||
| target_os = "qurt", | |||
There was a problem hiding this comment.
You might be able to get rid of the weird symbol redefinitions by not linking to them here and just aborting in panic_unwind instead.
There are a number of other targets that don't support unwinding either, I suggest you have a look at the Hermit implementation in particular.
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: