From patchwork Sat Jun 18 22:05:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9185877 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 86CC4607FD 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 68E1527C2D for ; Sat, 18 Jun 2016 23:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49EFB27D45; 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 9F99427248 for ; Sat, 18 Jun 2016 23:06:28 +0000 (UTC) Received: from localhost ([::1]:36702 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEPJp-0005sA-Vh for patchwork-qemu-devel@patchwork.kernel.org; Sat, 18 Jun 2016 19:06:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEOMd-0004q9-JK for qemu-devel@nongnu.org; Sat, 18 Jun 2016 18:05:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEOMY-0000Mz-SF 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-L6 for qemu-devel@nongnu.org; Sat, 18 Jun 2016 18:05:10 -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-0000Rq-OU; 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-0004sn-Nx; Sat, 18 Jun 2016 23:05:02 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Sat, 18 Jun 2016 23:05:02 +0100 Message-Id: <1466287502-18730-3-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:06 -0400 Subject: [Qemu-devel] [PATCH 2/2] configure: Make AVX2 test robust to non-ELF systems 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 AVX2 optimization test assumes that the object format is ELF and the system has the readelf utility. If this isn't true then configure might fail or emit a warning (since in a pipe "foo | bar >/dev/null 2>&1" does not redirect the stderr of foo, only of bar). Adjust the check so that if we don't have readelf or don't have an ELF object then we just don't enable the AVX2 optimization. Reported-by: Stefan Weil Signed-off-by: Peter Maydell Reviewed-by: Stefan Weil --- configure | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 7beefcd..30bca55 100755 --- a/configure +++ b/configure @@ -1792,8 +1792,10 @@ int foo(void *a) __attribute__((ifunc("bar_ifunc"))); int main(int argc, char *argv[]) { return foo(argv[0]);} EOF if compile_object "" ; then - if readelf --syms $TMPO |grep "IFUNC.*foo" >/dev/null 2>&1; then - avx2_opt="yes" + if has readelf; then + if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then + avx2_opt="yes" + fi fi fi