This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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] | |
Sorry, please destroy my last mail because of miss.
Regarding to my last mips dlsym question, I investigated a little more.
And I think that such an attached process should be required.
(I don't know that this is enough.)
Because even though UNDEF symbol is found,
it can process as global symbol for the rare occasion.
This phenomena is showed only in mips. When libstdc++ is linked in
proior libc, the malloc's entry in libstdc++ MIPS.stubs table seemed to
be recognized as the malloc global symbol ...
How do you feel about it?
--- glibc-2.5/elf/do-lookup.h.org 2006-09-05 05:40:11.000000000 +0900
+++ glibc-2.5/elf/do-lookup.h 2008-01-29 11:17:40.000000000 +0900
@@ -222,7 +222,7 @@ do_lookup_x (const char *undef_name, uin
no possible ambiguities. */
sym = num_versions == 1 ? versioned_sym : NULL;
- if (sym != NULL)
+ if ((symidx != SHN_UNDEF) && (sym != NULL))
{
found_it:
switch (ELFW(ST_BIND) (sym->st_info))
# g++ -fPIC -c -g dlsymtest.cc -o dlsymtest.o
# g++ -ldl -g -shared -o dlsymtest.so dlsymtest.o
############### case 0: without -lstdc++ --- OK
# gcc -g test.c -o test.0
# readelf -a test.0 | less
...
Dynamic section at offset 0x180 contains 25 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000c (INIT) 0x40044c
0x0000000d (FINI) 0x4007f0
...
# export LD_PRELOAD=./dlsymtest.so
# ./test.0
# (OK)
############### case 1: -lc -lstdc++ --- OK
# gcc -g -lc -lstdc++ test.c -o test.1
# readelf -a test.1 | less
...
Dynamic section at offset 0x180 contains 26 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000c (INIT) 0x400464
0x0000000d (FINI) 0x400800
...
# export LD_PRELOAD=./dlsymtest.so
# ./test.1
# (OK)
############### case 2: -lstdc++ -lc --- SEGV
# gcc -g -lstdc++ -lc test.c -o test.2
# readelf -a test.2 | less
...
Dynamic section at offset 0x180 contains 26 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000c (INIT) 0x400464
0x0000000d (FINI) 0x400800
...
# export LD_PRELOAD=./dlsymtest.so
# ./test.2
Segmentation fault
Thank you.
Yoriko Komatsuzaki
Attachment:
test.c
Description: Binary data
Attachment:
dlsymtest.cc
Description: Binary data
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |