From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 3 11:22:38 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E36321065673 for ; Sat, 3 Jul 2010 11:22:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5BE938FC14 for ; Sat, 3 Jul 2010 11:22:37 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o63BMYnj018131 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 3 Jul 2010 14:22:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o63BMYdj028302 for ; Sat, 3 Jul 2010 14:22:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o63BMY5s028301 for freebsd-hackers@freebsd.org; Sat, 3 Jul 2010 14:22:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 3 Jul 2010 14:22:34 +0300 From: Kostik Belousov To: freebsd-hackers@freebsd.org Message-ID: <20100703112234.GE13238@deviant.kiev.zoral.com.ua> References: <4C2E7BCD.4020609@delphij.net> <20100703100811.GA1605@britannica.bec.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GLnf9Go3l6tdAkV+" Content-Disposition: inline In-Reply-To: <20100703100811.GA1605@britannica.bec.de> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Subject: Re: Using lex in a shared library X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 11:22:39 -0000 --GLnf9Go3l6tdAkV+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 03, 2010 at 12:08:11PM +0200, Joerg Sonnenberger wrote: > On Fri, Jul 02, 2010 at 04:52:45PM -0700, Xin LI wrote: > > I think that amd64 requires a static library be compiled with -fPIC if > > it's being linked into shared object. This should not be done for > > normal static libraries, though, as this could give some performance > > penalty when it's not needed (i.e. a static binary). >=20 > More precisely, AMD64 disallows absolute references in the text segment. > The performance penalty for PIC on AMD64 is minimal as it can do > RIP-relative addressing. Even more precisely, amd64 does not disallow such references, it only disallows the 32bit signed relocations. The reasoning is that shared object may be loaded at arbitrary location at the process address space, and correct relocation might be larger then can be fi in 32 signed bit. The solution is either use PIC, thus going through PLT, or use big (or whatever is called) memory model when compiling, that makes all relocations 64 bit, with obvious performance penalty. --GLnf9Go3l6tdAkV+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkwvHXoACgkQC3+MBN1Mb4jAqACeMxEbv/42NYE8UarvlhBIEAYy MfgAoK5ggZopU0CeNGx63FNP+119/KmC =OMow -----END PGP SIGNATURE----- --GLnf9Go3l6tdAkV+--