summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-12-19 09:48:40 +0000
committerNick Clifton <nickc@redhat.com>2017-12-19 09:48:40 +0000
commitbef7475fbda88374ca488b0acbbfe1d3d4ab3e5f (patch)
tree18db482179474668dc0a04bcbac7cd33a74e06bc
parentbe62dcaa1771b5f2a47f0cfd78f89828f087efff (diff)
Stop readelf from complaining about relocation sections with an sh_info field of 0 in dynamic executables.
PR 22587 * readelf.c (process_section_headers): Do not complain about an sh_info field of 0 in relocation sections of ET_EXEC or ET_DYN type executables.
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/readelf.c13
2 files changed, 15 insertions, 5 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f83aa5ca79..714b20d974 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2017-12-19 Nick Clifton <nickc@redhat.com>
+
+ PR 22587
+ * readelf.c (process_section_headers): Do not complain about an
+ sh_info field of 0 in relocation sections of ET_EXEC or ET_DYN
+ type executables.
+
2017-12-19 Alan Modra <amodra@gmail.com>
* testsuite/binutils-all/ar.exp (unique_symbol): Don't run AR
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 8a31ebbd07..c6070f276d 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -6268,12 +6268,15 @@ process_section_headers (Filedata * filedata)
&& filedata->section_headers[section->sh_info].sh_type < SHT_LOOS))
{
if (section->sh_info == 0
- && (streq (SECTION_NAME (section), ".rel.dyn")
+ && (filedata->file_header.e_type == ET_EXEC
+ || filedata->file_header.e_type == ET_DYN
+ /* These next two tests may be redundant, but
+ they have been left in for paranoia's sake. */
+ || streq (SECTION_NAME (section), ".rel.dyn")
|| streq (SECTION_NAME (section), ".rela.dyn")))
- /* The .rel.dyn and .rela.dyn sections have an sh_info field
- of zero. The relocations in these sections may apply
- to many different sections. */
- ;
+ /* Dynamic relocations apply to segments, not sections, so
+ they do not need an sh_info value. */
+ ;
else
warn (_("[%2u]: Info field (%u) should index a relocatable section.\n"),
i, section->sh_info);