WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] dynamic libraries

On Wed, Feb 23, 2005 at 05:14:14PM -0600, Adam Heath wrote:
> On Wed, 23 Feb 2005, Keir Fraser wrote:
> 
> >
> > On 23 Feb 2005, at 21:28, Andrei Petrov wrote:
> >
> > > While looking at tools build I noticed that same object files are used
> > > to build both
> > > static and dynamic libraries (libxc, libxutil). It's normally required
> > > to compile in
> > > PIC form for dynamic ones. At first I thought that no applcations use
> > > those libraries,
> > > but no, they are used by all of them. Surprisingly it doens't cause
> > > any problems (at
> > > least nobody's complaining, ld.so even).
> > >
> > > Well, anyway it doesn't look correct for me, I'd like to come up with
> > > a patch
> > > but it'll take some time, so I wouldn't mind if some Makefile savvy
> > > beat me on it.
> > > Short term solution would be always set -fPIC.
> >
> > Well, we have the functionality in the build system already; it just
> > isn't the default.
> > Where is it stated that dynamic libraries must be compiled -fPIC? They
> > contain
> > relocation info and so can be relocated wherever needed at run time.
> > Potentially
> > less efficient (library relocated to different addresses cannot have
> > its text pages
> > shared across processes) but I don't see why it is *disallowed*.
> >

AFAIK, you need position independant code for shared library, so -fPIC,
as man(1) says. I can imagine cases when code migth be PIC without
the flag, say pure code. But if you have data segment which supposed to
be relocatable and your code access it in position dependant mode, I'm
kind of doubt that would work correctly,  I need to experiment with that.

> > If there's a suitably convincing explanation/reason then I will change
> > the default setting. :-)
> 
> Well, it just doesn't work at all on amd64, as well as other arches.  It just
> happens to work on i386, so most people never notice it.

Yep, that how I noticed it.

And, mapping to different addresses doesn't hurt page sharing.

--Andrei Petrov


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel