From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPaRy-0003jN-3F for qemu-devel@nongnu.org; Tue, 19 Jul 2016 15:13:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPaRt-0002Xs-PT for qemu-devel@nongnu.org; Tue, 19 Jul 2016 15:13:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34844) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPaRt-0002Xo-Jb for qemu-devel@nongnu.org; Tue, 19 Jul 2016 15:12:57 -0400 Date: Tue, 19 Jul 2016 20:12:53 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20160719191253.GI2087@work-vm> References: <20160714193657.GC28687@codeaurora.org> <1468525094-11959-1-git-send-email-alindsay@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1468525094-11959-1-git-send-email-alindsay@codeaurora.org> Subject: Re: [Qemu-devel] [PATCH] avx2 configure: Disable if static build List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aaron Lindsay Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org * Aaron Lindsay (alindsay@codeaurora.org) wrote: > 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 It does look like the simplest solution to the problem; Reviewed-by: Dr. David Alan Gilbert Dave > --- > 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 > @@ -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. > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK