From owner-freebsd-current@FreeBSD.ORG Fri Aug 16 15:02:13 2013 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3CADCAE; Fri, 16 Aug 2013 15:02:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B44A22CAF; Fri, 16 Aug 2013 15:02:12 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r7GF23xT059199; Fri, 16 Aug 2013 18:02:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r7GF23xT059199 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r7GF21cU059198; Fri, 16 Aug 2013 18:02:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 16 Aug 2013 18:02:01 +0300 From: Konstantin Belousov To: Dimitry Andric Subject: Re: building i386 world on amd64 host: failed @svn Message-ID: <20130816150201.GF4972@kib.kiev.ua> References: <17A40261-A0DA-4070-990F-0D0777A5BE44@FreeBSD.org> <20130815183640.GR4972@kib.kiev.ua> <20130815193049.GU4972@kib.kiev.ua> <520D2E40.2090704@FreeBSD.org> <70C1942B-8BA3-47D8-BFE4-3DC3B5CAD56C@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dscJE5GGjyIXq/37" Content-Disposition: inline In-Reply-To: <70C1942B-8BA3-47D8-BFE4-3DC3B5CAD56C@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-current@FreeBSD.org, Dmitry Morozovsky , Jung-uk Kim , Peter Wemm X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Aug 2013 15:02:13 -0000 --dscJE5GGjyIXq/37 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 16, 2013 at 02:33:29PM +0200, Dimitry Andric wrote: > On Aug 15, 2013, at 21:38, Jung-uk Kim wrote: > > On 2013-08-15 15:30:49 -0400, Konstantin Belousov wrote: > >> On Thu, Aug 15, 2013 at 09:12:52PM +0200, Dimitry Andric wrote: > >>> On Aug 15, 2013, at 20:36, Konstantin Belousov > >>> wrote: > >>>> Does the linux box defaults to pentium or higher for -march ?=20 > >>>> 64 bit atomics cannot be implemented in usermode on i386 on=20 > >>>> processors which do not have cmpxchg8b instruction. > >>>=20 > >>> Ah yes, you are totally right, with -v it gives: > >>>=20 > >>> COLLECT_GCC_OPTIONS=3D'-O2' '-S' '-v' '-mtune=3Dgeneric' > >>> '-march=3Di586' > >>>=20 > >>> So we should really disable atomics for i486 and lower? Though I > >>> have understood that there also some pentiums without > >>> cmpxchg8b... > >>=20 > >> I do not think that there was any Pentium-branded CPU which did > >> not implemented cmpxchg8b. Some late 486 did provided cpuid, but I > >> am almost certain that they did not have cmpxchg8b (cannot check > >> anyway). > >=20 > > It is actually little complicated. > >=20 > > http://www.geoffchappell.com/studies/windows/km/cpu/cx8.htm >=20 >=20 > In contrast, gcc's rules (in contrib/gcc/config/i386/i386.c) are pretty > straightforward: >=20 > /* Compare and exchange was added for 80486. */ > const int x86_cmpxchg =3D ~m_386; > /* Compare and exchange 8 bytes was added for pentium. */ > const int x86_cmpxchg8b =3D ~(m_386 | m_486); >=20 > So maybe the following is a safe enough solution for now: >=20 > Index: usr.bin/svn/svn_private_config.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/svn/svn_private_config.h (revision 254300) > +++ usr.bin/svn/svn_private_config.h (working copy) > @@ -153,7 +153,9 @@ > #define SVN_FS_WANT_DB_PATCH 14 >=20 > /* Define if compiler provides atomic builtins */ > +#if !defined(__i386__) || !defined(__i486__) > #define SVN_HAS_ATOMIC_BUILTINS 1 > +#endif I do not understand this. Isn't __i386__ defined always when compiling for 32bit x86 ? =20 The !defined(__i486__) part assumes that any other cpu variation supported by compiler has cmpxchg8b. --dscJE5GGjyIXq/37 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJSDj7pAAoJEJDCuSvBvK1BrI0P/0Uz2IwpZr9PxNOOpN1dLSeD TknmrCubSz5X/sxkhZuUa8On1sJMM801hxLaJzJGISTA004xjH3lEWG8TI4Vdhcn nDMiwRRtOsg/e1zdqjjj+2BZbAn4LbVWNbAfN8FHXo/UPpQdoc4RQmt/jL+yFREN /c4uD6dO/kN+1jdaFfN/LbZbecHA9/3+HGpNTfOfxbNeLg5irpFSN1wFN8heXylY DJYVmPU/CKj6/lXr21/vV5oMY46Yb77OM0QMKR2ROTCHl8ONqYJ/pzwlcbPmHGzH e91WfC8GiYAwNzpXUCv6LJ2N0k+783r9/Ofhp0s7UG1RMxNVsPLUUyyPsV0tOh9o dG80PIXiwPPsr/pD3teWGDE17nxHHtSPwiUM8iLrB7hmOjHmkk0j9Y8gBEKjXN8+ aAqUxcR2Tk2cXDOiGG5y3//7oDFyDnv+RGjo3KazeP8S0y6ib66ZNkdwdRf53VTw vYxc0P+yiK//o5M7Svd92zkQkXAqGiTJ8Ha/PJhFIBH6sSW5ZbQizCfwCx6+pFEx tMZzAZapUnyDyM82vkUKql8CJkdZDEWNvIXVTuT30W3NESnYWRbHptNjcuWlsJLp DnB6vOWOvosUn4r1Hz7H2IYGSCAI/DolhBQLAaDDUC2U+KVVyIWeaNSOJZLL3FeZ esVWTbY2f1dwnb6JxGe4 =sQzt -----END PGP SIGNATURE----- --dscJE5GGjyIXq/37--