qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] s390x user-mode working example


From: Alex Kashchenko
Subject: Re: [Qemu-discuss] s390x user-mode working example
Date: Fri, 24 Nov 2017 11:16:21 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 11/24/2017 10:14 AM, Peter Maydell wrote:
On 23 November 2017 at 21:00, Alex Kashchenko <address@hidden> wrote:
Hi,

I am trying to build qemu-s390x-user static binary to run a hello-world
program cross-compiled with gcc-s390x-linux-gnu on linux_x86_64.

I am building qemu with:

./configure --static --disable-werror --target-list=s390x-linux-user
make

and running example with:

QEMU_STRACE=1 ./s390x-linux-user/qemu-s390x path/to/s390x-hello

I tried latest git and a number of v2.x releases without success. Can see
either hang (on first brk call) or various errors for newer versions and
"Illegal instruction" for older ones. Tried on ubuntu 16.04 and 17.10
without success.

The same steps worked for me for ppc64le hello-world.

Any help on this is highly appreciated.

Is your target binary statically linked? If not you'll need
to tell QEMU where the libraries are, or run it in a chroot
with the s390x libraries etc.

No, it is not statically linked, on ubuntu I am installing multiarch packet libc6:s390x (goes to /lib/s390x-linux-gnu/libc.so.6 ) for it as a dependency.

(You'll also need to make sure
it doesn't pick up the x86 /etc/ld.so.cache, because a glibc
bug means a bigendian dynamic linker crashes when it finds
a littleendian ld.so.cache, whereas same-endian-wrong-arch
just ignores it.)

That was it, on a git master build:

$ QEMU_STRACE=1 ./qemu/s390x-linux-user/qemu-s390x ./a.out
4654 brk(NULL) = 0x0000004000003000
4654 uname(0x4000803102) = 0
4654 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory) 4654 mmap(0x00000040008030e8,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0x82a168) = 0x000000400082b000 4654 access("/etc/ld.so.preload",R_OK) = -1 errno=2 (No such file or directory)
4654 open("/etc/ld.so.cache",O_RDONLY|O_CLOEXEC) = 3
4654 fstat(3,0x00000040008027d0) = 0
4654 mmap(0x00000040008026f8,25873,PROT_READ,MAP_PRIVATE,3,0x829098) = 0x000000400082d000
4654 close(3) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=1, si_addr=0x000000409088d000} ---
Segmentation fault (core dumped)


Simple example now works fine for me if I delete /etc/ld.so.cache before running it.

Thanks for your help!

--
-Alex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]