diff options
author | Alan Modra <amodra@gmail.com> | 2020-10-20 14:59:40 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-10-20 18:03:19 +1030 |
commit | b9e920ecd6f65bd37917b2f9e6d3fed9c8a60f66 (patch) | |
tree | 96973238c3e2fd9ef143ee1efd73308f6a78951d /gdb/testsuite/gdb.dwarf2/dw2-error.exp | |
parent | ce786647f0c54c9ca61bb6790a1d52a1c4781f82 (diff) | |
download | gdb-b9e920ecd6f65bd37917b2f9e6d3fed9c8a60f66.zip gdb-b9e920ecd6f65bd37917b2f9e6d3fed9c8a60f66.tar.gz gdb-b9e920ecd6f65bd37917b2f9e6d3fed9c8a60f66.tar.bz2 |
readelf.c display_lto_symtab offset outside bounds of constant string
Using gcc-10 or current mainline gcc, binutils configured with
--disable-nls results in:
readelf.c: In function 'display_lto_symtab':
readelf.c:12283:26: error: offset '17' outside bounds of constant string [-Werror=array-bounds]
12283 | SECTION_NAME (section) + strlen (".gnu.lto_.symtab.")) > 0
| ^
Which is actually a bogus warning in this case because we've already
checked the name string for validity, so SECTION_NAME won't ever be
"<none>", "<no-strings>" or "<corrupt>". This patch fixes the problem
by making SECTION_NAME simply return the string from the string table.
Other places also shouldn't be trying to match any of the error
strings against a section name, so fix them too.
* readelf.c: Delete whitespace at end of line throughout.
(SECTION_NAME, SECTION_NAME_VALID): New.
(SECTION_NAME_PRINT): Rename from SECTION_NAME. Formatting.
(printable_section_name, dump_relocations): Use SECTION_NAME_PRINT.
(process_section_headers, process_section_groups): Likewise.
(shdr_to_ctf_sect): Likewise.
(find_section, find_section_in_set): Use SECTION_NAME_VALID.
(ia64_process_unwind, hppa_process_unwind): Likewise.
(display_debug_section, initialise_dumps_byname): Likewise.
(process_lto_symbol_tables): Likewise. Check trailing period of
lto symbol table names.
(display_lto_symtab): Use sizeof instead of strlen.
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2/dw2-error.exp')
0 files changed, 0 insertions, 0 deletions