From: GOTO M. <go...@de...> - 2001-10-13 08:57:06
|
Hi, I'm trying to make pure-debian chroot environment on ps2, and got and extracted many packages from debian project archives. It seems that binaries work fine, static library is ok. But, only shared binaries do not work! Below is the example of this situation. I got packages: `lv' (text viewer binary. You can find same original ps2 package in /usr/bin/lv), `libncurses' (it has /lib/libncurses.so.5.0), `libncurses-dev' (it has /usr/lib/libncurses.a). lv depends on libncurses (> 4.0) and libc. I extracted lv in tmpdir, it required /lib/libncurses.5.0 and complained/exited (because debian's lv was compiled under with libncurses.5.0 but original ps2 environment has only libncurses.4.0). Then I extracted libncurses.5.0 into appropriate dir, but lv did not work. Why? I used ldd and then got the result: > ldd debian_libncurses.5.0.so not a dynamic executable ??? Kondara PS2 original ldd and libc couldnot understand it was shared library or not... Then I used readelf for both PS2 original libncurses.so and debian's libncurses.so. and found that the internal addresses of PS2 original share library are very curious! > readelf -a debian_libncurses.5.0.so ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Type: DYN (Shared object file) Machine: MIPS R3000 big-endian Version: 0x1 Data: ELFDATA2LSB (little endian) *GOOD, Entry point address: 0x5180 but not Start of program headers: 52 (bytes into file) work!* Start of section headers: 325296 (bytes into file) Flags: 0x3, noreorder, pic, mips1 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 4 Size of section headers: 40 (bytes) Number of section headers: 21 Section header string table index: 20 Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .reginfo MIPS_REGINFO 000000b4 0000b4 000018 18 A 0 0 4 [ 2] .dynamic DYNAMIC 000000cc 0000cc 0000c8 08 A 5 0 4 [ 3] .hash HASH 00000194 000194 001110 04 A 4 0 4 [ 4] .dynsym DYNSYM 000012a4 0012a4 002390 10 A 5 16 4 [ 5] .dynstr STRTAB 00003634 003634 00161e 00 A 0 0 1 [ 6] .gnu.version VERSYM 00004c52 004c52 000472 02 A 4 0 2 [ 7] .gnu.version_r VERNEED 000050c4 0050c4 000030 00 A 5 1 4 [ 8] .init PROGBITS 000050f4 0050f4 00008c 00 AX 0 0 4 [ 9] .text PROGBITS 00005180 005180 033730 00 AX 0 0 16 [10] .fini PROGBITS 000388b0 0388b0 00004c 00 AX 0 0 4 [11] .rodata PROGBITS 00038900 038900 0075d0 00 A 0 0 16 [12] .rel.dyn REL 0003fed0 03fed0 007788 08 A 4 0 16 [13] .data PROGBITS 00087660 047660 007ac0 00 WA 0 0 16 [14] .eh_frame PROGBITS 0008f120 04f120 000004 00 WA 0 0 4 [15] .ctors PROGBITS 0008f124 04f124 000008 00 WA 0 0 4 [16] .dtors PROGBITS 0008f12c 04f12c 000008 00 WA 0 0 4 [17] .got PROGBITS 0008f140 04f140 0004bc 04 WA 0 0 16 [18] .sbss NOBITS 0008f5fc 04f5fc 000000 00 WA 0 0 1 [19] .bss NOBITS 0008f600 04f600 002d80 00 WA 0 0 16 [20] .shstrtab STRTAB 00000000 04f600 0000b0 00 0 0 1 [snip...] > readelf -a ps2_original_libncurses.4.2.so ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Type: DYN (Shared object file) Machine: MIPS R3000 big-endian Version: 0x1 Data: ELFDATA2LSB (little endian) *Broken, Entry point address: 0x5ffe5590 however Start of program headers: 52 (bytes into file) work!* Start of section headers: 386888 (bytes into file) Flags: 0x20920003, noreorder, pic, mips3 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 5 Size of section headers: 40 (bytes) Number of section headers: 23 Section header string table index: 22 Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 *Broken!* [ 1] .reginfo MIPS_REGINFO 5ffe0100 000100 000018 18 A 0 0 16 [ 2] .dynamic DYNAMIC 5ffe0120 000120 0000e0 08 A 5 0 16 [ 3] .hash HASH 5ffe0200 000200 00118c 00 A 4 0 16 [ 4] .dynsym DYNSYM 5ffe1390 001390 002580 10 A 5 17 16 [ 5] .dynstr STRTAB 5ffe3910 003910 001730 00 A 0 0 16 [ 6] .gnu.version VERSYM 5ffe5040 005040 0004b0 02 A 4 0 2 [ 7] .gnu.version_r VERNEED 5ffe54f0 0054f0 000030 00 A 5 1 4 [ 8] .init PROGBITS 5ffe5520 005520 000064 00 AX 0 0 8 [ 9] .text PROGBITS 5ffe5590 005590 02d7a0 00 AX 0 0 16 [10] .fini PROGBITS 60012d30 032d30 000058 00 AX 0 0 8 [11] .rodata PROGBITS 60012d90 032d90 0075c0 00 A 0 0 16 [12] .rel.dyn REL 6001a350 03a350 007780 08 A 4 0 16 [13] .data PROGBITS 60061ad0 041ad0 007ac0 00 WA 0 0 16 [14] .eh_frame PROGBITS 60069590 049590 000004 00 WA 0 0 4 [15] .ctors PROGBITS 60069594 049594 000008 00 WA 0 0 4 [16] .dtors PROGBITS 6006959c 04959c 000008 00 WA 0 0 4 [17] .got PROGBITS 600695b0 0495b0 000928 04 WA 0 0 16 [18] .sbss NOBITS 60069ed8 049ed8 000000 00 WA 0 0 1 [19] .bss NOBITS 60069ee0 049ee0 002d30 00 WA 0 0 16 [20] .compact_rel PROGBITS 6006cc10 049ee4 00d20c 00 0 0 4 [21] .rtproc PROGBITS 00000000 0570f0 007590 00 0 0 16 [22] .shstrtab STRTAB 00000000 05e680 0000c5 00 0 0 1 [snip]... You can find easily that ps2 shared library entry point indicates bad address "0x5ffe5590". Normally this address should be such a debian's address "0x5180". This problem has occured on only shared libraries. Elf binaries and static binaries are ok. I investigated shared libraries with readelf on other architectures like intel, sparc64, parisc, ..., but their entry point address never started such a large address "0x5ffe5590". It means that current shared libraries on original ps2linux have and run with *BAD ADDRESS*. I recompiled libncurses.5.0.so, but it had also bad address (and worked fine)... so I think it's toolchain problem, moreover ps2linux loader/kernel/libc is designed with this bad address! Do you know some information about it? I want to fix it (because of keeping binary compatibility between other mips little endian architectures). Any comments are welcomed. -- gotom |