qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Lindsay <alindsay@codeaurora.org>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: Aaron Lindsay <alindsay@codeaurora.org>
Subject: [Qemu-devel] [PATCH] avx2 configure: Disable if static build
Date: Thu, 14 Jul 2016 15:38:14 -0400	[thread overview]
Message-ID: <1468525094-11959-1-git-send-email-alindsay@codeaurora.org> (raw)
In-Reply-To: <20160714193657.GC28687@codeaurora.org>

This avoids a segfault like the following for at least some 4.8 versions
of gcc when configured with --static if avx2 instructions are also
enabled:

	Program received signal SIGSEGV, Segmentation fault.
	buffer_find_nonzero_offset_ifunc () at ./util/cutils.c:333
	333     {
	(gdb) bt
	#0  buffer_find_nonzero_offset_ifunc () at ./util/cutils.c:333
	#1  0x0000000000939c58 in __libc_start_main ()
	#2  0x0000000000419337 in _start ()

Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
---
 configure | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 5ada56d..169aa88 100755
--- a/configure
+++ b/configure
@@ -1788,7 +1788,9 @@ fi
 ##########################################
 # avx2 optimization requirement check
 
-cat > $TMPC << EOF
+
+if test "$static" = "no" ; then
+  cat > $TMPC << EOF
 #pragma GCC push_options
 #pragma GCC target("avx2")
 #include <cpuid.h>
@@ -1801,12 +1803,13 @@ 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_object "" ; then
-    if has readelf; then
-        if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then
-            avx2_opt="yes"
-        fi
-    fi
+  if compile_object "" ; then
+      if has readelf; then
+          if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then
+              avx2_opt="yes"
+          fi
+      fi
+  fi
 fi
 
 #########################################
-- 
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2016-07-14 19:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 11:16 [Qemu-devel] [PATCH v3 0/2] AVX2 configure fixes Dr. David Alan Gilbert (git)
2016-06-10 11:16 ` [Qemu-devel] [PATCH v3 1/2] Make avx2 configure test work with -O2 Dr. David Alan Gilbert (git)
2016-06-10 11:16 ` [Qemu-devel] [PATCH v3 2/2] avx2 configure: Use primitives in test Dr. David Alan Gilbert (git)
2016-07-14 13:13   ` Aaron Lindsay
2016-07-14 13:15     ` Paolo Bonzini
2016-07-14 13:23       ` Peter Maydell
2016-07-14 14:27         ` Aaron Lindsay
2016-07-14 14:35           ` Peter Maydell
2016-07-14 19:44             ` Aaron Lindsay
2016-07-14 13:33     ` Dr. David Alan Gilbert
2016-07-14 14:18       ` Aaron Lindsay
2016-07-14 15:05         ` Dr. David Alan Gilbert
2016-07-14 19:36           ` Aaron Lindsay
2016-07-14 19:38             ` Aaron Lindsay [this message]
2016-07-19 19:12               ` [Qemu-devel] [PATCH] avx2 configure: Disable if static build Dr. David Alan Gilbert
2016-07-29 14:22                 ` Peter Maydell
2016-06-13  9:31 ` [Qemu-devel] [PATCH v3 0/2] AVX2 configure fixes Paolo Bonzini
2016-06-13 10:51 ` Peter Maydell
2016-06-13 10:58   ` Dr. David Alan Gilbert

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=1468525094-11959-1-git-send-email-alindsay@codeaurora.org \
    --to=alindsay@codeaurora.org \
    --cc=dgilbert@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).