From owner-svn-src-all@FreeBSD.ORG Wed Aug 7 20:57:07 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 F3B92BD5; Wed, 7 Aug 2013 20:57:06 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B29D82901; Wed, 7 Aug 2013 20:57:06 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 95F5C12013D; Wed, 7 Aug 2013 22:56:53 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 6C1EB28494; Wed, 7 Aug 2013 22:56:53 +0200 (CEST) Date: Wed, 7 Aug 2013 22:56:53 +0200 From: Jilles Tjoelker To: Dimitry Andric Subject: Re: svn commit: r253802 - head/contrib/llvm/tools/clang/lib/Headers Message-ID: <20130807205653.GB4918@stack.nl> References: <201307301233.r6UCXLT8012177@svn.freebsd.org> <2DE35C45-B110-4D93-BFA7-542A3D1EE902@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2DE35C45-B110-4D93-BFA7-542A3D1EE902@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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, 07 Aug 2013 20:57:07 -0000 On Tue, Jul 30, 2013 at 04:16:58PM +0200, Dimitry Andric wrote: > Upstream gcc checks this with: > #if defined(__i386__) && defined(__PIC__) > ... > #elif defined(__x86_64__) && (defined(__code_model_medium__) || defined(__code_model_large__)) && defined(__PIC__) > ... > and it exchanges ebx or rbx with %k1 or %q1, respectively, instead of > push/pop. That might be a little more efficient. > I guess the defined(__PIC__) should be enough for us, in most cases. > The code_model stuff is for x32 support, which we do not have yet. The code_model stuff is not for x32 support but for PIC/PIE code where code+data exceed 2GB so relative addressing cannot always be used. The ABI then prescribes that %r15 be loaded with the GOT pointer when invoking a large model (code>2GB) PLT entry; otherwise (medium model or no PLT entry used), much like i386, any register can be used for the GOT pointer. In x32, relative addressing can always be used and there is no need for a PIC register. I don't really understand why special tricks are needed for %ebx/%rbx. With the "b" constraint or "%ebx" clobber, adequate information is provided to the compiler that %ebx/%rbx will have to be saved somewhere around the asm. And in fact this appears to work fine with clang; only gcc (4.2.1 and 4.4.3; I have not tested newer versions) needs special trickery to access %ebx. -- Jilles Tjoelker