diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2021-06-14 15:43:19 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2021-06-14 15:45:55 +0200 |
commit | 0121f438e83e06efd29e43779edf4a01004a39ff (patch) | |
tree | e5abd2f0fa0caee9825852dc427a8bf2227acc18 /binutils | |
parent | 90d3edf01630093142e833235abea548aa78e65b (diff) | |
download | gdb-0121f438e83e06efd29e43779edf4a01004a39ff.zip gdb-0121f438e83e06efd29e43779edf4a01004a39ff.tar.gz gdb-0121f438e83e06efd29e43779edf4a01004a39ff.tar.bz2 |
Use consistent type in binutils/dwarf.c
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.
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
binutis/
* 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.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 7 | ||||
-rw-r--r-- | binutils/dwarf.c | 20 |
2 files changed, 17 insertions, 10 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1297d27..7a9fa1d 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2021-06-14 Eric Botcazou <ebotcazou@adacore.com> + + * 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. + 2021-06-12 Alan Modra <amodra@gmail.com> * readelf.c (process_file_header): Don't clear section_headers. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index b3ec890..ebc7b02 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -823,7 +823,7 @@ typedef struct abbrev_attr { unsigned long attribute; unsigned long form; - bfd_signed_vma implicit_const; + dwarf_signed_vma implicit_const; struct abbrev_attr * next; } abbrev_attr; @@ -998,19 +998,19 @@ add_abbrev (unsigned long number, } static void -add_abbrev_attr (unsigned long attribute, - unsigned long form, - bfd_signed_vma implicit_const, - abbrev_list * list) +add_abbrev_attr (unsigned long attribute, + unsigned long form, + dwarf_signed_vma implicit_const, + abbrev_list * list) { abbrev_attr *attr; attr = (abbrev_attr *) xmalloc (sizeof (*attr)); - attr->attribute = attribute; - attr->form = form; + attr->attribute = attribute; + attr->form = form; attr->implicit_const = implicit_const; - attr->next = NULL; + attr->next = NULL; assert (list != NULL && list->last_abbrev != NULL); @@ -1085,7 +1085,7 @@ process_abbrev_set (struct dwarf_section *section, { unsigned long form; /* Initialize it due to a false compiler warning. */ - bfd_signed_vma implicit_const = -1; + dwarf_signed_vma implicit_const = -1; READ_ULEB (attribute, start, end); if (start == end) @@ -6255,7 +6255,7 @@ display_debug_abbrev (struct dwarf_section *section, get_AT_name (attr->attribute), get_FORM_name (attr->form)); if (attr->form == DW_FORM_implicit_const) - printf (": %" BFD_VMA_FMT "d", attr->implicit_const); + printf (": %s", dwarf_vmatoa ("d", attr->implicit_const)); putchar ('\n'); } } |