All of lore.kernel.org
 help / color / mirror / Atom feed
* [qemu-hexagon] Error mapping file: Invalid argument
@ 2021-09-13 18:38 Waksmanski, Lukasz
  2021-09-13 20:19 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Waksmanski, Lukasz @ 2021-09-13 18:38 UTC (permalink / raw)
  To: qemu-devel

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

Hello,

I’m trying to run Hexagon executables in qemu-hexagon. I’m using official stable version v6.1. Here’s my rather simple program:
➜  ~ cat test.c
#include<stdio.h>
int main()
{  printf("Hello Hexagon!");
  return 0;
}


I’m using  Hexagon SDK 4.0.2 toolchain:
➜  ~ ~/tools/Hexagon4/tools/HEXAGON_Tools/8.4.09/Tools/bin/hexagon-clang -mv67 -o test test.c

Running in qemu produces error somewhere in mmap
➜  ~ qemu-hexagon ./test
qemu-hexagon: ./test: Error mapping file: Invalid argument

Am I doing something naively wrong here?

Here’s  are the some details about the executable
➜  ~ ~/tools/Hexagon4/tools/HEXAGON_Tools/8.4.09/Tools/bin/hexagon-llvm-readelf -h ./test

ELF Header:

  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00

  Class:                             ELF32

  Data:                              2's complement, little endian

  Version:                           1 (current)

  OS/ABI:                            UNIX - System V

  ABI Version:                       0x0

  Type:                              EXEC (Executable file)

  Machine:                           Qualcomm Hexagon

  Version:                           0x1

  Entry point address:               0x0

  Start of program headers:          52 (bytes into file)

  Start of section headers:          78848 (bytes into file)

  Flags:                             0x67, V67

  Size of this header:               52 (bytes)

  Size of program headers:           32 (bytes)

  Number of program headers:         3

  Size of section headers:           40 (bytes)

  Number of section headers:         16

  Section header string table index: 13

Section Headers:
  [Nr] Name              Type            Address  Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .start            PROGBITS        00000000 001000 004680 00 WAX  0   0 64
  [ 2] .init             PROGBITS        00005000 006000 000064 00  AX  0   0 32
  [ 3] .text             PROGBITS        00006000 007000 005a88 00  AX  0   0 4096
  [ 4] .fini             PROGBITS        0000baa0 00caa0 000030 00  AX  0   0 32
  [ 5] .rodata           PROGBITS        0000bad0 00cad0 000678 00   A  0   0  8
  [ 6] .eh_frame         PROGBITS        0000c160 00d160 000004 00   A  0   0 32
  [ 7] .data             PROGBITS        0000d000 00e000 000708 00  WA  0   0  8
  [ 8] .ctors            PROGBITS        0000d708 00e708 000010 00  WA  0   0  4
  [ 9] .dtors            PROGBITS        0000d718 00e718 000014 00  WA  0   0  4
  [10] .sdata            PROGBITS        0000e000 00f000 0000a8 00 WAp  0   0 4096
  [11] .bss              NOBITS          0000e0a8 00f0a8 000e5c 00  WA  0   0  8
  [12] .comment          PROGBITS        00000000 00f0a8 0000d4 00  MS  0   0  1
  [13] .shstrtab         STRTAB          00000000 00f17c 00006f 00      0   0  1
  [14] .symtab           SYMTAB          00000000 00f1ec 0024e0 10     15 248  4
  [15] .strtab           STRTAB          00000000 0116cc 001d19 00      0   0  1


Could you tell me where the problem is? Is it because I’m compiling for QuRT, and qemu uses is linux-user? Or is something else?

Best regards,
Łukasz Waksmański
M +48 668 282 017
www.dolby.com<http://www.dolby.com/>  |  Lukasz.Waksmanski@dolby.com<mailto:Lukasz.Waksmanski@dolby.com>


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

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

* Re: [qemu-hexagon] Error mapping file: Invalid argument
  2021-09-13 18:38 [qemu-hexagon] Error mapping file: Invalid argument Waksmanski, Lukasz
@ 2021-09-13 20:19 ` Philippe Mathieu-Daudé
  2021-09-13 20:53   ` Brian Cain
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-09-13 20:19 UTC (permalink / raw)
  To: Waksmanski, Lukasz, qemu-devel; +Cc: Brian Cain, Taylor Simpson

Cc'ing Hexagon team.

On 9/13/21 8:38 PM, Waksmanski, Lukasz wrote:
> Hello,
> 
>  
> 
> I’m trying to run Hexagon executables in qemu-hexagon. I’m using
> official stable version v6.1. Here’s my rather simple program:
> 
> ➜  ~ cat test.c
> 
> #include<stdio.h>
> 
> int main()
> 
> {  printf("Hello Hexagon!");
> 
>   return 0;
> 
> }
> 
>  
> 
> I’m using  Hexagon SDK 4.0.2 toolchain:
> 
> ➜  ~ ~/tools/Hexagon4/tools/HEXAGON_Tools/8.4.09/Tools/bin/hexagon-clang
> -mv67 -o test test.c
> 
>  
> 
> Running in qemu produces error somewhere in mmap
> 
> ➜  ~ qemu-hexagon
> ./test                                                                    
> 
> qemu-hexagon: ./test: Error mapping file: Invalid argument
> 
>  
> 
> Am I doing something naively wrong here?
> 
>  
> 
> Here’s  are the some details about the executable
> 
> ➜  ~
> ~/tools/Hexagon4/tools/HEXAGON_Tools/8.4.09/Tools/bin/hexagon-llvm-readelf
> -h ./test   
> 
> ELF Header:
> 
>   Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
> 
>   Class:                             ELF32
> 
>   Data:                              2's complement, little endian
> 
>   Version:                           1 (current)
> 
>   OS/ABI:                            UNIX - System V
> 
>   ABI Version:                       0x0
> 
>   Type:                              EXEC (Executable file)
> 
>   Machine:                           Qualcomm Hexagon
> 
>   Version:                           0x1
> 
>   Entry point address:               0x0
> 
>   Start of program headers:          52 (bytes into file)
> 
>   Start of section headers:          78848 (bytes into file)
> 
>   Flags:                             0x67, V67
> 
>   Size of this header:               52 (bytes)
> 
>   Size of program headers:           32 (bytes)
> 
>   Number of program headers:         3
> 
>   Size of section headers:           40 (bytes)
> 
>   Number of section headers:         16
> 
>   Section header string table index: 13
> 
>  
> 
> Section Headers:
> 
>   [Nr] Name              Type            Address  Off    Size   ES Flg
> Lk Inf Al
> 
>   [ 0]                   NULL            00000000 000000 000000 00     
> 0   0  0
> 
>   [ 1] .start            PROGBITS        00000000 001000 004680 00 WAX 
> 0   0 64
> 
>   [ 2] .init             PROGBITS        00005000 006000 000064 00  AX 
> 0   0 32
> 
>   [ 3] .text             PROGBITS        00006000 007000 005a88 00  AX 
> 0   0 4096
> 
>   [ 4] .fini             PROGBITS        0000baa0 00caa0 000030 00  AX 
> 0   0 32
> 
>   [ 5] .rodata           PROGBITS        0000bad0 00cad0 000678 00   A 
> 0   0  8
> 
>   [ 6] .eh_frame         PROGBITS        0000c160 00d160 000004 00   A 
> 0   0 32
> 
>   [ 7] .data             PROGBITS        0000d000 00e000 000708 00  WA 
> 0   0  8
> 
>   [ 8] .ctors            PROGBITS        0000d708 00e708 000010 00  WA 
> 0   0  4
> 
>   [ 9] .dtors            PROGBITS        0000d718 00e718 000014 00  WA 
> 0   0  4
> 
>   [10] .sdata            PROGBITS        0000e000 00f000 0000a8 00 WAp 
> 0   0 4096
> 
>   [11] .bss              NOBITS          0000e0a8 00f0a8 000e5c 00  WA 
> 0   0  8
> 
>   [12] .comment          PROGBITS        00000000 00f0a8 0000d4 00  MS 
> 0   0  1
> 
>   [13] .shstrtab         STRTAB          00000000 00f17c 00006f 00     
> 0   0  1
> 
>   [14] .symtab           SYMTAB          00000000 00f1ec 0024e0 10    
> 15 248  4
> 
>   [15] .strtab           STRTAB          00000000 0116cc 001d19 00     
> 0   0  1
> 
>  
> 
>  
> 
> Could you tell me where the problem is? Is it because I’m compiling for
> QuRT, and qemu uses is linux-user? Or is something else?
> 
>  
> 
> Best regards,
> 
> *Łukasz Waksmański***
> 
> M +48 668 282 017
> 
> www.dolby.com <http://www.dolby.com/>__ |  Lukasz.Waksmanski@dolby.com
> <mailto:Lukasz.Waksmanski@dolby.com>__
> 
>  
> 



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

* RE: [qemu-hexagon] Error mapping file: Invalid argument
  2021-09-13 20:19 ` Philippe Mathieu-Daudé
@ 2021-09-13 20:53   ` Brian Cain
  2021-09-13 21:07     ` Waksmanski, Lukasz
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Cain @ 2021-09-13 20:53 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Waksmanski, Lukasz, qemu-devel
  Cc: Taylor Simpson

> -----Original Message-----
> From: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> On
> Behalf Of Philippe Mathieu-Daudé
> Sent: Monday, September 13, 2021 3:19 PM
> To: Waksmanski, Lukasz <Lukasz.Waksmanski@dolby.com>; qemu-
> devel@nongnu.org
> Cc: Taylor Simpson <tsimpson@quicinc.com>; Brian Cain
> <bcain@quicinc.com>
> Subject: Re: [qemu-hexagon] Error mapping file: Invalid argument
> 
> WARNING: This email originated from outside of Qualcomm. Please be wary of
> any links or attachments, and do not enable macros.
> 
> Cc'ing Hexagon team.
> 
> On 9/13/21 8:38 PM, Waksmanski, Lukasz wrote:
...
> > Running in qemu produces error somewhere in mmap
> >
> > ➜  ~ qemu-hexagon
> > ./test
> >
> > qemu-hexagon: ./test: Error mapping file: Invalid argument
...
> >
> > Could you tell me where the problem is? Is it because I’m compiling for
> > QuRT, and qemu uses is linux-user? Or is something else?

Yes, that's roughly it.

In order to build Linux userspace binaries, you can use the toolchain in the QEMU container or this one https://github.com/quic/toolchain_for_hexagon/releases/tag/v2021.09.10

-Brian

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

* RE: [qemu-hexagon] Error mapping file: Invalid argument
  2021-09-13 20:53   ` Brian Cain
@ 2021-09-13 21:07     ` Waksmanski, Lukasz
  0 siblings, 0 replies; 4+ messages in thread
From: Waksmanski, Lukasz @ 2021-09-13 21:07 UTC (permalink / raw)
  To: Brian Cain, Philippe Mathieu-Daudé, qemu-devel; +Cc: Taylor Simpson

Thanks for pointing me to the toolchain. I'll give it a try to see how it works. 
However, I'm more interested in being able to use qemu-hexagon as shown in my example below (QuRT).
Is it possible? What kind of modifications qemu would require to make it happen?

Cheers, 
Lukasz.

-----Original Message-----
From: Brian Cain <bcain@quicinc.com> 
Sent: poniedziałek, 13 września 2021 22:53
To: Philippe Mathieu-Daudé <f4bug@amsat.org>; Waksmanski, Lukasz <Lukasz.Waksmanski@dolby.com>; qemu-devel@nongnu.org
Cc: Taylor Simpson <tsimpson@quicinc.com>
Subject: RE: [qemu-hexagon] Error mapping file: Invalid argument

> -----Original Message-----
> From: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> On 
> Behalf Of Philippe Mathieu-Daudé
> Sent: Monday, September 13, 2021 3:19 PM
> To: Waksmanski, Lukasz <Lukasz.Waksmanski@dolby.com>; qemu- 
> devel@nongnu.org
> Cc: Taylor Simpson <tsimpson@quicinc.com>; Brian Cain 
> <bcain@quicinc.com>
> Subject: Re: [qemu-hexagon] Error mapping file: Invalid argument
> 
> WARNING: This email originated from outside of Qualcomm. Please be 
> wary of any links or attachments, and do not enable macros.
> 
> Cc'ing Hexagon team.
> 
> On 9/13/21 8:38 PM, Waksmanski, Lukasz wrote:
...
> > Running in qemu produces error somewhere in mmap
> >
> > ➜  ~ qemu-hexagon
> > ./test
> >
> > qemu-hexagon: ./test: Error mapping file: Invalid argument
...
> >
> > Could you tell me where the problem is? Is it because I’m compiling 
> > for QuRT, and qemu uses is linux-user? Or is something else?

Yes, that's roughly it.

In order to build Linux userspace binaries, you can use the toolchain in the QEMU container or this one https://github.com/quic/toolchain_for_hexagon/releases/tag/v2021.09.10

-Brian

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

end of thread, other threads:[~2021-09-13 21:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 18:38 [qemu-hexagon] Error mapping file: Invalid argument Waksmanski, Lukasz
2021-09-13 20:19 ` Philippe Mathieu-Daudé
2021-09-13 20:53   ` Brian Cain
2021-09-13 21:07     ` Waksmanski, Lukasz

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.