-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support QNX 7.1 with io-sock
+libstd and QNX 8.0 (no_std
only)
#133631
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
96a91e2
to
6116b6a
Compare
This comment has been minimized.
This comment has been minimized.
So, first up, excellent! The AWS QNX Neutrino 7.1.0 AMIs appears to use iosock and so I have to keep copying over However, I note that there are currently no five-part-triples in the target list, so this would be the first. Perhaps Will there be a |
This comment was marked as resolved.
This comment was marked as resolved.
Beware that version 3 and 4 have different APIs -- they may seem to work, but there might be subtle issues up to undefined behavior.
Very good idea -- I found it confusing that target_env uses an underscore while the target name does not. I will rename it!
Not planned so far, but should be quite easy to do. How big is the need for it? |
No idea. Who was asking for this target? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
I was thinking to use an obvious dummy value rather than panicking if the environment variable isn't set. But maybe the project people have a better idea. Are there another other targets that need to read environment variables? |
This comment was marked as resolved.
This comment was marked as resolved.
5051c34
to
00079dc
Compare
This comment has been minimized.
This comment has been minimized.
72b6642
to
32310c3
Compare
Updated the nto-qnx.md document to reflect changes done by #134211 (and rebased). |
☔ The latest upstream changes (presumably #134677) made this pull request unmergeable. Please resolve the merge conflicts. |
8781120
to
5758d3b
Compare
☔ The latest upstream changes (presumably #134822) made this pull request unmergeable. Please resolve the merge conflicts. |
5758d3b
to
76dc10d
Compare
AR_x86_64_pc_nto_qnx710=ntox86_64-ar' | ||
- `CC_<target>=qcc` | ||
- `CFLAGS_<target>=<nto_cflag>` | ||
- `CXX_<target>=qcc` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'AR_<target>=<nto<arch>-ar'
is missed here as well as in the example below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be required anymore on recent master of Rust (at least to compile libstd). Do you observe issues on this branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I faced this issue while compiling this branch against the latest cc-rs. Since rust-lang/cc-rs#1319 is merged i followed the new build steps.
Is this change missed in the cc-rs ?
Similar to the modified get_base_compiler
shouldn't the get_base_archiver
modified to return qcc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work without setting the archiever, at least it worked for me 😄 . To not risk delaying this PR further, I've restored the previous documentation, it does not hurt to still set the env variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does a networking stack change require an entirely new target? I'm not seeing any library code changes that justify it?
Good point. Sorry for missing out to link to the prepared libc changes: A lot of (networking related) constants have different values, i.e. libstd requires a recompilation at least. In libc, we need to distinguish between the QNX versions, including the network stack 😒 . The versions are not ABI compatible. Also, we need to specify an additional linking search path when using io-sock. |
Lovely. Thank you for the additional context and your patience, I was very busy in December unfortunately so didn't get around to a lot. Will try to review this soon. |
…rk stack on aarch64 Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
76dc10d
to
7755502
Compare
@jonathanpallant Hope you're back from vacation. Could you take a look at this PR ? |
But, as I agreed with Florian before Christmas, we should get this merged because the targets existing is a blocker on libc and cc-rs changes. |
Build command: #!/bin/bash
source ~/qnx700/qnxsdp-env.sh
export build_env='
CC_aarch64_unknown_nto_qnx700=qcc
CXX_aarch64_unknown_nto_qnx700=qcc
CFLAGS_aarch64_unknown_nto_qnx700=-Vgcc_ntoaarch64le_cxx
AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar
CC_i586_pc_nto_qnx700=qcc
CXX_i586_pc_nto_qnx700=qcc
CFLAGS_i586_pc_nto_qnx700=-Vgcc_ntox86_cxx
AR_i586_pc_nto_qnx700=ntox86-ar
'
env $build_env ./x.py build \
--target aarch64-apple-darwin,aarch64-unknown-nto-qnx700,i586-pc-nto-qnx700 \
rustc library/core library/alloc library/std src/tools/remote-test-server Error:
|
I think that's a libc bug. I'll open an issue for it. Edit: rust-lang/libc#4241 |
QNX SDP 8.0 comes with newly renamed QNX OS 8.0, so update the page to talk about QNX, QNX Neutrino 7.0, QNX Neutrino 7.1 or QNX OS 8.0. Also actually add a list of target triples.
I'm proposing some wording changes to the nto-qnx.md README now that QNX are calling the new version QNX OS 8.0 (dropping the 'Neutrino' label that 7.1 and earlier versions had): https://github.com/jonathanpallant/rust/tree/add_nto_qnx71_iosock_support_readme_updates @flba-eb do you want to merge them into this PR, or should we do that and then I'll do that separately? Edit: also the build failures above are simply because there's no libstd support for |
I would love to do this separately in case it helps getting this PR merged sooner, but if there are no review comments in the next few days I will probably merge your improvements. |
I would be happier to see the correct nomenclature in place. |
I must confess I am an insufferable pedant at heart. |
If this is about the change proposed by @jonathanpallant : It is now merged and pushed 😄 . |
As is the Rust compiler, so we're all in good company :) |
@@ -18,30 +20,29 @@ and [Blackberry QNX][BlackBerry]. | |||
|
|||
## Requirements | |||
|
|||
Currently, the following QNX Neutrino versions and compilation targets are supported: | |||
Currently, the following QNX versions and compilation targets are supported: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the target_os
should be migrated to "qnx"
... (we don't require the target tuple and the target_os
to line up perfectly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a random thought right now, I won't blockade anything on that.
library/std/Cargo.toml
Outdated
@@ -139,7 +139,8 @@ test = true | |||
level = "warn" | |||
check-cfg = [ | |||
'cfg(bootstrap)', | |||
'cfg(target_arch, values("xtensa"))', | |||
'cfg(target_arch, values("xtensa", "aarch64-unknown-nto-qnx710_iosock"))', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...this seems incorrect?
Some("ARM64 QNX Neutrino 7.1 RTOS with io-sock network stack".into()); | ||
target.options.pre_link_args = | ||
nto_qnx::pre_link_args(nto_qnx::ApiVariant::IoSock, nto_qnx::Arch::Aarch64); | ||
target.options.env = "nto71_iosock".into(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it is almost a misuse of the field but we could use the target_abi
for the iosock
distinction, or a target_family
even? All of these targets are slightly Wrong, because they should be using os_version_min
instead, but as that is an RFC and not implemented yet, and thus these targets are defined by crude hackery, I feel like some more crude hackery might be acceptable? It seems incorrect to have to #[cfg(any(target_env = "nto71", target_env = "nto71_iosock"))]
everywhere the iosock change doesn't matter.
``` | ||
```toml | ||
profile = "compiler" | ||
change-id = 115898 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I usually just use
change-id = 999999
.unwrap_or_else(|_| "QNX_TARGET_not_set_please_source_qnxsdp-env.sh".into()); | ||
let linker_param = format!("-L{target_dir}/{arch_lib_dir}/io-sock/lib"); | ||
|
||
linker_param.leak() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing this is not necessarily in-scope for this PR, but
linker_param.leak() | |
// FIXME: leaking this is kind of weird: we're feeding these into something that expects an `AsRef<OsStr>`, but often converts to `OsString` anyways, so shouldn't we just demand an `OsString`? | |
linker_param.leak() |
llvm_target: "x86_64-pc-unknown".into(), | ||
metadata: meta(), | ||
pointer_width: 64, | ||
data_layout: | ||
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(), | ||
arch: "x86_64".into(), | ||
options: TargetOptions { | ||
cpu: "x86-64".into(), | ||
plt_by_default: false, | ||
max_atomic_width: Some(64), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does QNX really support AMD Phenoms?
Changes of this pull request:
Refactor code for qnx nto targets to share more code in file
nto_qnx.rs
Add support for an additional network stack on nto qnx 7.1.
QNX 7.1 supports two network stacks:
io-pkt
, which is defaultio-sock
, which is optional on 7.1 but default in QNX 8.0As one can see in the io-sock migration notes, this changes the libc API in a way similar to e.g. linux-gnu vs. linux-musl.
This change adds a new target which has a different value for
target_env
, so that e.g. libc can distinguish between both APIs.Add initial support for QNX 8.0, thanks @AkhilTThomas. As it turned out, the problem with forking many processes still exists in QNX 8.0. Because if this, we are now using it for any QNX version (i.e. not check for
target_env
anymore).@rustbot label +O-neutrino
CC: @jonathanpallant @japaric @gh-tr @AkhilTThomas