dlsym() and RTLD_NEXT resolves wrong symbol
Martin Schlemmer
azarah@nosferatu.za.org
Sun Feb 13 18:16:00 GMT 2005
On Sun, 2005-02-13 at 17:51 +0100, Jakub Jelinek wrote:
> > My question is thus: Why does it not the address of the first symbol that
> > would have been resolved during normal operation? Or differently, why is
> > my assumption that it would resolve the same symbol as during normal
> > runtime
> > wrong ?
>
> Because dlsym is a lookup for unversioned symbol.
> Program or shared library compiled/linked against glibc 2.0.x, that doesn't
> contain any versioning whatsoever, is supposed to resolve to the oldest
> symbol version, not to the newest. And dlsym matches that behaviour.
>
Ok, that does put a twist on things, thank you.
> The @@ symbols vs. @ symbols matter at link time, so if you are linking
> against new libc.so undefined chown references become chown@GLIBC_2.1.
> If you want chown@@GLIBC_2.1, just call dlvsym (h, "chown", "GLIBC_2.1").
>
So there is no way to get the latest when there is more then one symbol
without specifying the version (Except maybe a script that extracts that
info) ? (Asking because there are quite a few functions being wrapped)
Thanks,
--
Martin Schlemmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20050213/e6c8b235/attachment.sig>
More information about the Libc-alpha
mailing list