Skip to content

Conversation

@androm3da
Copy link
Contributor

The QuRT RTOS -- used primarily on the Hexagon architecture -- has support for large parts of POSIX.

Description

Add support for Hexagon QuRT OS.

Sources

The corresponding sources from the Hexagon SDK from https://github.com/snapdragon-toolchain/hexagon-sdk or https://softwarecenter.qualcomm.com/catalog/item/Hexagon_SDK

Checklist

  • N/A - Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

You will need to update

libc/build.rs

Lines 33 to 49 in a3bb40e

// Extra values to allow for check-cfg.
const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[
(
"target_os",
&[
"switch", "aix", "ohos", "hurd", "rtems", "visionos", "nuttx", "cygwin",
],
),
(
"target_env",
&["illumos", "wasi", "aix", "ohos", "nto71_iosock", "nto80"],
),
(
"target_arch",
&["loongarch64", "mips32r6", "mips64r6", "csky"],
),
];
to make check-cfg work, since this target is only on nightly so far.

Comment on lines +5 to +163
pub(crate) mod errno;
pub(crate) mod fcntl;
pub(crate) mod limits;
pub(crate) mod pthread;
pub(crate) mod semaphore;
pub(crate) mod signal;
pub(crate) mod stdio;
pub(crate) mod stdlib;
pub(crate) mod sys;
pub(crate) mod time;
pub(crate) mod unistd;
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this needs to be filled in right? Or deleted.

I'd appreciate if you could at least make unistd.rs and pthread.rs in src/new roughly matching their .h files, since I've ported most other platforms at this point. Everything else is up to you; you can either add the modules like you have here (eventually everything will hopefully be like this) or just put it all in src/qurt like most other platforms (and I'll move them over later).

Comment on lines +1 to +3
//! QuRT (Qualcomm Real-Time OS) bindings
//!
//! QuRT is Qualcomm's real-time operating system for Hexagon DSP architectures.
Copy link
Contributor

Choose a reason for hiding this comment

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

Mind adding a link to the SDK sources?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here, in the PR comments or in the comments of src/new/qurt/mod.rs?

Copy link
Contributor

Choose a reason for hiding this comment

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

The doc comment - I've been doing this for src/new to give some breadcrumbs for anyone who wants to check / update things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, added.

@rustbot
Copy link
Collaborator

rustbot commented Nov 30, 2025

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

@androm3da
Copy link
Contributor Author

AFAICT this failure is not related to my changes - I wonder if it's the kind of thing that might get addressed by a rebase? Or just re-running it?

Maybe this is something that #4872 was intended to fix? Or on the flip side, introduced by #4872?

+ cargo test --target x86_64-unknown-freebsd --workspace --no-default-features -- --skip check_style
    Updating crates.io index
error: failed to get `askama` as a dependency of package `ctest v0.5.0-beta.1 (/tmp/cirrus-ci-build/ctest)`

Caused by:
  download of config.json failed

Caused by:
  failed to download from `https://index.crates.io/config.json`

Caused by:
  [60] SSL peer certificate or SSH remote key was not OK (SSL certificate OpenSSL verify result: unable to get local issuer certificate (20))

Exit status: 101

@androm3da
Copy link
Contributor Author

@rustbot ready

@rustbot

This comment has been minimized.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like a lot of the defs in this file are duplicated between src/qurt and src/new/qurt, don't they need to be dropped?

Other than this, LGTM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry: I have removed these duplicates now.

@tgross35
Copy link
Contributor

Also if you could squash any commits that have back-and-forth (e.g. adding src/qurt then later removing it) that would be helpful, makes backporting cleaner.

The QuRT RTOS -- used primarily on the Hexagon architecture --
has support for large parts of POSIX.
@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2025

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.

@androm3da
Copy link
Contributor Author

Also if you could squash any commits that have back-and-forth (e.g. adding src/qurt then later removing it) that would be helpful, makes backporting cleaner.

I assumed that I would squash them all before merging? I have squashed all but the most recent changes now.

src/qurt/mod.rs Outdated
pub fn floor(x: c_double) -> c_double;
pub fn floorf(x: c_float) -> c_float;
pub fn fmod(x: c_double, y: c_double) -> c_double;
pub fn fmodf(x: c_float, y: c_float) -> c_float;
Copy link
Contributor

Choose a reason for hiding this comment

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

Noticed one other thing: we don't provide bindings for the math functions in libc, std binds them as necessary for the platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, fixed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants