Bug 2524 - Solaris versioning glitches when building shared libraries against static ones
Summary: Solaris versioning glitches when building shared libraries against static ones
Status: RESOLVED DUPLICATE of bug 1021
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
: 6431 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-06 17:55 UTC by Aaron M. Ucko
Modified: 2011-09-15 22:11 UTC (History)
3 users (show)

See Also:
Host: sparc-sun-solaris2.10
Target: sparc-sun-solaris2.10
Build: sparc-sun-solaris2.10
Last reconfirmed:


Attachments
makefile for problematic library chain (272 bytes, text/plain)
2006-04-06 17:57 UTC, Aaron M. Ucko
Details
barebones source file for problematic library chain (131 bytes, text/plain)
2006-04-06 17:57 UTC, Aaron M. Ucko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron M. Ucko 2006-04-06 17:55:54 UTC
Although I have found the patch from bug 1031 helpful, there are still
circumstances in which symbol versioning evidently confuses ld.  In particular,
chains of shared libraries that link against both -lpthread and [GCC 4.0.1's]
libsupc++.a are problematic, with ld eventually deciding that a user library
defines some pthread_ symbols and subsequently reporting an error at the next stage:

gcc -pthreads -fpic -Dfunc=baz -Doldfunc=bar -c foo.cc -o baz.o
nm -p baz.o | grep pthread
gmake: [baz.o] Error 1 (ignored)
gcc -pthreads -fpic -Dfunc=bar -Doldfunc=foo -c foo.cc -o bar.o
nm -p bar.o | grep pthread
gmake: [bar.o] Error 1 (ignored)
gcc -pthreads -fpic -Dfunc=foo -c foo.cc -o foo.o
nm -p foo.o | grep pthread
0000000000 U pthread_cancel
gcc -pthreads -shared -o libfoo.so foo.o -lpthread -lsupc++
nm -p libfoo.so | grep pthread
0000000000 U pthread_cancel@@SUNW_0.9
0000000000 U pthread_getspecific@@SUNW_0.9
0000000000 U pthread_key_create@@SUNW_0.9
0000000000 U pthread_mutex_lock@@SUNW_0.9
0000000000 U pthread_mutex_unlock@@SUNW_0.9
0000000000 U pthread_once@@SUNW_0.9
0000000000 U pthread_setspecific@@SUNW_0.9
gcc -pthreads -shared -o libbar.so bar.o -L. -lfoo -lpthread -lsupc++
nm -p libbar.so | grep pthread
gmake: [libbar.so] Error 1 (ignored)
gcc -pthreads -shared -o libbaz.so baz.o -L. -lbar -lpthread -lsupc++
nm -p libbaz.so | grep pthread
0000000000 T pthread_cancel@@SUNW_0.9
0000000000 U pthread_getspecific@@SUNW_0.9
0000000000 U pthread_key_create@@SUNW_0.9
0000000000 U pthread_mutex_lock@@SUNW_0.9
0000000000 U pthread_mutex_unlock@@SUNW_0.9
0000000000 U pthread_once@@SUNW_0.9
0000000000 U pthread_setspecific@@SUNW_0.9
gcc -pthreads -shared -o libquux.so quux.o -L. -lbaz -lpthread -lsupc++
/netopt/gcc/4.0.1a/solaris10-sparc/bin/ld: ./libbaz.so: pthread_cancel: invalid
version 3 (max 0)
./libbaz.so: could not read symbols: Bad value
collect2: ld returned 1 exit status
gmake: *** [libquux.so] Error 1
Comment 1 Aaron M. Ucko 2006-04-06 17:57:14 UTC
Created attachment 955 [details]
makefile for problematic library chain
Comment 2 Aaron M. Ucko 2006-04-06 17:57:53 UTC
Created attachment 956 [details]
barebones source file for problematic library chain
Comment 3 Niki W. Waibel 2008-04-20 21:09:23 UTC
hmmm -- 2 years since report, and nobody has had a look at this?
want to be on Cc, as i've reported
http://sourceware.org/bugzilla/show_bug.cgi?id=1031 and recently
http://sourceware.org/bugzilla/show_bug.cgi?id=6431
... seems to be related somehow.
Comment 4 Andrew Stormont 2009-10-03 17:59:06 UTC
I can confirm this bug exists on i386-pc-solaris2.11.

One work-around I have found is making -lpthread the first argument, this is
very hacky but works.
Comment 5 Andrew Stormont 2010-08-21 20:59:53 UTC
*** Bug 6431 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Stormont 2011-09-15 22:11:34 UTC
Marking as duplicate of 1021.

*** This bug has been marked as a duplicate of bug 1021 ***