[PATCH] [binutils/readelf] Fix printing of dwarf5 .debug_info.dwo

Nick Clifton nickc@redhat.com
Thu May 30 11:03:12 GMT 2024


Hi Tom,

> Fix this by assuming a sane default for str_offsets_base for dwarf5: the size
> of the header of the .debug_str_offsets section, which is 8 for 32-bit dwarf
> and 16 for 64-bit dwarf.
> 
> Implement this by moving the reading of DW_AT_str_offsets_base to read_bases,
> which also fixes the printing of DW_FORM_strx strings in the skeleton
> compilation unit entries for attributes before the DW_AT_str_offsets_base
> attribute.
> 
> Conforming with the other code in read_bases, we only handle
> DW_FORM_sec_offset, which means the code dealing with negative
> str_offsets_base can be dropped.
> 
> Tested on x86_64-linux.

The patch itself looks fine, but the new test fails for some targets, such as:

   alpha-linux-gnu
   mipsisa64r6-elf
   nios2-elf

The failure message looks like this:

   output: readelf: Warning: DIE at offset 0x14 refers to abbreviation number 15349 which does not exist

Also the sh-elf target fails but for a different reason:

   readelf-str-offsets-base.s: Assembler messages:
   readelf-str-offsets-base.s:17: Error: misaligned data

Would you mind taking a look at these please ?

It is OK to skip the test for a particular architecture if there
is a good reason for it.  But if you do decide to do that, please
add the reason into the test driver file as a comment.

Cheers
   Nick




More information about the Binutils mailing list