I have a simple test program calling pthread_cond_broadcast
.
When linked with the ld
linker, this shows:
Case 1:
$ nm ld-test | grep cond_broadcast
U pthread_cond_broadcast@@GLIBC_2.3.2
When linked with the gold
linker it shows:
Case 2:
$ nm gold-test | grep cond_broadcast
U pthread_cond_broadcast
pthread/libc contains several pthread_cond_broadcast symbols with different version symbols presumably since the ABI has been changed.
$ nm /lib64/libc.so.6 |grep cond_broadca
00000036b84f7d30 t __pthread_cond_broadcast
00000036b85278f0 t __pthread_cond_broadcast_2_0
00000036b84f7d30 T pthread_cond_broadcast@@GLIBC_2.3.2
00000036b85278f0 T pthread_cond_broadcast@GLIBC_2.2.5
$ nm /lib64/libpthread.so.0 |grep cond_broadcast
00000036b880bee0 t __pthread_cond_broadcast
00000036b880c250 t __pthread_cond_broadcast_2_0
00000036b880bee0 T pthread_cond_broadcast@@GLIBC_2.3.2
00000036b880c250 T pthread_cond_broadcast@GLIBC_2.2.5
So the questions are:
- Why the different behavior between
gold
and the old/normalld
. - Which pthread_cond_broadcast symbol is being used at runtime in the Case 2, when the binary is linked to an unversioned
pthread_cond_broadcast
symbol. The newest implementation of pthread_cond_broadcast ? The oldest ?
This is using gcc 4.9.2 and the gold/ld linker from binutils 2.24 (as part of devtoolset-3 from Red Hat.)