* Link the test programs with --export-dynamic. This shows that my previous

assumption, that the program image is ignored when relocating symbols of
  dlopen()ed objects, is incorrect.
* Adjusted the tests that were failing due to that.
* The RTLD_NEXT test also fails with openSuse 10.3 -- apparently the semantics
  has changed between the Linux versions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29111 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-02-01 18:16:46 +00:00
parent 7ac433fc8c
commit 06828840d7
21 changed files with 27 additions and 37 deletions
@@ -93,7 +93,6 @@ main()
void* liba; void* liba;
void* libe; void* libe;
void* self; void* self;
// int (*a)();
libe = dlopen("./libe.so", RTLD_NOW | RTLD_GLOBAL); libe = dlopen("./libe.so", RTLD_NOW | RTLD_GLOBAL);
if (libe == NULL) { if (libe == NULL) {
@@ -107,20 +106,12 @@ main()
exit(117); exit(117);
} }
/*
a = (int (*)())dlsym(libe, "a");
if (a == NULL) {
fprintf(stderr, "Error getting symbol a: %s\n", dlerror());
exit(116);
}
*/
return a(); return a();
} }
EOI EOI
# build # build
gcc -o program program.c -D_GNU_SOURCE $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c -D_GNU_SOURCE $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 31 test_run_ok ./program 31
@@ -83,7 +83,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -83,7 +83,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 2 test_run_ok ./program 2
@@ -79,7 +79,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 2 test_run_ok ./program 2
@@ -83,7 +83,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -5,8 +5,7 @@
# dlopen(): # dlopen():
# liba.so # liba.so
# #
# Expected: Undefined symbol in liba.so might resolve to symbol in program, but # Expected: Undefined symbol in liba.so resolve to symbol in program.
# the program image is ignored, so dlopen() on liba.so fails.
. test_setup . test_setup
@@ -54,7 +53,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 117 test_run_ok ./program 1
@@ -60,7 +60,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c ./libb.so $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c ./libb.so $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -70,7 +70,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -6,8 +6,8 @@
# libb.so # libb.so
# liba.so # liba.so
# #
# Expected: Undefined symbol in liba.so resolves to symbol in libb.so, not # Expected: Undefined symbol in liba.so resolves to symbol in program, not
# to symbol in program, since program image is ignored. # to symbol in libb.so.
. test_setup . test_setup
@@ -70,8 +70,8 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 2 test_run_ok ./program 1
@@ -80,7 +80,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 2 test_run_ok ./program 2
@@ -77,7 +77,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 2 test_run_ok ./program 2
@@ -87,7 +87,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 2 test_run_ok ./program 2
@@ -97,7 +97,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 2 test_run_ok ./program 2
@@ -105,7 +105,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -77,7 +77,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -73,8 +73,8 @@ main()
EOI EOI
# build # build
gcc -o program program.c -D_GNU_SOURCE ./liba.so $libdl -Xlinker -rpath \ gcc -o program program.c -D_GNU_SOURCE ./liba.so $libdl \
-Xlinker . -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 15 test_run_ok ./program 15
@@ -37,7 +37,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c ./liba.so gcc -o program program.c ./liba.so -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -50,7 +50,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c ./liba.so ./libb.so -Xlinker -rpath -Xlinker . gcc -o program program.c ./liba.so ./libb.so -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -50,7 +50,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c ./libb.so ./liba.so -Xlinker -rpath -Xlinker . gcc -o program program.c ./libb.so ./liba.so -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -51,7 +51,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c ./liba.so ./libb.so -Xlinker -rpath -Xlinker . gcc -o program program.c ./liba.so ./libb.so -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1
@@ -45,7 +45,7 @@ main()
EOI EOI
# build # build
gcc -o program program.c ./libb.so -Xlinker -rpath -Xlinker . gcc -o program program.c ./libb.so -Wl,-rpath,.,--export-dynamic
# run # run
test_run_ok ./program 1 test_run_ok ./program 1