This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Warn if the sh_info field of a symbol table does not index the first non-local symbol in the section


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=52c3c391f4a4a38ca921e5e7b5dce92e62079f34

commit 52c3c391f4a4a38ca921e5e7b5dce92e62079f34
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Aug 12 20:36:20 2016 +0100

    Warn if the sh_info field of a symbol table does not index the first non-local symbol in the section.
    
    	* readelf.c (process_symbol_table): Generate a warning if a local
    	symbol is found at and offste greater than or equal to the sh_info
    	field of it's section header.

Diff:
---
 binutils/ChangeLog | 6 ++++++
 binutils/readelf.c | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index d21c299..5018e43 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2016-08-12  Nick Clifton  <nickc@redhat.com>
+
+	* readelf.c (process_symbol_table): Generate a warning if a local
+	symbol is found at and offste greater than or equal to the sh_info
+	field of it's section header.
+
 2016-08-08  Nick Clifton  <nickc@redhat.com>
 
 	PR binutils/20440
diff --git a/binutils/readelf.c b/binutils/readelf.c
index e6674c2..586d13c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -11114,6 +11114,11 @@ process_symbol_table (FILE * file)
 		}
 
 	      putchar ('\n');
+
+	      if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
+		  && si >= section->sh_info)
+		warn (_("local symbol %u found at index >= %s's sh_info value of %u\n"),
+		      si, printable_section_name (section), section->sh_info);
 	    }
 
 	  free (symtab);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]