From: Jan Beulich Date: Mon, 7 Jun 2021 06:37:42 +0000 (+0200) Subject: fix Dwarf2 build with certain gcc versions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6bee34a1dc94dcfbf84b6318a731e6b059b39977;p=binutils-gdb.git fix Dwarf2 build with certain gcc versions Older gcc reports: .../bfd/dwarf2.c: In function 'read_ranges': .../bfd/dwarf2.c:3107: error: comparison between signed and unsigned .../bfd/dwarf2.c: In function 'read_rnglists': .../bfd/dwarf2.c:3189: error: comparison between signed and unsigned Similarly for binutils/dwarf.c. Arrange for the left sides of the > to also be unsigned quantities. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7857b70cf06..04e3679ab54 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2021-06-07 Jan Beulich + + * dwarf2.c (read_ranges, read_rnglists): Add u suffix to constant. + 2021-06-02 Alan Modra * elf-attrs.c (_bfd_elf_parse_attributes): Break out of loop if diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 4b169fca462..79fcd0618d8 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -3104,7 +3104,7 @@ read_ranges (struct comp_unit *unit, struct arange *arange, bfd_vma high_pc; /* PR 17512: file: 62cada7d. */ - if (2 * unit->addr_size > (size_t) (ranges_end - ranges_ptr)) + if (2u * unit->addr_size > (size_t) (ranges_end - ranges_ptr)) return false; low_pc = read_address (unit, &ranges_ptr, ranges_end); @@ -3186,7 +3186,7 @@ read_rnglists (struct comp_unit *unit, struct arange *arange, break; case DW_RLE_start_end: - if (2 * unit->addr_size > (size_t) (rngs_end - rngs_ptr)) + if (2u * unit->addr_size > (size_t) (rngs_end - rngs_ptr)) return false; low_pc = read_address (unit, &rngs_ptr, rngs_end); high_pc = read_address (unit, &rngs_ptr, rngs_end); diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 9ff312cf427..009a9e73058 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2021-06-07 Jan Beulich + + * dwarf.c (display_debug_aranges): Add u suffix to constant. + 2021-05-29 Alan Modra * objdump (usage): Add missing \n. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index cfc1436df64..b3ec8909054 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -7284,7 +7284,7 @@ display_debug_aranges (struct dwarf_section *section, start = end_ranges; - while (2 * address_size <= (size_t) (start - addr_ranges)) + while (2u * address_size <= (size_t) (start - addr_ranges)) { SAFE_BYTE_GET_AND_INC (address, addr_ranges, address_size, start); SAFE_BYTE_GET_AND_INC (length, addr_ranges, address_size, start);