This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Commit]: readelf: Tell users if they forgot the -D option
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Tue, 31 Oct 2017 13:47:42 +0000
- Subject: [Commit]: readelf: Tell users if they forgot the -D option
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=nickc at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 426707EAB7
Hi Guys
When dumping dynamic relocations in a file, users sometimes forget to
include the --use-dynamic command line option. The current warning
message - "there are no relocations in this file" - is confusing since
it is only referring to static relocations. So I am checking in the
patch below to change the message so that it reminds the users about
the --use-dynamic option.
Cheers
Nick
binutils/ChangeLog
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.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 58c28db958..f74d484de8 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;