other/8888: Linking shared libraries with -pthread fails to link to libpthread

wilhelmi@ira.uka.de wilhelmi@ira.uka.de
Tue Dec 10 04:16:00 GMT 2002


>Number:         8888
>Category:       other
>Synopsis:       Linking shared libraries with -pthread fails to link to libpthread
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 10 04:16:03 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Sebastian Wilhelmi
>Release:        CVS
>Organization:
>Environment:
Linux
>Description:
Linking a shared library with -pthread does not link in libpthread.so on linux. 

Quoting from the corresponding GLib bug report about the reasons, that libpthread.so has to be on the linking line also for shared libs:

 - prelink; in order for prelink to preresolve relocations
   for a library must not have undefined symbols; any 
   undefined symbols will always have to handled at run 
   time.

 - Symbol versioning; the binding of symbols to particular 
   versions happens when the library is linked. If -lpthread
   not on the link line, then the symbol will get the base 
   version at run time, not the correct newer one. 

Please see 

    http://bugzilla.gnome.org/show_bug.cgi?id=100697

for further information.
>How-To-Repeat:

>Fix:
See attached patch. Other platforms surely need similiar fixes as well.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gcc.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gcc.diff"

SW5kZXg6IGdjYy9jb25maWcvbGludXguaAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvY3Zzcm9vdC9n
Y2MvZ2NjL2djYy9jb25maWcvbGludXguaCx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4xOQpkaWZm
IC1wIC11IC1iIC1CIC1yMS4xOSBsaW51eC5oCi0tLSBnY2MvY29uZmlnL2xpbnV4LmgJMjkgU2Vw
IDIwMDIgMTM6MTY6NDQgLTAwMDAJMS4xOQorKysgZ2NjL2NvbmZpZy9saW51eC5oCTEwIERlYyAy
MDAyIDEyOjA5OjI2IC0wMDAwCkBAIC05Myw3ICs5Myw3IEBAIEJvc3RvbiwgTUEgMDIxMTEtMTMw
NywgVVNBLiAgKi8KICAgICAgJXshcHJvZmlsZToleyFnZ2RiOi1sY30gJXtnZ2RiOi1sZ319fSIK
ICNlbHNlCiAjZGVmaW5lIExJQl9TUEVDIFwKLSAgIiV7c2hhcmVkOiAtbGN9IFwKKyAgIiV7c2hh
cmVkOiAtbGMgJXtwdGhyZWFkOi1scHRocmVhZH19IFwKICAgICV7IXNoYXJlZDogJXttaWVlZS1m
cDotbGllZWV9ICV7cHRocmVhZDotbHB0aHJlYWR9IFwKIAkle3Byb2ZpbGU6LWxjX3B9ICV7IXBy
b2ZpbGU6IC1sY319IgogI2VuZGlmCg==



More information about the Gcc-bugs mailing list