svn commit: r253802 - head/contrib/llvm/tools/clang/lib/Headers

John Baldwin jhb at freebsd.org
Tue Aug 6 18:33:27 UTC 2013


On Wednesday, July 31, 2013 8:21:42 am Dimitry Andric wrote:
> On Jul 30, 2013, at 18:16, John Baldwin <jhb at 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 at 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


More information about the svn-src-head mailing list