Bug 203

Summary: Elf loader unable to load shared libraries(m68k/coldfire/m5485).
Product: uClibc Reporter: Marius Groleo <groleo>
Component: Shared Library SupportAssignee: unassigned
Status: RESOLVED FIXED    
Severity: critical CC: uclibc-cvs
Priority: P5    
Version: 0.9.30.1   
Target Milestone: 0.9.31   
Hardware: Other   
OS: Linux   
Host: i486-pc-linux-gnu Target: m68k-unknown-linux-uclibc
Build:
Attachments: ld.so generated output.
patch to add debugging _dl_dprintf calls in dl-elf.c

Description Marius Groleo 2009-03-19 19:11:01 UTC
Created attachment 173 [details]
ld.so generated output.

Hi,

I'm currently having trouble getting uClibc 0.9.30.1 to work on m68k/m5485
processor. It gets stuck when trying to load the first shared library,
libgcc_s.so.
In my attempt to debug the problem I added _dl_dprintf calls.
All the debug lines are prefixed by filename and line.

I tried to watch the trace of any parameter used in any _dl_mmap call.
I identified these parameters as being(sorry for the long list):
   minvma, maxvma, libaddr, status, piclibc, mmap protection flags,
       tryaddr, piclib2map, ppnt->p_vaddr, dynamic_addr, lib_loadaddr.

The first mapping is done here[ldso/ldso/dl-elf.c:468
libaddr=status'0x80016000']
requesting 0xe000 bytes. The second mapping is tried
here[ldso/ldso/dl-elf.c:586 status'0xffffffff']
but fails. The reason why I *think* it fails is overlapping memory areas.
Here, ldso/ldso/dl-elf.c:563 tryaddr'0x80023000' the address where a mapping
is needed is 0x80023000, but if you add 0x80016000(the first mapping) with
0xE000 you get 0x80024000, which overlaps over the second solicited
address(0x80023000).

Attached you will find the debug.log and the _dl_dprintf patch for
ldso/ldso/dl-elf.c.

mariusn ~ > m68k-unknown-linux-uclibc-readelf -l ./libgcc_s.so.2

Elf file type is DYN (Shared object file)
Entry point 0x20d4
There are 5 program headers, starting at offset 52

Program Headers:
 Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
 LOAD           0x000000 0x00000000 0x00000000 0x0b108 0x0b108 R E 0x2000
 LOAD           0x00b108 0x0000d108 0x0000d108 0x00264 0x003b8 RW  0x2000
 DYNAMIC        0x00b11c 0x0000d11c 0x0000d11c 0x000d0 0x000d0 RW  0x4
 GNU_EH_FRAME   0x00a59c 0x0000a59c 0x0000a59c 0x001cc 0x001cc R   0x4
 GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

 Section to Segment mapping:
 Segment Sections...
  00     .hash .dynsym .dynstr .gnu.version .gnu.version_d .rela.dyn
.rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
  01     .ctors .dtors .jcr .dynamic .got .data .bss
  02     .dynamic
  03     .eh_frame_hdr
  04

Many thanks.
Comment 1 Marius Groleo 2009-03-19 19:12:13 UTC
Created attachment 175 [details]
patch to add debugging _dl_dprintf calls in dl-elf.c
Comment 2 Bernhard Reutner-Fischer 2010-03-03 20:17:07 UTC
This should be fixed on master. Please confirm.
Comment 3 Marius Groleo 2010-03-04 08:37:52 UTC
Fix confirmed.