[PATCH]: Fix readelf's knowledge of h8300 reloc sizes
Nick Clifton
nickc@redhat.com
Tue Feb 6 15:12:00 GMT 2007
Hi Guys,
I am going to apply the attached patch fix a problem with readelf
exposed by PR 3800. The failure of the lns-common-1 test for the
h8300 target is due to the fact that readelf assumes that all relocs
for debug sections apply to 32-bit values. For the h8300 this is
not true, as some of the relocs only affect 16-bits.
In order to fix this I have created a new function: get_reloc_size()
which has code to handle the h8300 as a special case. This is not
the ideal way to resolve this problem, but if it turns out that only
a few ports are affected by the 32-bit assumption, then this method
is the simplest.
In the course of fixing this bug I also found that we were not
displaying all of the DW_AT_language values that are defined in the
elf/dwarf.h header. I also noticed that when we dump a section
(using readelf's -x command line option), that section is not
relocated. This makes sense, but it can be confusing when at other
times readelf works with a relocated section. So I have added a
warning message to remind the user that the display section contents
are not relocated.
Finally I have also extended the output of the -wi command line
option, so that when it is displaying the decoded attribute values
inside a .debug.info section, it includes the offsets into the
section of each of the attribute's tags. This makes it much easier
to relate the tags back to the actual binary contents of the
section, as displayed by the -x command line option.
Cheers
Nick
binutils/ChangeLog
2007-02-06 Nick Clifton <nickc@redhat.com>
PR gas/3800
* readelf.c: Include elf/h8.h twice. The first time in order to
get the reloc numbers, the second time in order to get the reloc
decoder function.
(dump_section): Tell the user if the section being displayed has
unprocessed relocs associated with it.
(get_reloc_size): New function - returns the size of a reloc.
(debug_apply_rela_addends): Use get_reloc_size().
* dwarf.c (read_and_display_attr_value): Extend number of
languages know for the DW_AT_language attribute.
(process_debug_info): Display the attribute offset before decoding
the attribute, in case there are problems.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: readelf.patch.bz2
Type: application/x-bzip2
Size: 3265 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20070206/2cbc790b/attachment.bz2>
More information about the Binutils
mailing list