Libtool and Support for Shared Libraries (3)

Greg Banks gnb at fastmail.fm
Fri Jun 8 18:05:20 EDT 2012



Sent from my iPhone

On 09/06/2012, at 7:22, Carson Gaspar <carson at taltos.org> wrote:

> [ Much perl tsuris elided ]

;)

>
> Folks keep talking about linking a static libfoo.a into a dynamic  
> libbar.so. This MUST NOT HAPPEN. Linking non-PIC code into a shared  
> object will fail in unpredictable ways.

Understood - this is why the old build system makes an archive library  
full of PIC objects, to be linked into the DSO for Perl to dlopen().


> It may _appear_ to work, but it really won't. The Solaris linker  
> will usually scream bloody murder and error out. Linux/gnu ld tend  
> to fail to enforce this, and leave the errors for runtime.
>
> The libtool non-static convenience lib stuff sounds like it does the  
> right thing, but I haven't looked at it to be sure.

Yes it does - I checked the log to see that the objects that go into  
it are built with -fPIC, then extracted an object from it with 'ar xv'  
and used 'objdump -r' to make sure the object contained relocs against  
the PLT and GOT, which only happens in PIC objects.

>
> If I have some time this weekend, I'll try building the dev/libtool  
> branch and provide more feedback, as I install every package into  
> it's own tree, so I will trigger any missing RPATH issues.

Excellent, I'm looking forward to hearing how that goes.

If anyone out there builds on MacOS or BSD, it would be great if you  
could build the dev/libtool branch and report your experiences.

>
> -- 
> Carson
>


More information about the Cyrus-devel mailing list