linux-user: add binfmt wrapper for argv[0] handling
authorAlexander Graf <agraf@suse.de>
Fri, 30 Sep 2011 17:40:36 +0000 (19:40 +0200)
committerChanho Park <parkch98@gmail.com>
Tue, 9 Sep 2014 02:32:49 +0000 (11:32 +0900)
commit05f52e6953984d95c21db1fae829c1040b59ff4f
treea8285cefe04286879810f8528dc93194ad58dbd7
parentf7b23f32360cc0f6742f17da69b611223d0104cc
linux-user: add binfmt wrapper for argv[0] handling

When using qemu's linux-user binaries through binfmt, argv[0] gets lost
along the execution because qemu only gets passed in the full file name
to the executable while argv[0] can be something completely different.

This breaks in some subtile situations, such as the grep and make test
suites.

This patch adds a wrapper binary called qemu-$TARGET-binfmt that can be
used with binfmt's P flag which passes the full path _and_ argv[0] to
the binfmt handler.

The binary would be smart enough to be versatile and only exist in the
system once, creating the qemu binary path names from its own argv[0].
However, this seemed like it didn't fit the make system too well, so
we're currently creating a new binary for each target archictecture.

CC: Reinhard Max <max@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
[AF: Rebased onto new Makefile infrastructure, twice]
[AF: Updated for aarch64 for v2.0.0-rc1]
[AF: Rebased onto Makefile changes for v2.1.0-rc0]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Makefile.target
linux-user/Makefile.objs
linux-user/binfmt.c [new file with mode: 0644]
scripts/qemu-binfmt-conf.sh