From patchwork Sat Jun 18 22:05:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9185879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96BCD608A2 for ; Sat, 18 Jun 2016 23:06:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83CE627248 for ; Sat, 18 Jun 2016 23:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7856927DA4; Sat, 18 Jun 2016 23:06:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 24DAE2793B for ; Sat, 18 Jun 2016 23:06:29 +0000 (UTC) Received: from localhost ([::1]:36703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEPJs-0005tl-7W for patchwork-qemu-devel@patchwork.kernel.org; Sat, 18 Jun 2016 19:06:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEOMd-0004qF-Th for qemu-devel@nongnu.org; Sat, 18 Jun 2016 18:05:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEOMZ-0000N8-6n for qemu-devel@nongnu.org; Sat, 18 Jun 2016 18:05:15 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEOMY-0000Ic-Vv for qemu-devel@nongnu.org; Sat, 18 Jun 2016 18:05:11 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]) by orth.archaic.org.uk with esmtp (Exim 4.84_2) (envelope-from ) id 1bEOMQ-0000Rp-OB; Sat, 18 Jun 2016 23:05:02 +0100 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1bEOMQ-0004si-Na; Sat, 18 Jun 2016 23:05:02 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Sat, 18 Jun 2016 23:05:01 +0100 Message-Id: <1466287502-18730-2-git-send-email-pmaydell@chiark.greenend.org.uk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1466287502-18730-1-git-send-email-pmaydell@chiark.greenend.org.uk> References: <1466287502-18730-1-git-send-email-pmaydell@chiark.greenend.org.uk> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 X-Mailman-Approved-At: Sat, 18 Jun 2016 19:06:07 -0400 Subject: [Qemu-devel] [PATCH 1/2] configure: Improve usermode relocation linker option probe X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , patches@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Maydell The probe we do to determine what flags to use to make the usermode executables use a non-default text address has some flaws: * we run it even if we're not building the user binaries * we don't expect "ld --verbose" to fail The combination of these two results in a harmless but ugly "ld: unknown option: --verbose" message when running configure on OSX. Improve the probe to only run when we need it and to fail nicely when even the backstop 'ld --verbose' approach fails. Reported-by: Stefan Weil Signed-off-by: Peter Maydell Reviewed-by: Stefan Weil --- configure | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 10cb212..7beefcd 100755 --- a/configure +++ b/configure @@ -4700,7 +4700,7 @@ if test "$cpu" = "s390x" ; then fi # Probe for the need for relocating the user-only binary. -if test "$pie" = "no" ; then +if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then textseg_addr= case "$cpu" in arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) @@ -4722,6 +4722,16 @@ EOF # In case ld does not support -Ttext-segment, edit the default linker # script via sed to set the .text start addr. This is needed on FreeBSD # at least. + if ! $ld --verbose >/dev/null 2>&1; then + error_exit \ + "We need to link the QEMU user mode binaries at a" \ + "specific text address. Unfortunately your linker" \ + "doesn't support either the -Ttext-segment option or" \ + "printing the default linker script with --verbose." \ + "If you don't want the user mode binaries, pass the" \ + "--disable-user option to configure." + fi + $ld --verbose | sed \ -e '1,/==================================================/d' \ -e '/==================================================/,$d' \