This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/1319] dlsym/RTLD_NEXT is broken when more than 1 lib has the symbol.


------- Additional Comments From langlais at ilay dot org  2005-09-23 22:30 -------
Ok. Since this place is supposed to be a bug filing place (BUG-ZILLA) and not a
dumb troll about politically correct way to call a bee a bee, let me rephrase
the BUG description:

According to :
1/ Posix dlsym RTLD_NEXT descriptive part.
2/ LSB (even prior 2.0) description of dlsym RTLD_NEXT that agrees with 1/
3/ dlsym man page RTLD_NEXT section

The behavior of the following stuff is *INCORRECT* :

for i in 1 2 3 4
do
cat > lib$i.c <<EOF
#include <stdio.h>
#include <dlfcn.h>
void foo() {
     void (*next_foo)(void);
     printf("lib$i.foo()\n");
     if (next_foo = (void (*)(void)) dlsym(RTLD_NEXT, "foo")) next_foo();
}

EOF
gcc -shared -fPIC lib$i.c -o lib$i.so -D_GNU_SOURCE
done
cat > chain2.c <<EOF
#include <dlfcn.h>
int main() {
         void *l1, *l2, *l3, *l4;
         void (*bar)();
         l1 = dlopen("lib1.so", RTLD_NOW | RTLD_GLOBAL);
         l2 = dlopen("lib2.so", RTLD_NOW | RTLD_GLOBAL);
         l3 = dlopen("lib3.so", RTLD_NOW | RTLD_GLOBAL);
         l4 = dlopen("lib4.so", RTLD_NOW | RTLD_GLOBAL);
         bar = (void (*)()) dlsym(RTLD_DEFAULT, "foo");
         bar();
         dlclose(l4);
         dlclose(l3);
         dlclose(l2);
         dlclose(l1);
         return 0;
}

EOF
gcc chain2.c -o chain2 -ldl -D_GNU_SOURCE
#
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./chain2


May you please :
1/ Correct the bug in dlsym
OR 
2/ Correct :
   - dlsym MANPAGE 
   - LSB from at least 1.2
   - POSIX dlsym RTLD_NEXT descriptive section

Sorry to bother you with this, and many thanks in advance.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |drepper at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=1319

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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