This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour


Jakub Jelinek <jakub@redhat.com> writes:

> But as I've tried to explain in the test, RTLD_DEFAULT gives a different
> answer than RTLD_NEXT would even for the main program.

This is the test case I would have accepted:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <dlfcn.h>
#include <unistd.h>

pid_t getpid(void)
{
  pid_t (*f)(void);
  f = (pid_t (*)(void)) dlsym (RTLD_NEXT, "getpid");
  return f() + 26;
}

pid_t pid;
int main(void)
{
  pid_t (*f)(void);
  f = (pid_t (*)(void)) dlsym (RTLD_DEFAULT, "getpid");
  pid = f();
  return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now, if your patch is fixing this and *only* this then it's OK.

Please also provide patches to add a test case like the one above
(with -rdynamic etc).

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]