11 # Expected: dlsym(RTLD_NEXT) finds symbol in order libe.so, liba.so, libb.so,
24 compile_lib
-o libd.so libd.c
35 *(void**)&nextA = dlsym(RTLD_NEXT, "a");
36 return (nextA != 0 ? nextA() : 0) + 2;
41 compile_lib_dl
-o libb.so libb.c .
/libd.so
51 *(void**)&nextA = dlsym(RTLD_NEXT, "a");
52 return (nextA != 0 ? nextA() : 0) + 4;
57 compile_lib_dl
-o liba.so liba.c .
/libb.so
67 *(void**)&nextA = dlsym(RTLD_NEXT, "a");
68 return (nextA != 0 ? nextA() : 0) + 8;
73 compile_lib_dl
-o libe.so libe.c
77 cat > program.c
<< EOI
86 *(void**)&nextA = dlsym(RTLD_NEXT, "a");
87 return (nextA != 0 ? nextA() : 0) + 16;
97 libe = dlopen("./libe.so", RTLD_NOW | RTLD_GLOBAL);
99 fprintf(stderr, "Error opening libe.so: %s\n", dlerror());
103 liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL);
105 fprintf(stderr, "Error opening liba.so: %s\n", dlerror());
114 compile_program_dl
-o program program.c
117 test_run_ok .
/program
31