[PATCH] Use consistent type in binutils/dwarf.c

Eric Botcazou botcazou@adacore.com
Mon Jun 14 09:09:00 GMT 2021


Hi,

if you look at the type used for implicit_const objects in binutils/dwarf.c, 
you'll get sometimes bfd_signed_vma and sometimes dwarf_signed_vma:

static void
add_abbrev_attr (unsigned long   attribute,
                unsigned long   form,
                bfd_signed_vma  implicit_const,
                abbrev_list *   list)

[...]
         bfd_signed_vma implicit_const = -1;

[...]

static unsigned char *
read_and_display_attr_value (unsigned long           attribute,
			     unsigned long           form,
			     dwarf_signed_vma        implicit_const,


[...]

static unsigned char *
read_and_display_attr (unsigned long           attribute,
		       unsigned long           form,
		       dwarf_signed_vma        implicit_const,


They are the same on 64-bit hosts, but not on 32-bit hosts, and the latter 
discrepancy, in particular in process_abbrev_set, is responsible for the 
following error issued by objdump on some object files containing DWARF 5:

binutils/dwarf.c:1108: read LEB value is too large to store in destination 
variable

The attached patch changes the type to dwarf_signed_vma consistently.  OK for 
the mainline?


2021-06-14  Eric Botcazou  <ebotcazou@adacore.com>

binutils/
	* dwarf.c (struct abbrev_attr): Change type of implicit_const.
	(add_abbrev_attr): Likewise.
	(process_abbrev_set): Likewise.
	(display_debug_abbrev): Adjust to above change.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 1761 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20210614/cd18a834/attachment.bin>


More information about the Binutils mailing list