If a library defines multiple version of the same symbol, dlsym(RTLD_NEXT, "symbol")
returns the older symbol even though the older symbol is not the default symbol.
For example, libpthread defines two versions of pthread_cond_broadcast:
$:> nm -g /lib64/libpthread-2.15.so|grep pthread_cond_broadcast
000000000000bfc0 T pthread_cond_broadcast@@GLIBC_2.3.2
000000000000c310 T pthread_cond_broadcast@GLIBC_2.2.5
Now, if I use dlsym(RTLD_NEXT, "pthread_cond_broadcast"), I always get the GLIBC_2.2.5 version and not the GLIBC_2.3.2 version. Of course one can use dlvsym to get the default version, but that gets complicated if one needs to do it for a large number of symbols and a lot of them have different new/old versions.
I do understand that RTLD_NEXT shouldn't always return the latest symbol to maintain compatibility, but why not return the default symbol?
Does anyone know about the rationale behind this?
This has been reported as a glibc bug:
As far as I know, it has not been fixed yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With