Received: from eggs.gnu.org ([208.118.235.92]:49556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScjnS-0002u4-Cw for qemu-devel@nongnu.org; Thu, 07 Jun 2012 16:59:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ScjnQ-0006Od-67 for qemu-devel@nongnu.org; Thu, 07 Jun 2012 16:59:09 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:59163) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScjnQ-0006O3-03 for qemu-devel@nongnu.org; Thu, 07 Jun 2012 16:59:08 -0400 From: Meador Inge Date: Thu, 7 Jun 2012 15:59:02 -0500 Message-ID: <1339102742-4584-2-git-send-email-meadori@codesourcery.com> In-Reply-To: <1339102742-4584-1-git-send-email-meadori@codesourcery.com> References: <1339102742-4584-1-git-send-email-meadori@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [RFC PATCH 1/1] linux-user: Probe the guest base for shared objects when needed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: riku.voipio@iki.fi In some cases when running a shared library directly from QEMU (e.g. ld.so) the guest base should still be probed so that any images loaded later at fixed addresses by the target code can still be mapped. Signed-off-by: Meador Inge --- linux-user/elfload.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index f3b1552..c71c287 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1443,6 +1443,7 @@ static void probe_guest_base(const char *image_name, goto exit_errmsg; } } + have_guest_base = 1; qemu_log("Relocating guest address space from 0x" TARGET_ABI_FMT_lx " to 0x%lx\n", loaddr, real_start); @@ -1528,6 +1529,8 @@ static void load_elf_image(const char *image_name, int image_fd, load_addr = loaddr; if (ehdr->e_type == ET_DYN) { + if (loaddr < mmap_min_addr) + probe_guest_base(image_name, loaddr, hiaddr); /* The image indicates that it can be loaded anywhere. Find a location that can hold the memory space required. If the image is pre-linked, LOADDR will be non-zero. Since we do -- 1.7.7.6