From patchwork Tue Jun 7 09:51:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 9160209 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 84A6F60572 for ; Tue, 7 Jun 2016 09:51:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 774A5264F4 for ; Tue, 7 Jun 2016 09:51:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BA32281D2; Tue, 7 Jun 2016 09:51:27 +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, T_HK_NAME_DR 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 E2857264F4 for ; Tue, 7 Jun 2016 09:51:26 +0000 (UTC) Received: from localhost ([::1]:48193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bADfR-0003RT-M4 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Jun 2016 05:51:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bADfD-0003RO-MC for qemu-devel@nongnu.org; Tue, 07 Jun 2016 05:51:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bADf9-0000mW-FG for qemu-devel@nongnu.org; Tue, 07 Jun 2016 05:51:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bADf9-0000mK-9a for qemu-devel@nongnu.org; Tue, 07 Jun 2016 05:51:07 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D43881125; Tue, 7 Jun 2016 09:51:06 +0000 (UTC) Received: from work-vm (ovpn-116-106.ams2.redhat.com [10.36.116.106]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u579p3ms008942 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 7 Jun 2016 05:51:05 -0400 Date: Tue, 7 Jun 2016 10:51:02 +0100 From: "Dr. David Alan Gilbert" To: Peter Maydell Message-ID: <20160607095102.GB2257@work-vm> References: <1465234520-11160-1-git-send-email-pbonzini@redhat.com> <20160606192219.GB2258@work-vm> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 07 Jun 2016 09:51:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 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: Paolo Bonzini , QEMU Developers Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP * Peter Maydell (peter.maydell@linaro.org) wrote: > On 6 June 2016 at 20:22, Dr. David Alan Gilbert wrote: > > Sigh I see; so the configure test is run with a different set of compiler > > options than the main compiles? How is any configure test supposed to > > check that it's got a sane configuration? > > I wasn't quite right -- we do run configure tests with ccache, we just > force it to not read the cache. So I think your problem is just that > your configure test doesn't fail when run under ccache, even though the > main cutils.c compile does: > > $ cat /tmp/zz9.c > #pragma GCC push_options > #pragma GCC target("avx2") > #include > #include > > static int bar(void *a) { > return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a, (__m256i){0})); > } > static void *bar_ifunc(void) {return (void*) bar;} > int foo(void *a) __attribute__((ifunc("bar_ifunc"))); > int main(int argc, char *argv[]) { return foo(argv[0]);} > $ ccache gcc -g -Wall -o /tmp/zz9 /tmp/zz9.c > > This seems to be because to get the compile failure you have > to be doing a .c to .o compile: > The difference is because ccache doesn't intercept .c-to-executable > compiles, so they go straight to real gcc and don't have -save-temps, > but it does intercept a .c-to-.o compile, which thus does get -save-temps > and so hits the gcc bug. > > TLDR: if you make your configure test use compile_object it ought to > correctly detect that AVX2 doesn't work for this gcc+ccache combo. Does the following (on top of the existing patch) fix it for you: Dave > > thanks > -- PMM --- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK diff --git a/configure b/configure index 6449e65..65e603c 100755 --- a/configure +++ b/configure @@ -1793,8 +1793,8 @@ static void *bar_ifunc(void) {return (void*) bar;} int foo(void *a) __attribute__((ifunc("bar_ifunc"))); int main(int argc, char *argv[]) { return foo(argv[0]);} EOF -if compile_prog "" ; then - if readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then +if compile_object "" ; then + if readelf --syms $TMPO |grep "IFUNC.*foo" >/dev/null 2>&1; then avx2_opt="yes" fi fi