From patchwork Thu Jun 20 13:15:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Maste X-Patchwork-Id: 252924 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 321792C02A8 for ; Thu, 20 Jun 2013 23:16:35 +1000 (EST) Received: from localhost ([::1]:54830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upej2-0001le-VI for incoming@patchwork.ozlabs.org; Thu, 20 Jun 2013 09:16:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpeiP-0001jQ-5v for qemu-devel@nongnu.org; Thu, 20 Jun 2013 09:15:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpeiI-0001ls-F6 for qemu-devel@nongnu.org; Thu, 20 Jun 2013 09:15:53 -0400 Received: from [216.171.111.232] (port=13689 helo=freebsd.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpeiH-0001lU-Ho for qemu-devel@nongnu.org; Thu, 20 Jun 2013 09:15:45 -0400 Received: from emaste (uid 1001) (envelope-from emaste@freebsd.org) id 9d046 by freebsd.org (DragonFly Mail Agent 1); Thu, 20 Jun 2013 09:15:44 -0400 From: Ed Maste To: qemu-devel@nongnu.org Date: Thu, 20 Jun 2013 09:15:43 -0400 Message-Id: <1371734143-780-1-git-send-email-emaste@freebsd.org> X-Mailer: git-send-email 1.7.11.5 X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 216.171.111.232 Cc: Ed Maste Subject: [Qemu-devel] [RFT PATCH v2] 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. Note that ldscripts/alpha.ld was already unused prior to this change, as it was handled by the "default placement of the application is fine" case. Signed-off-by: Ed Maste --- Changes from v1: - Drop removal of ldscripts from the patch for now. They remain unused with v2 and can be removed later, but this makes the patch smaller during review and testing. - Don't require knowledge of the default .text address, as suggested by Richard Henderson. - Use configure's existing compile_prog to test for acceptance of the linker flag rather than a hack that fails on current binutils versions. configure | 37 +++++--- diff --git a/configure b/configure index ad32f87..b3025df 100755 --- a/configure +++ b/configure @@ -4072,9 +4072,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 +4434,35 @@ 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 + textseg_addr= case "$ARCH" in - alpha | s390x | aarch64) - # The default placement of the application is fine. + arm | hppa | i386 | ia64 | m68k | ppc | ppc64 | s390 | sparc | sparc64 | x86_64) + textseg_addr=0x60000000 ;; - *) - ldflags="$linker_script $ldflags" + mips) + textseg_addr=0x400000 ;; esac + if [ -n "$textseg_addr" ]; then +cat > $TMPC < config-host.ld + ldflags="$ldflags -Wl,-T../config-host.ld" + fi + fi fi echo "LDFLAGS+=$ldflags" >> $config_target_mak