Date: Tue, 7 Mar 2006 14:06:49 -0500 From: Kris Kennaway <kris@obsecurity.org> To: Kris Kennaway <kris@obsecurity.org>, pfgshield-freebsd@yahoo.com, freebsd-ports@FreeBSD.org Subject: Re: amd64 and -fPIC Message-ID: <20060307190648.GA5176@xor.obsecurity.org> In-Reply-To: <20060307185624.GE73973@isis.sigpipe.cz> References: <20060220041815.3229.qmail@web32907.mail.mud.yahoo.com> <20060220043813.GA82552@xor.obsecurity.org> <20060307183756.GD73973@isis.sigpipe.cz> <20060307184210.GA33347@xor.obsecurity.org> <20060307185624.GE73973@isis.sigpipe.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
--W/nzBZO5zC0uMSeA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 07, 2006 at 07:56:24PM +0100, Roman Neuhauser wrote: > > > > > If the package includes a library that might be used frequently a= nd doesn't > > > > > include a shared version please add -fPIC to the amd64 version of= the port, for > > > > > example for math/arpack (and feel free to commit this): > > > >=20 > > > > The best solution is to make the port also build a shared version; > > > > it's usually not that difficult to modify the makefile. That way y= ou > > > > don't have to add nasty hacks. > > >=20 > > > That doesn't solve the problem, which is: the static library is > > > almost useless, and users might actually want or need to use the > > > static library. > >=20 > > Why do you say it's useless? The point of a static library is for > > static linking, and this works fine on amd64 or any other > > architecture. >=20 > I say so because I installed the library (using the port) to use it > in a shared library. The link failed with relocation errors. As far > as I'm concerned (on amd64, that is), the port is dead weight. OK, so it just needs to be fixed to build a shared library too (as I said above). > > > net/libpcap only installs lib/libpcap.so if you install into /usr, > > > probably because all the dependent ports would need to be taught > > > to look in /usr/local/lib first. > >=20 > > I don't know what you're saying here. > =20 > /usr/lib is walked first, /usr/lib/libpcap.so.N will mask > /usr/local/lib/libpcap.so.M Yep, that's how it works. Again, what is your point? > > > misc/ossp-uuid's ${PREFIX}/lib/libuuid.a (it configures with > > > --disable-shared) cannot be used in shared libraries on amd64 > > > because the port doesn't use -fPIC on this platform. > >=20 > > The bug is presumably the --disable-shared. >=20 > I'd prefer to link in the .a even if there was a .so. I don't care what your preference is, it's wrong to expect this to work (see below). > > > Ports that install static libraries *need* to use -fPIC on amd64. > >=20 > > No, they need to also install shared libraries. >=20 > Ok, to help me understand your view: >=20 > Do you agree that it's a fact that static libraries installed > without -fPIC can be used to create shared libraries on eg. i386? By accident of the architecture, yes. The architectures on which this works are in the minority. > Do you agree that it's a fact that static libraries installed > without -fPIC *cannot* be used to create shared libraries on eg. > amd64? Yes, relocatable code needs to be used in relocatable libraries on amd64 and other architectures. Relocatable code should not be used in non-relocatable libraries since the extra indirection makes it slower. This sometimes *makes a measurable performance difference* that is important when you are trying to optimize for performance. In fact, chances are that the port in question is exactly such a case. Kris --W/nzBZO5zC0uMSeA Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (FreeBSD) iD8DBQFEDdnIWry0BWjoQKURAkslAKDELkTWaiIee93rwOtPvHinYjb4qgCgn8u/ kdryi6UVbx9hPmt7DW0yAVc= =9zpB -----END PGP SIGNATURE----- --W/nzBZO5zC0uMSeA--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060307190648.GA5176>