summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury Usishchev <y.usishchev@samsung.com>2015-08-05 21:01:01 +0300
committerhyokeun <hyokeun.jeon@samsung.com>2016-09-06 16:00:20 +0900
commita7c617936b9c13fba9efab0755ec095a6e1bf07d (patch)
tree32f8cc3cf018f8e45f274d2d27c24b8eccd7e904
parentf995b02c31b3bbf190d19e5d0062db9349c32542 (diff)
downloadqemu-a7c617936b9c13fba9efab0755ec095a6e1bf07d.tar.gz
qemu-a7c617936b9c13fba9efab0755ec095a6e1bf07d.tar.bz2
qemu-a7c617936b9c13fba9efab0755ec095a6e1bf07d.zip
binfmt: use binaries from /emul
This allows removing hardcoded architecture-dependent paths from qemu-accel package. Also allows using symlinks for qemu-*-binfmt as path don't depend on binary name now. Change-Id: I92b9bc6df477ef925c761045d5307aca8cc1b2d4
-rw-r--r--linux-user/binfmt.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/linux-user/binfmt.c b/linux-user/binfmt.c
index 39b181a4a..2a9009621 100644
--- a/linux-user/binfmt.c
+++ b/linux-user/binfmt.c
@@ -5,11 +5,6 @@
#include <string.h>
#include <stdlib.h>
-#ifdef __x86_64__
-#define ARCH_NAME "x86_64"
-#elif defined __i386__
-#define ARCH_NAME "i586"
-#endif
int main(int argc, char **argv, char **envp)
{
@@ -33,19 +28,12 @@ int main(int argc, char **argv, char **envp)
binfmt[0] = '\0';
/* Now argv[0] is the real qemu binary name */
-#ifdef ARCH_NAME
{
char *hostbin;
- char *guestarch;
int r;
- guestarch = strrchr(argv[0], '-') ;
- if (!guestarch) {
- goto skip;
- }
- guestarch++;
- r = asprintf(&hostbin, "/emul/" ARCH_NAME "-for-%s/%s", guestarch, argv[1]);
- if ((r > 0) && !access(hostbin, X_OK)) {
+ r = asprintf(&hostbin, "/emul/%s", argv[1]);
+ if (!access(hostbin, X_OK) && (r > 0)) {
/*
* We found a host binary replacement for the non-host binary. Let's
* use that instead!
@@ -53,8 +41,6 @@ int main(int argc, char **argv, char **envp)
return execve(hostbin, &argv[2], envp);
}
}
-skip:
-#endif
new_argv = (char **)malloc((argc + 2) * sizeof(*new_argv));
if (argc > 3) {