Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Aug 2013 13:47:16 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Dimitry Andric <dim@freebsd.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Matthew Fleming <mdf@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r253802 - head/contrib/llvm/tools/clang/lib/Headers
Message-ID:  <201308061347.16796.jhb@freebsd.org>
In-Reply-To: <A7A9F3E9-AFB6-44C3-8B3F-E28F813229F5@freebsd.org>
References:  <201307301233.r6UCXLT8012177@svn.freebsd.org> <201307301216.15235.jhb@freebsd.org> <A7A9F3E9-AFB6-44C3-8B3F-E28F813229F5@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, July 31, 2013 8:21:42 am Dimitry Andric wrote:
> On Jul 30, 2013, at 18:16, John Baldwin <jhb@freebsd.org> wrote:
> > On Tuesday, July 30, 2013 10:09:35 am Matthew Fleming wrote:
> >> On Tue, Jul 30, 2013 at 5:33 AM, Dimitry Andric <dim@freebsd.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308061347.16796.jhb>