From owner-svn-src-head@FreeBSD.ORG Tue Aug 6 18:33:27 2013 Return-Path: Delivered-To: svn-src-head@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 08CE4D4; Tue, 6 Aug 2013 18:33:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D23712ED8; Tue, 6 Aug 2013 18:33:26 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D2E43B962; Tue, 6 Aug 2013 14:33:25 -0400 (EDT) From: John Baldwin To: Dimitry Andric Subject: Re: svn commit: r253802 - head/contrib/llvm/tools/clang/lib/Headers Date: Tue, 6 Aug 2013 13:47:16 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p28; KDE/4.5.5; amd64; ; ) References: <201307301233.r6UCXLT8012177@svn.freebsd.org> <201307301216.15235.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201308061347.16796.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 06 Aug 2013 14:33:25 -0400 (EDT) Cc: "svn-src-head@freebsd.org" , Matthew Fleming , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2013 18:33:27 -0000 On Wednesday, July 31, 2013 8:21:42 am Dimitry Andric wrote: > On Jul 30, 2013, at 18:16, John Baldwin wrote: > > On Tuesday, July 30, 2013 10:09:35 am Matthew Fleming wrote: > >> On Tue, Jul 30, 2013 at 5:33 AM, Dimitry Andric wrote: > >> > >>> Author: dim > >>> Date: Tue Jul 30 12:33:21 2013 > >>> New Revision: 253802 > >>> URL: http://svnweb.freebsd.org/changeset/base/253802 > ... > >> PIC mode on amd64 also uses %ebx. The difference is that FreeBSD makefiles > >> set -fPIC for i386 kernel compile but not amd64. Locally we use -fPIC for > >> amd64 (it was added 6 years ago to our environment because it gave better > >> kernel debugging). > > > > Note that this is used in userland and the kernel. > > > >> Anyways, is there some way to detect PIC mode and use that to decide > >> whether to use %ebx for the cpuid instruction, rather than using i386? > > > > Does clang supply a reliable #define to indicate that PIC is in use? If not, > > then this should use the PIC path always to be safe. > > Just like gcc, clang defines both __pic__ and __PIC__ as 1 for -fpic, > and as 2 for -fPIC (though on x86, there is no difference between the > two). Similarly, __pie__ and __PIE__ are defined as 1 for -fpie, and as > 2 for -fPIE. Ok, can you fix the header to check for __PIC__ then and push the change upstream? Also, feel free to make any changes to bit_* that you need and push those upstream as well. -- John Baldwin