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-12-27 17:33:37 +0900
commit581633a2b8e21c508a731b117e7a7e5ddc2d4066 (patch)
tree13e19e1fc31919c0ed44e373b2953ded7f8f76ba
parent9053100e4b766d52ba58bd65ece3360cbdcd4b3d (diff)
downloadqemu-581633a2b8e21c508a731b117e7a7e5ddc2d4066.tar.gz
qemu-581633a2b8e21c508a731b117e7a7e5ddc2d4066.tar.bz2
qemu-581633a2b8e21c508a731b117e7a7e5ddc2d4066.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) {