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] Remind users to use the --use-dynamic command line option to dump dynamic relocations.


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

commit 45ac8f4f107f50d77a8514ee8a244b82c1a8ea0c
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Oct 31 13:48:03 2017 +0000

    Remind users to use the --use-dynamic command line option to dump dynamic relocations.
    
    	* readelf.c (process_relocs): Tell users if no static relocs were
    	found, but if they had added --use-dynamic to the command line
    	then relocs would have been displayed.

Diff:
---
 binutils/ChangeLog |  6 ++++++
 binutils/readelf.c | 16 +++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index d0cd3c7..951807f 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-31  Nick Clifton  <nickc@redhat.com>
+
+	* readelf.c (process_relocs): Tell users if no static relocs were
+	found, but if they had added --use-dynamic to the command line
+	then relocs would have been displayed.
+
 2017-10-28  Alan Modra  <amodra@gmail.com>
 
 	PR 22361
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 58c28db..f74d484 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -7150,7 +7150,21 @@ process_relocs (FILE * file)
 	}
 
       if (! found)
-	printf (_("\nThere are no relocations in this file.\n"));
+	{
+	  /* Users sometimes forget the -D option, so try to be helpful.  */
+	  for (i = 0; i < ARRAY_SIZE (dynamic_relocations); i++)
+	    {
+	      if (dynamic_info [dynamic_relocations [i].size])
+		{
+		  printf (_("\nThere are no static relocations in this file."));
+		  printf (_("\nTo see the dynamic relocations add --use-dynamic to the command line.\n"));
+
+		  break;
+		}
+	    }
+	  if (i == ARRAY_SIZE (dynamic_relocations))
+	    printf (_("\nThere are no relocations in this file.\n"));
+	}
     }
 
   return TRUE;


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