SHA256
1
0
forked from pool/qemu
qemu/0024-linux-user-binfmt-Force-using-emula.patch

34 lines
1.3 KiB
Diff

From da89f732a99c424c0830c04ce269e679e81e2d8f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 18 Jun 2012 14:15:04 +0200
Subject: [PATCH] linux-user/binfmt: Force using emulation when LIBRARY_PATH
is set
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC ignores LIBRARY_PATH when cross-compiling so we must use emulation
to have it picked up correctly.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
linux-user/binfmt.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/linux-user/binfmt.c b/linux-user/binfmt.c
index 87dc4c6..a1b712d 100644
--- a/linux-user/binfmt.c
+++ b/linux-user/binfmt.c
@@ -42,7 +42,9 @@ int main(int argc, char **argv, char **envp)
}
guestarch++;
asprintf(&hostbin, "/emul/" ARCH_NAME "-for-%s/%s", guestarch, argv[1]);
- if (!access(hostbin, X_OK)) {
+ /* gcc ignores LIBRARY_PATH in its cross variant, so let's not use
+ host binaries when we find it set */
+ if (!access(hostbin, X_OK) && !getenv("LIBRARY_PATH")) {
/*
* We found a host binary replacement for the non-host binary. Let's
* use that instead!