From owner-freebsd-current@FreeBSD.ORG Fri Aug 16 12:33:35 2013 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2A35B5E9; Fri, 16 Aug 2013 12:33:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DE1E9240E; Fri, 16 Aug 2013 12:33:34 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::70f6:891e:806a:7c37] (unknown [IPv6:2001:7b8:3a7:0:70f6:891e:806a:7c37]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id EAEF55C43; Fri, 16 Aug 2013 14:33:30 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: building i386 world on amd64 host: failed @svn From: Dimitry Andric In-Reply-To: <520D2E40.2090704@FreeBSD.org> Date: Fri, 16 Aug 2013 14:33:29 +0200 Content-Transfer-Encoding: 7bit Message-Id: <70C1942B-8BA3-47D8-BFE4-3DC3B5CAD56C@FreeBSD.org> References: <17A40261-A0DA-4070-990F-0D0777A5BE44@FreeBSD.org> <20130815183640.GR4972@kib.kiev.ua> <20130815193049.GU4972@kib.kiev.ua> <520D2E40.2090704@FreeBSD.org> To: Jung-uk Kim X-Mailer: Apple Mail (2.1508) Cc: Konstantin Belousov , freebsd-current@FreeBSD.org, Dmitry Morozovsky , 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 12:33:35 -0000 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 ? >>>> 64 bit atomics cannot be implemented in usermode on i386 on >>>> processors which do not have cmpxchg8b instruction. >>> >>> Ah yes, you are totally right, with -v it gives: >>> >>> COLLECT_GCC_OPTIONS='-O2' '-S' '-v' '-mtune=generic' >>> '-march=i586' >>> >>> So we should really disable atomics for i486 and lower? Though I >>> have understood that there also some pentiums without >>> cmpxchg8b... >> >> 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). > > It is actually little complicated. > > http://www.geoffchappell.com/studies/windows/km/cpu/cx8.htm In contrast, gcc's rules (in contrib/gcc/config/i386/i386.c) are pretty straightforward: /* Compare and exchange was added for 80486. */ const int x86_cmpxchg = ~m_386; /* Compare and exchange 8 bytes was added for pentium. */ const int x86_cmpxchg8b = ~(m_386 | m_486); So maybe the following is a safe enough solution for now: Index: usr.bin/svn/svn_private_config.h =================================================================== --- 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 /* Define if compiler provides atomic builtins */ +#if !defined(__i386__) || !defined(__i486__) #define SVN_HAS_ATOMIC_BUILTINS 1 +#endif /* Is GNOME Keyring support enabled? */ /* #undef SVN_HAVE_GNOME_KEYRING */ Those rules can be extended for other arches or CPUs that don't support 64-bit atomic operations. -Dimitry