From patchwork Sat Jun 22 02:10:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 253332 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1D55F2C0405 for ; Sat, 22 Jun 2013 12:11:15 +1000 (EST) Received: from localhost ([::1]:43990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqDIC-0003e4-Vc for incoming@patchwork.ozlabs.org; Fri, 21 Jun 2013 22:11:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqDHy-0003Xf-5X for qemu-devel@nongnu.org; Fri, 21 Jun 2013 22:10:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UqDHv-0003A4-Ep for qemu-devel@nongnu.org; Fri, 21 Jun 2013 22:10:54 -0400 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]:65305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqDHu-00039x-V2 for qemu-devel@nongnu.org; Fri, 21 Jun 2013 22:10:51 -0400 Received: by mail-qc0-f169.google.com with SMTP id c10so5174836qcz.14 for ; Fri, 21 Jun 2013 19:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=/vj2U51OHvIMU5nMhvZnkIR4GAilnBXjPYqq/lwh6Jw=; b=I2H2W9jTV53Xnf6Ig8nheCNg6GQQAsM0Ae9S4tZ+9o/tEaWnrjwYiQBHL9KZSF+Nn+ MfgjYfWmGuvO0DATCoSvBF/6JS8P7n4XQ2SWelp+qXCYuSXptPJVEGT2Gtqf9ma2310S hK1/KJxJrxuQqiUVO0G5Yi16fcgyy+5CeHbBxfMgt/ez5zKaJe1dsFY3Qt5pbLONKw7h OqV+UvnijYfsKnc/ckqwa+3uSr8SpTqL6Y0bIJZl1wmemNs7duOJDt0YN5Toui4HTvtM wZ1HA3Dw0uxmZbzpAbt4aN/l2PUgOAOlcTg91CnQH2vv37j5S4B6lvt0Ecpns0FSLdlM Ymhw== X-Received: by 10.49.71.70 with SMTP id s6mr8206306qeu.66.1371867050597; Fri, 21 Jun 2013 19:10:50 -0700 (PDT) Received: from pebble.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id a8sm9936136qae.11.2013.06.21.19.10.48 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 21 Jun 2013 19:10:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 21 Jun 2013 19:10:16 -0700 Message-Id: <1371867016-7660-1-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.2.1 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::229 Cc: Ed Maste Subject: [Qemu-devel] [PATCH v3] configure: Simplify alternate .text segment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org For bsd-user and linux-user emulation modes QEMU needs to be linked at an alternate .text segment address, so that it's out of the way of the guest executable. Instead of including modified linker scripts for each arch, just set the address with -Ttext-segment if supported, or by using sed to edit the default linker script. Cc: Ed Maste Signed-off-by: Richard Henderson Acked-by: Ed Maste Signed-off-by: Ed Maste --- configure | 48 +++++++++++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 18 deletions(-) -- Changes v2-v3: * Move the check for textseg_ldflags much earlier in the configure file, so that we've not got cflags invalid for configure time. Plus, the check (and generated ld script) only gets done once, not once per target directory. * Remove ia64 from the hosts that get relocation * Handle s390x like s390. Tested on x86_64, arm, hppa (old binutils needing config-host.ld), sparc64, and ia64. All various versions of linux. r~ diff --git a/configure b/configure index ad32f87..63da418 100755 --- a/configure +++ b/configure @@ -3444,6 +3444,36 @@ if test "$cpu" = "s390x" ; then roms="$roms s390-ccw" fi +# Probe for the need for relocating the user-only binary. +if test "$pie" = "no" ; then + textseg_addr= + case "$cpu" in + arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64) + textseg_addr=0x60000000 + ;; + mips) + textseg_addr=0x400000 + ;; + esac + if [ -n "$textseg_addr" ]; then + cat > $TMPC < config-host.ld + textseg_ldflags="-Wl,-T../config-host.ld" + fi + fi +fi + # add pixman flags after all config tests are done QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags" libs_softmmu="$libs_softmmu $pixman_libs" @@ -4072,9 +4102,6 @@ if test "$gcov" = "yes" ; then echo "GCOV=$gcov_tool" >> $config_host_mak fi -# generate list of library paths for linker script -$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > config-host.ld - # use included Linux headers if test "$linux" = "yes" ; then mkdir -p linux-headers @@ -4437,21 +4464,8 @@ if test "$gprof" = "yes" ; then fi fi -if test "$ARCH" = "tci"; then - linker_script="" -else - linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/ldscripts/\$(ARCH).ld" -fi - if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then - case "$ARCH" in - alpha | s390x | aarch64) - # The default placement of the application is fine. - ;; - *) - ldflags="$linker_script $ldflags" - ;; - esac + ldflags="$ldflags $textseg_ldflags" fi echo "LDFLAGS+=$ldflags" >> $config_target_mak