This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Improve readelf's application of relocs to debug sections


Hi Guys,

  I am going to apply the attached patch to make some improvements to
  readelf's ability to apply relocs to debug sections before
  displaying their content.  The patch adds explicit checks for the
  expected relocs and their sizes, and causes readelf to skip and warn
  about any reloc types that it is not expecting.  It also extends the
  checks for the size of the reloc to allow for 64-bit and 16-bit relocs.

  One thing it does not currently do is fully implement the
  pc-relative relocs applied to the .debug.eh-range sections of some
  architectures.  (It implements them as absolute relocs, as was done
  before this patch).  When I tried enabling pc-relative behaviour I
  found that lots of the gas CFI tests broke, and I could not tell if
  the gas tests were wrong on my pc-relative code.  So for now I am
  leaving things as they are.

Cheers
  Nick

binutils/ChangeLog
2007-10-28  Nick Clifton  <nickc@redhat.com>

	* dwarf.c (process_debug_info): Check for corrupt lengths.
	* readelf.c (get_reloc_type): New function.  Returns the reloc
	number extracted from the info field of a reloc.
	(get_reloc_symindex): New function.  Returns the symbol index
	extracted from tha info field of a reloc.
	(dump_relocations): Use the new functions.
	(slurp_ia64_unwind_table): Use the new functions.
	(slurp_hppa_unwind_table): Use the new functions.
	(dump_section_as_bytes): Use the new functions.
	(get_reloc_size): Delete function.
	(is_32bit_abs_reloc): New function.  Determines if a given reloc
	type is a 32-bit absolute relocation.
	(is_32bit_pcrel_reloc): New function.  Like is_32bit_abs_reloc but
	for pc-relative relocations.
	(is_64bit_abs_reloc): New function.  Like is_32bit_abs_reloc but
	for 64-bit absolute relocations.
	(is_16bit_abs_reloc): New function.  Like is_32bit_abs_reloc but
	for 32-bit absolute relocations.
	(debug_apply_rela_addends): Use the new functions.  Skip and warn
	about any unrecognised relocations.

Attachment: readelf.relocs.patch.bz2
Description: BZip2 compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]