aboutsummaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-04-04 12:53:33 +0100
committerNick Clifton <nickc@redhat.com>2016-04-04 12:53:33 +0100
commit67f101eece4327a7c9e13f257fe76f8082a5e336 (patch)
tree23720406c938c589efe15bdf8b1aa8f8e7e956a4 /bfd/dwarf2.c
parent26cdfd92055ece05e1abb5248ddb78f3386f857b (diff)
downloadgdb-67f101eece4327a7c9e13f257fe76f8082a5e336.zip
gdb-67f101eece4327a7c9e13f257fe76f8082a5e336.tar.gz
gdb-67f101eece4327a7c9e13f257fe76f8082a5e336.tar.bz2
Ignore DWARF debug information with a version of 0 - assume that it is padding.
PR 19872 bfd * dwarf2.c (parse_comp_unit): Skip warning about unrecognised version number if the version is zero. bin * dwarf.c (display_debug_aranges): Skip warning about unrecognised version number if the version is zero.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index addfbf5..33370ac 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2757,11 +2757,18 @@ parse_comp_unit (struct dwarf2_debug *stash,
if (version != 2 && version != 3 && version != 4)
{
- (*_bfd_error_handler)
- (_("Dwarf Error: found dwarf version '%u', this reader"
- " only handles version 2, 3 and 4 information."), version);
- bfd_set_error (bfd_error_bad_value);
- return 0;
+ /* PR 19872: A version number of 0 probably means that there is padding
+ at the end of the .debug_info section. Gold puts it there when
+ performing an incremental link, for example. So do not generate
+ an error, just return a NULL. */
+ if (version)
+ {
+ (*_bfd_error_handler)
+ (_("Dwarf Error: found dwarf version '%u', this reader"
+ " only handles version 2, 3 and 4 information."), version);
+ bfd_set_error (bfd_error_bad_value);
+ }
+ return NULL;
}
if (addr_size > sizeof (bfd_vma))
@@ -2772,7 +2779,7 @@ parse_comp_unit (struct dwarf2_debug *stash,
addr_size,
(unsigned int) sizeof (bfd_vma));
bfd_set_error (bfd_error_bad_value);
- return 0;
+ return NULL;
}
if (addr_size != 2 && addr_size != 4 && addr_size != 8)
@@ -2781,22 +2788,23 @@ parse_comp_unit (struct dwarf2_debug *stash,
("Dwarf Error: found address size '%u', this reader"
" can only handle address sizes '2', '4' and '8'.", addr_size);
bfd_set_error (bfd_error_bad_value);
- return 0;
+ return NULL;
}
/* Read the abbrevs for this compilation unit into a table. */
abbrevs = read_abbrevs (abfd, abbrev_offset, stash);
if (! abbrevs)
- return 0;
+ return NULL;
abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, end_ptr);
info_ptr += bytes_read;
if (! abbrev_number)
{
- (*_bfd_error_handler) (_("Dwarf Error: Bad abbrev number: %u."),
- abbrev_number);
- bfd_set_error (bfd_error_bad_value);
- return 0;
+ /* PR 19872: An abbrev number of 0 probably means that there is padding
+ at the end of the .debug_abbrev section. Gold puts it there when
+ performing an incremental link, for example. So do not generate
+ an error, just return a NULL. */
+ return NULL;
}
abbrev = lookup_abbrev (abbrev_number, abbrevs);
@@ -2805,7 +2813,7 @@ parse_comp_unit (struct dwarf2_debug *stash,
(*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."),
abbrev_number);
bfd_set_error (bfd_error_bad_value);
- return 0;
+ return NULL;
}
amt = sizeof (struct comp_unit);