Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 2013 14:21:42 +0200
From:      Dimitry Andric <dim@freebsd.org>
To:        John Baldwin <jhb@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:  <A7A9F3E9-AFB6-44C3-8B3F-E28F813229F5@freebsd.org>
In-Reply-To: <201307301216.15235.jhb@freebsd.org>
References:  <201307301233.r6UCXLT8012177@svn.freebsd.org> <CAMBSHm8xDvWsKJiLAzPF8azMKLHq3WWWQ3X1d6-6nJSAppux9Q@mail.gmail.com> <201307301216.15235.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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:
>>=20
>>> 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).
>=20
> Note that this is used in userland and the kernel.
>=20
>> 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?
>=20
> 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=20
two).  Similarly, __pie__ and __PIE__ are defined as 1 for -fpie, and as
2 for -fPIE.

-Dimitry




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A7A9F3E9-AFB6-44C3-8B3F-E28F813229F5>