[binutils-gdb] readelf: Only check for out of bounds local symbols in object files
Nick Clifton
nickc@sourceware.org
Mon Dec 8 15:13:00 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6d7e5bcca578f3fa21d89275d96986ad5be35b08
commit 6d7e5bcca578f3fa21d89275d96986ad5be35b08
Author: Alan Modra <amodra@gmail.com>
Date: Mon Dec 8 15:12:26 2025 +0000
readelf: Only check for out of bounds local symbols in object files
Diff:
---
binutils/readelf.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index b001d717746..9e89a54174e 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -14811,17 +14811,17 @@ print_symbol (Filedata * filedata,
warn (_("local symbol %" PRIu64 " found at index >= %s's sh_info value of %u\n"),
symbol_index, printable_section_name (filedata, section), section->sh_info);
- /* Local symbols whose value is larger than their section's size are suspicious
- especially if that section is mergeable - and hence might change offsets of
- the contents inside the section.
- Note - for some reason we can get mapping symbols that do not relate to their
+ /* Local symbols (in objec files) whose value is larger than their section's
+ size are suspicious especially if that section is mergeable - and hence
+ might change offsets of the contents inside the section. Note - for
+ some reason we can get mapping symbols that do not relate to their
section's contents - so we ignore those type of symbol as well. */
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
+ && filedata->file_header.e_type == ET_REL
&& ! is_special
&& is_valid
&& psym->st_shndx < filedata->file_header.e_shnum
&& filedata->section_headers != NULL
- /* FIXME: Should we warn for non-mergeable sections ? */
&& (filedata->section_headers[psym->st_shndx].sh_flags & SHF_MERGE)
&& psym->st_value > filedata->section_headers[psym->st_shndx].sh_size
&& ! is_mapping_symbol (strtab + psym->st_name))
More information about the Binutils-cvs
mailing list