All of lore.kernel.org
 help / color / mirror / Atom feed
* Running cross-compiled binary using QEMU results in segmentation fault error
@ 2023-10-11  9:13 Asad Javed
  2023-10-16 13:51 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Asad Javed @ 2023-10-11  9:13 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]

Hi,

We have cross compiled a simple hello world program for QNX SDP 7.1.0 on Ubuntu Focal x86_64. Running the binary using qemu-aarch64 results in segmentation fault error. The qemu-aarch64 version is 5.2.0.

Steps:

1. Source QNX SDP to set some environment variables.

     source ./qnx710/qnxsdp-env.sh

2. The hello-world.c file:

     #include <stdio.h>

     int main(void) {
         return printf("Hello World!");
     }

3. Compiled using the QNX compiler.

      $ qcc -Vgcc_ntoaarch64le -o hello-world hello-world.c

4. Running the binary as it is results to:

      $ ./hello-world
      aarch64-binfmt-P: Could not open '/usr/lib/ldqnx-64.so.2': No such file or directory

5. Running using QEMU emulator results to segmentation fault.

     $ qemu-aarch64 -L /home/vsts/qnx710/target/qnx7/aarch64le ./hello-world
     qemu: uncaught target signal 11 (Segmentation fault) - core dumped
     Segmentation fault (core dumped)


We also tried Ubuntu Jammy which has qemu-aarch64 v6.2.0 but got the same error.
Can you tell us how we can emulate the binary that is built for QNX on x86_64 platform using QEMU emulator? Any help would be much appreciated. Thanks


Thanks & Regards,
-------------------------
Asad Javed

DevOps Engineer
Basemark Oy
Helsinki, Finland
Tel: +358 50 3518175
www.basemark.com<http://www.basemark.com>

[-- Attachment #2: Type: text/html, Size: 10444 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Running cross-compiled binary using QEMU results in segmentation fault error
  2023-10-11  9:13 Running cross-compiled binary using QEMU results in segmentation fault error Asad Javed
@ 2023-10-16 13:51 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2023-10-16 13:51 UTC (permalink / raw)
  To: Asad Javed; +Cc: qemu-devel

On Wed, 11 Oct 2023 at 14:34, Asad Javed <asad.javed@basemark.com> wrote:
> We have cross compiled a simple hello world program for QNX SDP 7.1.0
> on Ubuntu Focal x86_64. Running the binary using qemu-aarch64 results
> in segmentation fault error. The qemu-aarch64 version is 5.2.0.

This is expected. qemu-aarch64 is for running *Linux* userspace
binaries. Trying to run some other kind of binary will not work;
depending on the binary that might include the guest binary
crashing with a segfault, as here.

To run a QNX binary you would need to run the entire QNX OS
as a guest OS under system emulation of some machine type
that both QEMU and QNX support.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-16 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-11  9:13 Running cross-compiled binary using QEMU results in segmentation fault error Asad Javed
2023-10-16 13:51 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.