MIPS NPTL patches - Still not working

Dan E trg_info at mailhaven.com
Thu Apr 9 05:52:51 UTC 2009


Even with the patches I just sent, the result is still not a workable implementation
of NPTL on MIPS.  Here's what I see from the "ex1.c" sample test code in the tree's
test/pthread directory.

[root at testmipsel /root]# ldd ./ex1
        libpthread.so.0 => /lib/libpthread.so.0 (0x2aaf2000)
        libc.so.0 => /lib/libc.so.0 (0x2ab43000)
        libdl.so.0 => /lib/libdl.so.0 (0x2abdc000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
[root at testmipsel /root]# 

That doesn't look too bad, but when I run it I get a SEGFAULT.  I re-built turning
on uClibc's dynamic loader debugging features and this is the result.

[root at testmipsel /root]# ./ex1
_dl_get_ready_to_run:312: Cool, ldso survived making function calls
_dl_malloc:194: mmapping more memory
_dl_get_ready_to_run:496: Lib Loader: (0x2aaa8000) /lib/ld-uClibc.so.0
_dl_get_ready_to_run:435: calling mprotect on the application program
_dl_get_ready_to_run:806: Loading: (0x2aaf2000) /lib/libpthread.so.0
_dl_load_elf_shared_library:738: Found TLS header for /lib/libc.so.0
_dl_load_elf_shared_library:760: Relocated TLS initial image from 0x942a8 to 0x2abd72a8 (size = 0x0)
_dl_get_ready_to_run:806: Loading: (0x2ab43000) /lib/libc.so.0
_dl_get_ready_to_run:806: Loading: (0x2abdc000) /lib/libdl.so.0
_dl_get_ready_to_run:806: Loading: (0x2ab43000) /lib/libc.so.0
_dl_get_ready_to_run:806: Loading: (0x2ab43000) /lib/libc.so.0
_dl_get_ready_to_run:942: Calling init_tls()!
_dl_malloc:194: mmapping more memory
_dl_get_ready_to_run:947: Beginning relocation fixups
TLS_TPREL  : , 0xc, 0xffff900c
TLS_TPREL  : __libc_h_errno, 0x0, 0xffff9008
TLS_DTPMOD : __libc_resp, 0, 1
TLS_DTPREL : __libc_resp, 0xffff900c, 0xffff100c
TLS_TPREL  : __libc_resp, 0x0, 0xffff9000
TLS_TPREL  : __libc_errno, 0x0, 0xffff9004
TLS_TPREL  : __libc_tsd_RPC_VARS, 0xffff9000, 0xffff2010
TLS_TPREL  : errno, 0x0, 0xffff9000
TLS_DTPMOD : h_errno, 0, 1
TLS_DTPREL : h_errno, 0x0, 0xffff8000
TLS_TPREL  : __libc_errno, 0x0, 0xffff9000
TLS_TPREL  : __resp, 0x0, 0xffff9000
_dl_get_ready_to_run:976: Calling _dl_allocate_tls_init()!
Segmentation fault
[root at testmipsel /root]# 

I re-read Ulrich Drepper's NPTL paper again last week.  Twice.  I'm still not sure
how to interpret or trace what I'm seeing here.  The line numbers are familiar to me
since I've spent a lot of time with the code these last few weeks.  I recognize the
loop, for example, at "_dl_get_ready_to_run:806".  The TLS_xxxx labels are meaningless
to me, as are the offsets that begin with 0xffff....  Do the values above look reasonable?
Are they just negative offsets when added to unsigned 32-bit values?

Here's the result of mipsel-linux-uclibc-objdump -x ex1:

---------- output start -----------------------------------
[root at localhost bin]# ./mipsel-linux-uclibc-objdump -x ex1

ex1:     file format elf32-tradlittlemips
ex1
architecture: mips:isa32, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00400550

Program Header:
    PHDR off    0x00000034 vaddr 0x00400034 paddr 0x00400034 align 2**2
         filesz 0x000000c0 memsz 0x000000c0 flags r-x
  INTERP off    0x000000f4 vaddr 0x004000f4 paddr 0x004000f4 align 2**0
         filesz 0x00000014 memsz 0x00000014 flags r--
0x70000000 off    0x00000108 vaddr 0x00400108 paddr 0x00400108 align 2**2
         filesz 0x00000018 memsz 0x00000018 flags r--
    LOAD off    0x00000000 vaddr 0x00400000 paddr 0x00400000 align 2**12
         filesz 0x00000c04 memsz 0x00000c04 flags r-x
    LOAD off    0x00000c04 vaddr 0x00440c04 paddr 0x00440c04 align 2**12
         filesz 0x000000a4 memsz 0x000000bc flags rw-
 DYNAMIC off    0x00000120 vaddr 0x00400120 paddr 0x00400120 align 2**2
         filesz 0x000003a8 memsz 0x000003a8 flags rwx

Dynamic Section:
  NEEDED      libpthread.so.0
  NEEDED      libc.so.0
  INIT        0x4004c8
  FINI        0x400b20
  HASH        0x400200
  STRTAB      0x4003f0
  SYMTAB      0x4002a0
  STRSZ       0xd8
  SYMENT      0x10
  0x70000016  0x440c50
  DEBUG       0x0
  PLTGOT      0x440c60
  REL         0x0
  RELSZ       0x0
  RELENT      0x8
  0x70000001  0x1
  0x70000005  0x2
  0x70000006  0x400000
  0x7000000a  0x8
  0x70000011  0x15
  0x70000012  0x1b
  0x70000013  0xb
private flags = 50001007: [abi=O32] [mips32] [not 32bitmode]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .interp       00000014  004000f4  004000f4  000000f4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .reginfo      00000018  00400108  00400108  00000108  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA, LINK_ONCE_DISCARD
  2 .dynamic      000000e0  00400120  00400120  00000120  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .hash         000000a0  00400200  00400200  00000200  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynsym       00000150  004002a0  004002a0  000002a0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynstr       000000d8  004003f0  004003f0  000003f0  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .init         00000088  004004c8  004004c8  000004c8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  7 .text         00000560  00400550  00400550  00000550  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  8 .MIPS.stubs   00000070  00400ab0  00400ab0  00000ab0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  9 .fini         00000058  00400b20  00400b20  00000b20  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .rodata       00000080  00400b80  00400b80  00000b80  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 11 .eh_frame     00000004  00400c00  00400c00  00000c00  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 12 .ctors        00000008  00440c04  00440c04  00000c04  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 13 .dtors        00000008  00440c0c  00440c0c  00000c0c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 14 .jcr          00000004  00440c14  00440c14  00000c14  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 15 .data         00000030  00440c20  00440c20  00000c20  2**4
                  CONTENTS, ALLOC, LOAD, DATA
 16 .rld_map      00000004  00440c50  00440c50  00000c50  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 17 .got          00000048  00440c60  00440c60  00000c60  2**4
                  CONTENTS, ALLOC, LOAD, DATA
 18 .bss          00000010  00440cb0  00440cb0  00000ca8  2**4
                  ALLOC
 19 .comment      0000005a  00000000  00000000  00000ca8  2**0
                  CONTENTS, READONLY
 20 .debug_aranges 00000050  00000000  00000000  00000d08  2**3
                  CONTENTS, READONLY, DEBUGGING
 21 .debug_info   000000ee  00000000  00000000  00000d58  2**0
                  CONTENTS, READONLY, DEBUGGING
 22 .debug_abbrev 00000020  00000000  00000000  00000e46  2**0
                  CONTENTS, READONLY, DEBUGGING
 23 .debug_line   0000009e  00000000  00000000  00000e66  2**0
                  CONTENTS, READONLY, DEBUGGING
 24 .mdebug.abi32 00000000  0000009e  0000009e  00000f04  2**0
                  CONTENTS, READONLY
 25 .pdr          000000c0  00000000  00000000  00000f04  2**2
                  CONTENTS, READONLY

[root at localhost bin]# 
---------- end output -----------------------------------

I chopped off the SYMBOL TABLE output in the interest of brevity.
I can post that, too, if anyone thinks it might help.
If anyone has any suggestions about how to procede I'm all ears!
Thanks.

Dan E

-- 
http://www.fastmail.fm - Access your email from home and the web



More information about the uClibc mailing list