From owner-svn-src-all@FreeBSD.ORG Wed Jul 31 12:21:43 2013 Return-Path: Delivered-To: svn-src-all@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 A9867EAF; Wed, 31 Jul 2013 12:21:43 +0000 (UTC) (envelope-from dim@freebsd.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 699E02EED; Wed, 31 Jul 2013 12:21:43 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::bc7b:eae4:1dd1:7fcc] (unknown [IPv6:2001:7b8:3a7:0:bc7b:eae4:1dd1:7fcc]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id A1C5F5C5A; Wed, 31 Jul 2013 14:21:38 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: svn commit: r253802 - head/contrib/llvm/tools/clang/lib/Headers From: Dimitry Andric In-Reply-To: <201307301216.15235.jhb@freebsd.org> Date: Wed, 31 Jul 2013 14:21:42 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201307301233.r6UCXLT8012177@svn.freebsd.org> <201307301216.15235.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1508) Cc: "svn-src-head@freebsd.org" , Matthew Fleming , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2013 12:21:43 -0000 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: >>=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