Skip to content

Support new qnx targets#5241

Open
jonathanpallant wants to merge 3 commits into
rust-lang:mainfrom
ferrocene:support-new-qnx-targets
Open

Support new qnx targets#5241
jonathanpallant wants to merge 3 commits into
rust-lang:mainfrom
ferrocene:support-new-qnx-targets

Conversation

@jonathanpallant

Copy link
Copy Markdown
Contributor

Description

Updates libc to support the newly renamed targets for QNX SDP 8

This PR largely involves adding target_os = "qnx" everywhere that said target_os = "nto", and replacing target_env = "nto800" with target_os = "qnx".

Plus there are some pthread mutex fixes, which we took from the our header files.

Sources

For QNX SDP 8.0:

$ grep "#define PTHREAD_MUTEX_INITIALIZER" /home/ubuntu/qnx800/target/qnx/usr/include/pthread.h -A1
#define PTHREAD_MUTEX_INITIALIZER                   \
	{ .__u = { .__count = _NTO_SYNC_NONRECURSIVE }, .__owner = _NTO_SYNC_MUTEX_FREE }
$ rg "#define _NTO_SYNC_NONRECURSIVE" /home/ubuntu/qnx800
/home/ubuntu/qnx800/target/qnx/usr/include/sys/target_nto.h
540:#define _NTO_SYNC_NONRECURSIVE	0x80000000U	/* mutexes */
$ rg "#define _NTO_SYNC_MUTEX_FREE" /home/ubuntu/qnx800
/home/ubuntu/qnx800/target/qnx/usr/include/sys/target_nto.h
550:#define _NTO_SYNC_MUTEX_FREE	0x00000000U	/*    0  newly-initialized mutex */

For QNX SDP 7.1:

$ grep "#define PTHREAD_MUTEX_INITIALIZER" /home/ubuntu/qnx710/target/qnx7/usr/include/pthread.h -A1
#define PTHREAD_MUTEX_INITIALIZER	\
	{ .__u = { .__count = (_NTO_SYNC_NONRECURSIVE | _NTO_SYNC_NODESTROY) }, .__owner = _NTO_SYNC_MUTEX_FREE }
$ rg "#define _NTO_SYNC_NONRECURSIVE" /home/ubuntu/qnx710
/home/ubuntu/qnx710/target/qnx7/usr/include/sys/target_nto.h
470:#define _NTO_SYNC_NONRECURSIVE	0x80000000U	/* mutexes */
$ rg "#define _NTO_SYNC_NODESTROY" /home/ubuntu/qnx710
/home/ubuntu/qnx710/target/qnx7/usr/include/sys/target_nto.h
476:#define _NTO_SYNC_NODESTROY		0x02000000U /* mutexes */
$ rg "#define _NTO_SYNC_MUTEX_FREE" /home/ubuntu/qnx710
/home/ubuntu/qnx710/target/qnx7/usr/include/sys/target_nto.h
479:#define _NTO_SYNC_MUTEX_FREE	0x00000000U	/*    0  mutexes, and old cond, sem, spin */

I don't have QNX SDP 7.0 available, so the old code path was left as-is.

Checklist

  • Relevant tests in libc-test/semver have been updated (there are none)
  • 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
    • These tests do not pass but they didn't pass before this PR either

@rustbot label +stable-nominated

@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 2, 2026
@jonathanpallant

Copy link
Copy Markdown
Contributor Author

Well this seems to fail because the copy of rustc used doesn't know about target_os = "qnx".

Comment thread build.rs
Comment on lines 42 to 47
(
"target_os",
&[
"switch", "aix", "ohos", "hurd", "rtems", "visionos", "nuttx", "cygwin", "qurt",
],
),

@tgross35 tgross35 Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If that's a new config only in nightly, you'll need to update this

View changes since the review

@rustbot

rustbot commented Jul 3, 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.

@rustbot

rustbot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • The following commits have merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

    You can start a rebase with the following commands:

    $ # rebase
    $ git pull --rebase https://github.com/rust-lang/libc.git main
    $ git push --force-with-lease
    

@jonathanpallant

Copy link
Copy Markdown
Contributor Author

sigh. I clicked the "Merge changes from main" button, but the bot tells me I shouldn't have clicked the button. I'll rebase.

@tgross35

tgross35 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

I wish I could disable that button or make it rebase-only, unfortunately nothing we've tried can make it disappear

@jonathanpallant jonathanpallant force-pushed the support-new-qnx-targets branch from 196df63 to 825590e Compare July 3, 2026 08:42
@jonathanpallant

Copy link
Copy Markdown
Contributor Author
+ /usr/sbin/pkg_add curl
  pkg_add: Can't process [http://cdn.NetBSD.org:80/pub/pkgsrc/packages/NetBSD/x86_64/10.1/All//curl*:](http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/10.1/All//curl*:) 
  pkg_add: no pkg found for 'curl', sorry.

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, CI has been flaky so I'll try to merge later

View changes since this review

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

Labels

S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants