I've updated my patch to fix the convenience library double-linking bug 
on Darwin 
<http://savannah.gnu.org/patch/?func=detailpatch&patch_id=111&group_id=25>
. It now uses more portable constructs. I've only been able to test on 
on GNU/Linux (RedHat 7.2) and Darwin 5.4 so far, further testing would 
be appreciated.

It's still a bit of a workaround rather than a real fix--it removes 
everything in $conv from $deplibs, while it would be better to not add 
them in the first case if they're not needed. I'm not familiar enough 
with libtool to figure out how to do this though, sorry. Hopefully the 
current patch is Good Enough(tm).

Also, another problem with Darwin linking has come to my attention. It 
seems that Darwin loads shared libraries one section at a time, which 
means that C++ global constructors in a shared lib don't all get run at 
the same time. In fact, if there is a section that isn't used unless a 
global constructor is run, the global constructor won't run at all. This 
is a problem especially when C++ classes (using a factory idiom) attempt 
to register themselves in using a global constructor, as the 
registration won't actually occur.

A fix to this is to link object files in two steps, linking them all in 
one big section before turning it into a library. So instead of "cc 
-dynamiclib foo.o bar.o -o libexample.dylib", one would use "cc -r 
-keep_private_externs -nostdlib foo.o bar.o -o example-master.o && cc 
-dynamiclib example-master.o -o libexample.dylib". Can anyone think of 
any problems that would result from changing $archive_cmds to this usage 
pattern?

Dave Vasilevsky


_______________________________________________
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool

Reply via email to