qemu-user fails with big-endian & shared libs on Debian buster
I try to execute foreign binaries with qemu-user on a Debian
buster/amd64 system.
Just for the fun (and somewhat checking of portability of some
programs) I have installed numerous cross-compilers for the following
systems:
m68k-linux-gnu mips64-linux-gnuabi64 powerpc-linux-gnu
arm-linux-gnueabi mips64el-linux-gnuabi64 powerpc64-linux-gnu
aarch64-linux-gnu mips-linux-gnu sparc64-linux-gnu
riscv64-linux-gnu mipsel-linux-gnu alpha-linux-gnu
sh4-linux-gnu
I compile and try to run some C programs using all these compilers and
qemu-<arch>. I do this using the binfmt_misc kernel module, i.e. I
start the compiled binaries directly as
QEMU_LD_PREFIX=/usr/<arch>-linux-gnu ./foo-<arch>
This has always worked with all statically linked binaries for the
foreign architecture and with all dynamically linked binaries for
little-endian architectures, but not with dynamically linked binaries
for big-endian architectures. I haven't tried this for a couple of
weeks, but then 1 or 2 weeks ago I tried again, and, suddenly, this
worked for all binaries, statically and dynamically linked,
little-endian and big-endian binaries. I'm not aware of any changes,
except maybe, the usual aptitude update && aptitude full-upgrade once
in a while. I may have rebooted, also, I can't remember.
Then I changed the GRUB config, i.e. added syscall.x32=y to the kernel
command line and rebooted. Now, I have the same problems with qemu as
described above:
$ QEMU_LD_PREFIX=/usr/mipsel-linux-gnu ./hello-mipsel-static
hello, world.
$ QEMU_LD_PREFIX=/usr/mipsel-linux-gnu ./hello-mipsel
hello, world.
$ QEMU_LD_PREFIX=/usr/mips-linux-gnu ./hello-mips-static
hello, world.
$ QEMU_LD_PREFIX=/usr/mips-linux-gnu ./hello-mips
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault
I have tried removing the kernel command-line argument again and
reboot, but without success. I cannot configure, reboot, or do
anything to make dynamically linked big-endian binaries run with
qemu-user again. I simply don't know, what this depends on.
Can anyone help with this?
BTW, the Debian buster/amd64 system is itself a virtual machine on a
host running Debian stretch/amd64 and kvm, which is a script calling
qemu-system-x86_64 -enable-kvm.
Steve
Reply to: