Bug 51098 - [4.7 Regression] bootstrap failed on avx i686, svn revision 181259 to 181267
Summary: [4.7 Regression] bootstrap failed on avx i686, svn revision 181259 to 181267
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Uroš Bizjak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-11 14:10 UTC by Stupachenko Evgeny
Modified: 2011-11-16 14:56 UTC (History)
2 users (show)

See Also:
Host:
Target: x86-avx
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-11-16 00:00:00


Attachments
make output (939 bytes, text/plain)
2011-11-14 09:40 UTC, Stupachenko Evgeny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stupachenko Evgeny 2011-11-11 14:10:00 UTC
Build configured with: 
--with-arch=corei7-avx --with-cpu=corei7-avx --prefix=/usr/local
--enable-clocale=gnu --with-system-zlib --enable-shared --with-demangler-in-ld
--enable-cloog-backend=isl --with-ppl=/opt/gnu --with-cloog=/opt/gnu i686-linux
--with-fpmath=sse --enable-languages=c,c++,fortran,java,lto,objc

Build fail:

cd bld; \
 CC="gcc -m32" CXX="g++ -m32" ../src-trunk/configure \
	--with-arch=corei7-avx --with-cpu=corei7-avx --prefix=/usr/local --enable-clocale=gnu --with-system-zlib --enable-shared --with-demangler-in-ld --enable-cloog-backend=isl --with-ppl=/opt/gnu --with-cloog=/opt/gnu i686-linux --with-fpmath=sse --enable-languages=c,c++,fortran,java,lto,objc
configure: WARNING: you should use --build, --host, --target checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu
    grep "Error " makelog.181267.trunk.i686.corei7-avx >> makelog.181267.trunk.i686.corei7-avx.mail; \ checking for magic_open in -lmagic... make[7]: *** [x86_avx.lo] Error 1
make[6]: *** [all-recursive] Error 1
make[5]: *** [all] Error 2
make[4]: *** [all-target-libitm] Error 2
make[3]: *** [bootstrap] Error 2
make[2]: *** [bootstrap] Error 2
.......
Comment 1 Stupachenko Evgeny 2011-11-11 14:14:11 UTC
Most likely it is revision 181261
Comment 2 Jakub Jelinek 2011-11-11 14:20:32 UTC
You are omitting the important details how exactly it failed.  E.g.
grep -C6 x86_avx makelog.181267.trunk.i686.corei7-avx
Comment 3 Stupachenko Evgeny 2011-11-14 09:40:18 UTC
Created attachment 25815 [details]
make output

The additional information (make log grep) is attached.
Comment 4 Uroš Bizjak 2011-11-14 22:52:42 UTC
It looks that your assembler doesn't support AVX, so a fallback is triggered in config/x86/x86_avx.cc:

#ifdef HAVE_AS_AVX
...
#define OUTPUT(T)	_ITM_TYPE_##T
#define INPUT(T,X)	, _ITM_TYPE_##T X
#else
...
#define OUTPUT(T)	void
#define INPUT(T,X)
#endif

#define ITM_READ_MEMCPY(T, LSMOD, TARGET, M2)				\
OUTPUT(T) ITM_REGPARM _ITM_##LSMOD##T (const _ITM_TYPE_##T *ptr)	\
...

The problem is, that declarations in libitm.h do not agree with this:

#define ITM_BARRIERS(T) \
  extern _ITM_TYPE_##T _ITM_R##T(const _ITM_TYPE_##T *) ITM_REGPARM;	\
  extern _ITM_TYPE_##T _ITM_RaR##T(const _ITM_TYPE_##T *) ITM_REGPARM;	\
  extern _ITM_TYPE_##T _ITM_RaW##T(const _ITM_TYPE_##T *) ITM_REGPARM;	\
  extern _ITM_TYPE_##T _ITM_RfW##T(const _ITM_TYPE_##T *) ITM_REGPARM;	\
...
Comment 5 Richard Henderson 2011-11-14 23:50:59 UTC
... which will not be declared if AVX support is disavowed.
... except that the configure was --with-arch=corei7-avx.

If true, the problem is user error.  How can you expect to
configure for corei7-avx without a working avx assembler?

Otherwise, we've mis-identified the assembler support and
this is a configure bug.

Only the reporter can tell us which of these alternatives hold.

---

I suppose we could change the configure check to be

#ifndef __AVX__
  asm ("vzeroupper");
#endif

assuming that if --with-arch/CFLAGS says avx is present, believe it.
Let this fail later (again as user error) if the assembler can't
actually assemble AVX insns.
Comment 6 Stupachenko Evgeny 2011-11-16 10:32:31 UTC
Bootstrap fail was caused by later commit (revision 181246):

------------------------------------------------------------------------
r181246 | rth | 2011-11-10 04:29:38 +0400 (Thu, 10 Nov 2011) | 1 line
Changed paths:
   M /trunk/libitm/ChangeLog
   M /trunk/libitm/acinclude.m4
   M /trunk/libitm/config/x86/x86_avx.cc
   M /trunk/libitm/config.h.in
   M /trunk/libitm/configure
   M /trunk/libitm/configure.ac

libitm: Work around assembler missing AVX insns.


181154      aldyh   fi
181154      aldyh 
181246        rth case "${target_cpu}" in
181246        rth i345686 | x86_64)
181246        rth   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler supports AVX" >&5
181246        rth $as_echo_n "checking if the assembler supports AVX... " >&6; }
181246        rth if test "${libitm_cv_as_avx+set}" = set; then :
181246        rth   $as_echo_n "(cached)


i345686 shoud be i[3456]86

That is why HAVE_AS_AVX was not set for i686 target_cpu.
Comment 7 Uroš Bizjak 2011-11-16 14:46:41 UTC
I have a patch.
Comment 8 uros 2011-11-16 14:51:19 UTC
Author: uros
Date: Wed Nov 16 14:51:13 2011
New Revision: 181408

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181408
Log:
	PR bootstrap/51098
	* acinclude.m4 (LIBITM_CHECK_AS_AVX): Fix target selector.
	* configure: Regenerate.


Modified:
    trunk/libitm/ChangeLog
    trunk/libitm/acinclude.m4
    trunk/libitm/configure
Comment 9 Uroš Bizjak 2011-11-16 14:56:48 UTC
Should be fixed now.