dlsym(RTLD_NEXT) and weak symbols



Hi,

I am not sure if it has even worked correctly, but calling dlsym("dlopen", RTLD_NEXT) returns reference to the dlopen() function in the libc, not reference to dlopen() function in the ld-elf.so. The attempt to call this function then fails, since dlopen() in libc is just a stub to make static linking happy.

#pragma weak dlopen
void *
dlopen(const char *name, int mode)
{
_rtld_error(sorry);
return NULL;
}

IMHO this is incorrect and is probably part of the bigger problem. The dlsym(3) should return first non-weak symbol instead.

-Maxim

_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: dlsym(RTLD_NEXT) and weak symbols
    ... Maxim Sobolev wrote: ... I am not sure if it has even worked correctly, but calling dlsymreturns reference to the dlopenfunction in the libc, not reference to dlopenfunction in the ld-elf.so. ...
    (freebsd-current)
  • Re: Best Way to Create String Variables in Assembly
    ... of using assembly when I start using malloc. ... what advantage do you gain by making the syscall over calling malloc, ... libc is a particularly bad thing. ... memory management is one of those subjects in computer ...
    (alt.lang.asm)
  • passing by reference in j# for Whidbey
    ... variables by reference, the attribute tag must be applied while declaring the ... I think this is bad code convention. ... there should be a marker when calling a function ... Calling without the ampersand should throw a compiler error. ...
    (microsoft.public.dotnet.vjsharp)
  • Re: arraylist.clear
    ... >> And how do I make this vaiable last forever eventhough I need to ... >> clear it for undetermined periods of time? ... > Calling ArrayList.Clearjust clears the contents of that ArrayList. ... > It does nothing to the variable holding a reference to the list itself. ...
    (microsoft.public.dotnet.framework.performance)
  • debug build crashes when calling managed code
    ... In the debugger, when we call one of their APIs (we're calling a method on a ... The method we're calling takes a reference to an instance ... the stack and then call the method providing a reference to that instance. ...
    (microsoft.public.vc.language)