All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06
Date: Tue, 7 Jun 2016 10:51:02 +0100	[thread overview]
Message-ID: <20160607095102.GB2257@work-vm> (raw)
In-Reply-To: <CAFEAcA-Ruo8=d3TWoL9hDgRdi+H_c9AT75WBRxeVoje1qmPfrw@mail.gmail.com>

* Peter Maydell (peter.maydell@linaro.org) wrote:
> On 6 June 2016 at 20:22, Dr. David Alan Gilbert <dgilbert@redhat.com> 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 <cpuid.h>
> #include <immintrin.h>
> 
> 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:

<snip>

> 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:

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


Dave

> 
> thanks
> -- PMM
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

      reply	other threads:[~2016-06-07  9:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 17:35 [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 01/11] tests: Rename tests/Makefile to tests/Makefile.include Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 02/11] pc: allow raising low memory via max-ram-below-4g option Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 03/11] hw/char: QOM'ify escc.c (fix) Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 04/11] scsi: esp: check TI buffer index before read/write Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 05/11] scsi: mark TYPE_SCSI_DISK_BASE as abstract Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 06/11] Makefile: Add a "FORCE" target Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 07/11] Makefile: Derive "PKGVERSION" from "git describe" by default Paolo Bonzini
2016-10-07 12:58   ` Peter Maydell
2016-06-06 17:35 ` [Qemu-devel] [PULL 08/11] scsi-disk: add missing break Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 09/11] vnc: list the 'to' parameter of '-vnc' in the qemu man page Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 10/11] Make avx2 configure test work with -O2 Paolo Bonzini
2016-06-06 17:35 ` [Qemu-devel] [PULL 11/11] avx2 configure: Use primitives in test Paolo Bonzini
2016-06-06 19:14 ` [Qemu-devel] [PULL 00/11] Misc changes for 2016-06-06 Peter Maydell
2016-06-06 19:22   ` Dr. David Alan Gilbert
2016-06-06 19:35     ` Peter Maydell
2016-06-07  9:51       ` Dr. David Alan Gilbert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160607095102.GB2257@work-vm \
    --to=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.