Add QNX NTO platform support by nyurik · Pull Request #648 · rust-lang/backtrace-rs (original) (raw)

nyurik

Part of adding aarch64-unknown-nto-qnx700 support to Rust. This will resolve the following failing unit tests:

[ui] tests/ui/backtrace/backtrace.rs
[ui] tests/ui/backtrace/dylib-dep.rs
[ui] tests/ui/backtrace/line-tables-only.rs
[ui] tests/ui/backtrace/std-backtrace.rs
[ui] tests/ui/panics/issue-47429-short-backtraces.rs#legacy
[ui] tests/ui/panics/issue-47429-short-backtraces.rs#v0
[ui] tests/ui/panics/runtime-switch.rs#legacy
[ui] tests/ui/panics/runtime-switch.rs#v0
[ui] tests/ui/panics/short-ice-remove-middle-frames-2.rs
[ui] tests/ui/panics/short-ice-remove-middle-frames.rs
[ui] tests/ui/runtime/backtrace-debuginfo.rs

workingjubilee

Comment on lines 40 to 43

// On `QNX-NTO` platform, info is a const pointer
unsafe extern "C" fn callback(
info: *mut libc::dl_phdr_info,
#[cfg(not(target_os = "nto"))] info: *mut libc::dl_phdr_info,
#[cfg(target_os = "nto")] info: *const libc::dl_phdr_info,

Choose a reason for hiding this comment

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

...why?

Choose a reason for hiding this comment

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

@workingjubilee because otherwise compiler complains that the declaration in the Rust code does not match C header files. I had to make this change in order to get it to compile, which resulted in stack traces to start working on QNX. 🤷

Choose a reason for hiding this comment

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

which compiler?

Choose a reason for hiding this comment

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

rustc can't read a C header file, and the C compilers don't know how to read Rust code, so what's actually emitting the error?

Choose a reason for hiding this comment

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

@workingjubilee I suspect libc crate actually runs bindgen, and this is where it breaks. I am doing the steps I described here, and if i revert these specific lines, I get this error while building a compiler.

P.S. I am using the compiler and the headers that ship with QNX 7.0

error[E0308]: mismatched types
   --> library/std/src/../../backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs:15:36
    |
15  |         libc::dl_iterate_phdr(Some(callback), core::ptr::addr_of_mut!(ret).cast());
    |                               ---- ^^^^^^^^ types differ in mutability
    |                               |
    |                               arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(*const dl_phdr_info, _, _) -> _`
                  found fn item `unsafe extern "C" fn(*mut dl_phdr_info, _, _) -> _ {callback}`
help: the type constructed contains `unsafe extern "C" fn(*mut dl_phdr_info, usize, *mut libc::c_void) -> i32 {callback}` due to the type of the argument passed
   --> library/std/src/../../backtrace/src/symbolize/gimli/libs_dl_iterate_phdr.rs:15:31
    |
15  |         libc::dl_iterate_phdr(Some(callback), core::ptr::addr_of_mut!(ret).cast());
    |                               ^^^^^--------^
    |                                    |
    |                                    this argument influences the type of `Some`
note: tuple variant defined here
   --> /home/nyurik/dev/rust/rust/library/core/src/option.rs:579:5
    |
579 |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     ^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `std` (lib) due to 1 previous error
Build completed unsuccessfully in 0:07:01

Choose a reason for hiding this comment

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

I'm surprised to learn that *const T and *mut T are ABI compatible, this would have saved me some work when implementing the libc and abstraction layers.
However, I'm not sure if I would have walked this way: I agree with @nyurik that the C header files are the source of truth and that the libc crate should define the same functions with exact same signatures as their C counterpart. In my opinion, it is the job of the abstraction layers to abstract from such differences.

As for staying compatible with the 2 years old QNX introduction: I would not mind changing it in an incompatible way to e.g. match the C counterpart, i.e. to fix a discrepancy between libc-crate and libc-header. But changing it so that it is deviating sounds more like introducing a bug.

I don't think that there are more than a few dozens Rust@QNX users out there, and the number of those who are using dl_iterate_phdr should be near to 2 ...

Choose a reason for hiding this comment

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

I think there are likely to be approximately zero users of this API in libc on QNX, such that changing libc to use *mut on QNX (matching other platforms) will not in practice break anyone. And better to normalize in libc than in every user of libc.

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

@workingjubilee thx, see rust-lang/libc#3792 - there are some CI issues with libc, but once resolved, @joshtriplett is ok to merge (and hopefully release soon). Hopefully we can resolve this soon thereafter.

One question - since this change will only be in libc 0.2.156+, this PR will have to also bump Cargo.toml's minimal libc to that same version. Is this how you want to proceed with this PR?

Choose a reason for hiding this comment

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

Yes, bumping to that libc is fine.

nyurik added a commit to nyurik/libc that referenced this pull request

Aug 5, 2024

@nyurik

All other platforms use * mut, and while this is technically a breaking change, most likely noone is using it directly.

See also rust-lang/backtrace-rs#648

nyurik added a commit to nyurik/libc that referenced this pull request

Aug 13, 2024

@nyurik

All other platforms use * mut, and while this is technically a breaking change, most likely noone is using it directly.

See also rust-lang/backtrace-rs#648

nyurik added a commit to nyurik/libc that referenced this pull request

Aug 13, 2024

@nyurik

nyurik added a commit to nyurik/libc that referenced this pull request

Aug 13, 2024

@nyurik

tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request

Aug 13, 2024

@nyurik @tgross35

@nyurik

@workingjubilee thx for all the feedback, libc 0.2.156 just released with the consistent backtrace on QNX. I updated this PR to use it.

@nyurik

@nyurik

workingjubilee

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 29, 2024

@bors

add aarch64_unknown_nto_qnx700 target - QNX 7.0 support for aarch64le

This backports the QNX 7.1 aarch64 implementation to 7.0.

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the initial implementation: @flba-eb, @gh-tr, @jonathanpallant, @japaric

Compile target

# Configure qcc build environment
source _path_/_to_/qnx7.0/qnxsdp-env.sh

# Tell rust to use qcc when building QNX 7.0 targets
export build_env='
    CC_aarch64-unknown-nto-qnx700=qcc
    CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
    CXX_aarch64-unknown-nto-qnx700=qcc
    AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'

# Build rust compiler, libs, and the remote test server
env $build_env ./x.py build \
  --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1

Compile "hello world"

source _path_/_to_/qnx7.0/qnxsdp-env.sh

cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700

Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds.

# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying --bind param actually fixes that, and so does setting TMPDIR properly.

# Copy remote-test-server to remote device. You may need to use sftp instead.
# ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/

# Run ssh with port forwarding - so that rust tester can connect to the local port instead
ssh -L 12345:127.0.0.1:12345 qnxdevice

# on the device, run
rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345

Run test suit

Assume all previous environment variables are still set, or re-init them

export TEST_DEVICE_ADDR="localhost:12345"

# tidy needs to be skipped due to using un-published libc dependency
export exclude_tests='
    --exclude src/bootstrap
    --exclude src/tools/error_index_generator
    --exclude src/tools/linkchecker
    --exclude src/tools/tidy
    --exclude tests/ui-fulldeps
    --exclude rustc
    --exclude rustdoc
    --exclude tests/run-make-fulldeps'

env <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mi>u</mi><mi>i</mi><mi>l</mi><msub><mi>d</mi><mi>e</mi></msub><mi>n</mi><mi>v</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi><mi>x</mi><mi mathvariant="normal">.</mi><mi>p</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">build_env ./x.py test  </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal">u</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">./</span><span class="mord mathnormal">x</span><span class="mord">.</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">es</span><span class="mord mathnormal">t</span></span></span></span>exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 29, 2024

@bors

add aarch64_unknown_nto_qnx700 target - QNX 7.0 support for aarch64le

This backports the QNX 7.1 aarch64 implementation to 7.0.

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the initial implementation: @flba-eb, @gh-tr, @jonathanpallant, @japaric

Compile target

# Configure qcc build environment
source _path_/_to_/qnx7.0/qnxsdp-env.sh

# Tell rust to use qcc when building QNX 7.0 targets
export build_env='
    CC_aarch64-unknown-nto-qnx700=qcc
    CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
    CXX_aarch64-unknown-nto-qnx700=qcc
    AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'

# Build rust compiler, libs, and the remote test server
env $build_env ./x.py build \
  --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1

Compile "hello world"

source _path_/_to_/qnx7.0/qnxsdp-env.sh

cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700

Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds.

# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying --bind param actually fixes that, and so does setting TMPDIR properly.

# Copy remote-test-server to remote device. You may need to use sftp instead.
# ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/

# Run ssh with port forwarding - so that rust tester can connect to the local port instead
ssh -L 12345:127.0.0.1:12345 qnxdevice

# on the device, run
rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345

Run test suit

Assume all previous environment variables are still set, or re-init them

export TEST_DEVICE_ADDR="localhost:12345"

# tidy needs to be skipped due to using un-published libc dependency
export exclude_tests='
    --exclude src/bootstrap
    --exclude src/tools/error_index_generator
    --exclude src/tools/linkchecker
    --exclude src/tools/tidy
    --exclude tests/ui-fulldeps
    --exclude rustc
    --exclude rustdoc
    --exclude tests/run-make-fulldeps'

env <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mi>u</mi><mi>i</mi><mi>l</mi><msub><mi>d</mi><mi>e</mi></msub><mi>n</mi><mi>v</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi><mi>x</mi><mi mathvariant="normal">.</mi><mi>p</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">build_env ./x.py test  </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal">u</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">./</span><span class="mord mathnormal">x</span><span class="mord">.</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">es</span><span class="mord mathnormal">t</span></span></span></span>exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request

Aug 30, 2024

@workingjubilee

add aarch64_unknown_nto_qnx700 target - QNX 7.0 support for aarch64le

This backports the QNX 7.1 aarch64 implementation to 7.0.

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the initial implementation: @flba-eb, @gh-tr, @jonathanpallant, @japaric

Compile target

# Configure qcc build environment
source _path_/_to_/qnx7.0/qnxsdp-env.sh

# Tell rust to use qcc when building QNX 7.0 targets
export build_env='
    CC_aarch64-unknown-nto-qnx700=qcc
    CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
    CXX_aarch64-unknown-nto-qnx700=qcc
    AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'

# Build rust compiler, libs, and the remote test server
env $build_env ./x.py build \
  --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1

Compile "hello world"

source _path_/_to_/qnx7.0/qnxsdp-env.sh

cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700

Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds.

# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying --bind param actually fixes that, and so does setting TMPDIR properly.

# Copy remote-test-server to remote device. You may need to use sftp instead.
# ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/

# Run ssh with port forwarding - so that rust tester can connect to the local port instead
ssh -L 12345:127.0.0.1:12345 qnxdevice

# on the device, run
rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345

Run test suit

Assume all previous environment variables are still set, or re-init them

export TEST_DEVICE_ADDR="localhost:12345"

# tidy needs to be skipped due to using un-published libc dependency
export exclude_tests='
    --exclude src/bootstrap
    --exclude src/tools/error_index_generator
    --exclude src/tools/linkchecker
    --exclude src/tools/tidy
    --exclude tests/ui-fulldeps
    --exclude rustc
    --exclude rustdoc
    --exclude tests/run-make-fulldeps'

env <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mi>u</mi><mi>i</mi><mi>l</mi><msub><mi>d</mi><mi>e</mi></msub><mi>n</mi><mi>v</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi><mi>x</mi><mi mathvariant="normal">.</mi><mi>p</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">build_env ./x.py test  </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal">u</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">./</span><span class="mord mathnormal">x</span><span class="mord">.</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">es</span><span class="mord mathnormal">t</span></span></span></span>exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 30, 2024

@bors

add aarch64_unknown_nto_qnx700 target - QNX 7.0 support for aarch64le

This backports the QNX 7.1 aarch64 implementation to 7.0.

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the initial implementation: @flba-eb, @gh-tr, @jonathanpallant, @japaric

Compile target

# Configure qcc build environment
source _path_/_to_/qnx7.0/qnxsdp-env.sh

# Tell rust to use qcc when building QNX 7.0 targets
export build_env='
    CC_aarch64-unknown-nto-qnx700=qcc
    CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
    CXX_aarch64-unknown-nto-qnx700=qcc
    AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'

# Build rust compiler, libs, and the remote test server
env $build_env ./x.py build \
  --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1

Compile "hello world"

source _path_/_to_/qnx7.0/qnxsdp-env.sh

cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700

Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds.

# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying --bind param actually fixes that, and so does setting TMPDIR properly.

# Copy remote-test-server to remote device. You may need to use sftp instead.
# ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/

# Run ssh with port forwarding - so that rust tester can connect to the local port instead
ssh -L 12345:127.0.0.1:12345 qnxdevice

# on the device, run
rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345

Run test suit

Assume all previous environment variables are still set, or re-init them

export TEST_DEVICE_ADDR="localhost:12345"

# tidy needs to be skipped due to using un-published libc dependency
export exclude_tests='
    --exclude src/bootstrap
    --exclude src/tools/error_index_generator
    --exclude src/tools/linkchecker
    --exclude src/tools/tidy
    --exclude tests/ui-fulldeps
    --exclude rustc
    --exclude rustdoc
    --exclude tests/run-make-fulldeps'

env <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mi>u</mi><mi>i</mi><mi>l</mi><msub><mi>d</mi><mi>e</mi></msub><mi>n</mi><mi>v</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi><mi>x</mi><mi mathvariant="normal">.</mi><mi>p</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">build_env ./x.py test  </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal">u</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">./</span><span class="mord mathnormal">x</span><span class="mord">.</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">es</span><span class="mord mathnormal">t</span></span></span></span>exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700

try-job: dist-x86_64-msvc

bors added a commit to rust-lang-ci/rust that referenced this pull request

Sep 1, 2024

@bors

add aarch64_unknown_nto_qnx700 target - QNX 7.0 support for aarch64le

This backports the QNX 7.1 aarch64 implementation to 7.0.

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the initial implementation: @flba-eb, @gh-tr, @jonathanpallant, @japaric

Compile target

# Configure qcc build environment
source _path_/_to_/qnx7.0/qnxsdp-env.sh

# Tell rust to use qcc when building QNX 7.0 targets
export build_env='
    CC_aarch64-unknown-nto-qnx700=qcc
    CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
    CXX_aarch64-unknown-nto-qnx700=qcc
    AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'

# Build rust compiler, libs, and the remote test server
env $build_env ./x.py build \
  --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1

Compile "hello world"

source _path_/_to_/qnx7.0/qnxsdp-env.sh

cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700

Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds.

# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying --bind param actually fixes that, and so does setting TMPDIR properly.

# Copy remote-test-server to remote device. You may need to use sftp instead.
# ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/

# Run ssh with port forwarding - so that rust tester can connect to the local port instead
ssh -L 12345:127.0.0.1:12345 qnxdevice

# on the device, run
rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345

Run test suit

Assume all previous environment variables are still set, or re-init them

export TEST_DEVICE_ADDR="localhost:12345"

# tidy needs to be skipped due to using un-published libc dependency
export exclude_tests='
    --exclude src/bootstrap
    --exclude src/tools/error_index_generator
    --exclude src/tools/linkchecker
    --exclude src/tools/tidy
    --exclude tests/ui-fulldeps
    --exclude rustc
    --exclude rustdoc
    --exclude tests/run-make-fulldeps'

env <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mi>u</mi><mi>i</mi><mi>l</mi><msub><mi>d</mi><mi>e</mi></msub><mi>n</mi><mi>v</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi><mi>x</mi><mi mathvariant="normal">.</mi><mi>p</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">build_env ./x.py test  </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal">u</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">./</span><span class="mord mathnormal">x</span><span class="mord">.</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">es</span><span class="mord mathnormal">t</span></span></span></span>exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700

try-job: dist-x86_64-msvc

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request

Sep 2, 2024

@bors

add aarch64_unknown_nto_qnx700 target - QNX 7.0 support for aarch64le

This backports the QNX 7.1 aarch64 implementation to 7.0.

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the initial implementation: @flba-eb, @gh-tr, @jonathanpallant, @japaric

Compile target

# Configure qcc build environment
source _path_/_to_/qnx7.0/qnxsdp-env.sh

# Tell rust to use qcc when building QNX 7.0 targets
export build_env='
    CC_aarch64-unknown-nto-qnx700=qcc
    CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
    CXX_aarch64-unknown-nto-qnx700=qcc
    AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'

# Build rust compiler, libs, and the remote test server
env $build_env ./x.py build \
  --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1

Compile "hello world"

source _path_/_to_/qnx7.0/qnxsdp-env.sh

cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700

Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds.

# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying --bind param actually fixes that, and so does setting TMPDIR properly.

# Copy remote-test-server to remote device. You may need to use sftp instead.
# ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/

# Run ssh with port forwarding - so that rust tester can connect to the local port instead
ssh -L 12345:127.0.0.1:12345 qnxdevice

# on the device, run
rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345

Run test suit

Assume all previous environment variables are still set, or re-init them

export TEST_DEVICE_ADDR="localhost:12345"

# tidy needs to be skipped due to using un-published libc dependency
export exclude_tests='
    --exclude src/bootstrap
    --exclude src/tools/error_index_generator
    --exclude src/tools/linkchecker
    --exclude src/tools/tidy
    --exclude tests/ui-fulldeps
    --exclude rustc
    --exclude rustdoc
    --exclude tests/run-make-fulldeps'

env <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mi>u</mi><mi>i</mi><mi>l</mi><msub><mi>d</mi><mi>e</mi></msub><mi>n</mi><mi>v</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi><mi>x</mi><mi mathvariant="normal">.</mi><mi>p</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">build_env ./x.py test  </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal">u</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">./</span><span class="mord mathnormal">x</span><span class="mord">.</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">es</span><span class="mord mathnormal">t</span></span></span></span>exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700

try-job: dist-x86_64-msvc

ConradIrwin referenced this pull request in zed-industries/zed

Sep 19, 2024

@renovate

lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request

Sep 25, 2024

@bors

add aarch64_unknown_nto_qnx700 target - QNX 7.0 support for aarch64le

This backports the QNX 7.1 aarch64 implementation to 7.0.

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the initial implementation: @flba-eb, @gh-tr, @jonathanpallant, @japaric

Compile target

# Configure qcc build environment
source _path_/_to_/qnx7.0/qnxsdp-env.sh

# Tell rust to use qcc when building QNX 7.0 targets
export build_env='
    CC_aarch64-unknown-nto-qnx700=qcc
    CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
    CXX_aarch64-unknown-nto-qnx700=qcc
    AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'

# Build rust compiler, libs, and the remote test server
env $build_env ./x.py build \
  --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1

Compile "hello world"

source _path_/_to_/qnx7.0/qnxsdp-env.sh

cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700

Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds.

# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying --bind param actually fixes that, and so does setting TMPDIR properly.

# Copy remote-test-server to remote device. You may need to use sftp instead.
# ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason
scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server  qnxdevice:/path/

# Run ssh with port forwarding - so that rust tester can connect to the local port instead
ssh -L 12345:127.0.0.1:12345 qnxdevice

# on the device, run
rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345

Run test suit

Assume all previous environment variables are still set, or re-init them

export TEST_DEVICE_ADDR="localhost:12345"

# tidy needs to be skipped due to using un-published libc dependency
export exclude_tests='
    --exclude src/bootstrap
    --exclude src/tools/error_index_generator
    --exclude src/tools/linkchecker
    --exclude src/tools/tidy
    --exclude tests/ui-fulldeps
    --exclude rustc
    --exclude rustdoc
    --exclude tests/run-make-fulldeps'

env <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mi>u</mi><mi>i</mi><mi>l</mi><msub><mi>d</mi><mi>e</mi></msub><mi>n</mi><mi>v</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">/</mi><mi>x</mi><mi mathvariant="normal">.</mi><mi>p</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">build_env ./x.py test  </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal">u</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord">./</span><span class="mord mathnormal">x</span><span class="mord">.</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">es</span><span class="mord mathnormal">t</span></span></span></span>exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700

try-job: dist-x86_64-msvc