[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] debian pic-lib.patch (4 of 5)



On Sat, 5 Feb 2005, Ian Pratt wrote:

> Hmm. We're having second thoughts about this patch...
>
> Why is bulding the .so's PIC important for Debian? In all the libraries
> I've ever built I can't ever recall seeing one of these .opic files
> before.

Shared libraries are required to be compiled with -fPIC.  For one, some arches
won't work with it(i386, unfortunately, is not one; this is the reason this
argument comes up so often.  However, amd64 requires -fPIC).  Second, if a
library is not compiled with -fPIC, then when it is runtime-linked to
binaries, it will be located at different addresses, and the kernel won't be
able to share pages with other apps that link to it.

As for the .opic files, that's not really a standard.  Libraries are required
to be pic.  But static libraries libraries don't have to be.  So, files are
required to be compiled twice, and .opic is just my personal preference.

Some build systems build them in separate dirs.  That works fine too.

Note, that if you are going to link static code into *another* shared
library(that isn't also static), then you must link the pic versions.  This
very often means a shared lib(.so) has pic files, a normal .a has non-pic, but
a -pic.a has the same pic files that the shared lib has.

Running prelink is a good way to find these problem libraries.  A command of
the form:

prelink --all --conserve-memory --random > /tmp/PRELINK 2>&1

> PIC code on x86 burns ebx, which causes a measurable slowdown (which we
> might even care about during save/restore/migrate). Further, I wander if
> all versions of gcc cope correctly with inline asm that uses ebx???

The inline asm needs to be compiled pic as well.

> Why do you need this patch?

If you don't take it  upstream, that's fine.  But that will force me to
maintain it separately for debian, which is sub-optimal.  Debian policy
requires this of libraries.


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.