MIPS: 64-bit DWARF (was: debug problem with prelinked libraries)

Thomas Schwinge thomas@codesourcery.com
Tue Jul 6 09:59:00 GMT 2010


On 2010-07-01 15:43, I wrote:
> On 2010-05-07 13:23, Jan Kratochvil wrote:
>> On Wed, 05 May 2010 16:59:36 +0200, Andrew Stubbs wrote:
>>> > prelink includes code to manipulate the contents of the debug info.
>> [...]
>>> Maybe prelink has failed to relocate the debug info in this case?
>> The attached patch should fix it.
>> Although SHT_MIPS_DWARF value should be recognized only for e_machine as
>> EM_MIPS or EM_MIPS_RS3_LE or EM_MIPS_X?  Or are there some other rules?
>> --- prelink/src/dso.c-orig	2010-04-13 16:41:15.000000000 +0200
>> +++ prelink/src/dso.c	2010-05-07 15:16:25.000000000 +0200
>> @@ -1381,6 +1381,7 @@ adjust_dso (DSO *dso, GElf_Addr start, G
>>        switch (dso->shdr[i].sh_type)
>>  	{
>>  	case SHT_PROGBITS:
>> +	case SHT_MIPS_DWARF:
>>  	  name = strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i].sh_name);
>>  	  if (strcmp (name, ".stab") == 0
>>  	      && adjust_stabs (dso, i, start, adjust))
> Unfortunately, this patch causes the following regression for about every
> test of the prelink testsuite, in -mabi=64 configurations (only):
>     mips-wrs-linux-gnu-prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=./ld.so.1 -vm ./reloc1
>     Laying out 4 libraries in virtual address space 0000005800000000-0000009800000000
>     Assigned virtual address space slots for libraries:
>     ./ld.so.1                                                    0000005800000000-0000005800032328
>     ./libc.so.6                                                  0000005800040000-00000058001cbdb0
>     ./reloc1lib1.so                                              00000058001d0000-00000058001e0b10
>     ./reloc1lib2.so                                              00000058001f0000-00000058002009d0
>     Prelinking /scratch/thomas/issue8927/obj/test-4.3a-294-mips-wrs-linux-gnu/host-i686-pc-linux-gnu/mabi_64/prelink.d/ld-2.8.so
>     mips-wrs-linux-gnu-prelink: /scratch/thomas/issue8927/obj/test-4.3a-294-mips-wrs-linux-gnu/host-i686-pc-linux-gnu/mabi_64/prelink.d/ld-2.8.so: 64-bit DWARF not supported

This happens when processing .debug_lines, which is generated by GAS.

prelink does not support the 64-bit DWARF format.  From a quick glance,
GDB does, see dwarf2read.c:read_initial_length.

MIPS is, per gas/config/tc-mips, the only architecture to override
DWARF2_FORMAT (which defaults to 32-bit), and thus possibly can emit
64-bit DWARF code, which it actually does for -mabi=64, see

In <http://sourceware.org/ml/binutils/2002-11/msg00429.html> this 64-bit
DWARF format support has originally been added.

What's our way forward?  Can we switch MIPS back to only using the 32-bit
DWARF format (save the IRIX case)?  Do we need to extend prelink?

As I understand the GCC code, it always uses the 32-bit DWARF format,
even for MIPS 64-bit ABIs.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb/attachments/20100706/6e63fb71/attachment.sig>

More information about the Gdb mailing list