RE: [qemu-hexagon] Error mapping file: Invalid argument

2021-09-13 Thread Waksmanski, Lukasz
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  
Sent: poniedziałek, 13 września 2021 22:53
To: Philippe Mathieu-Daudé ; Waksmanski, Lukasz 
; qemu-devel@nongnu.org
Cc: Taylor Simpson 
Subject: RE: [qemu-hexagon] Error mapping file: Invalid argument

> -Original Message-
> From: Philippe Mathieu-Daudé  On 
> Behalf Of Philippe Mathieu-Daudé
> Sent: Monday, September 13, 2021 3:19 PM
> To: Waksmanski, Lukasz ; qemu- 
> de...@nongnu.org
> Cc: Taylor Simpson ; Brian Cain 
> 
> 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


[qemu-hexagon] Error mapping file: Invalid argument

2021-09-13 Thread Waksmanski, Lukasz
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
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  TypeAddress  OffSize   ES Flg Lk Inf Al
  [ 0]   NULL 00 00 00  0   0  0
  [ 1] .startPROGBITS 001000 004680 00 WAX  0   0 64
  [ 2] .init PROGBITS5000 006000 64 00  AX  0   0 32
  [ 3] .text PROGBITS6000 007000 005a88 00  AX  0   0 
4096
  [ 4] .fini PROGBITSbaa0 00caa0 30 00  AX  0   0 32
  [ 5] .rodata   PROGBITSbad0 00cad0 000678 00   A  0   0  8
  [ 6] .eh_frame PROGBITSc160 00d160 04 00   A  0   0 32
  [ 7] .data PROGBITSd000 00e000 000708 00  WA  0   0  8
  [ 8] .ctorsPROGBITSd708 00e708 10 00  WA  0   0  4
  [ 9] .dtorsPROGBITSd718 00e718 14 00  WA  0   0  4
  [10] .sdataPROGBITSe000 00f000 a8 00 WAp  0   0 
4096
  [11] .bss  NOBITS  e0a8 00f0a8 000e5c 00  WA  0   0  8
  [12] .comment  PROGBITS 00f0a8 d4 00  MS  0   0  1
  [13] .shstrtab STRTAB   00f17c 6f 00  0   0  1
  [14] .symtab   SYMTAB   00f1ec 0024e0 10 15 248  4
  [15] .strtab   STRTAB   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  |  
lukasz.waksman...@dolby.com