binutils/binutils-2.29.1-readelf-use...

56 lines
2.2 KiB
Diff

diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.29.1/binutils/doc/binutils.texi
--- binutils.orig/binutils/doc/binutils.texi 2017-11-01 11:44:12.360707737 +0000
+++ binutils-2.29.1/binutils/doc/binutils.texi 2017-11-01 11:45:38.702652255 +0000
@@ -4661,8 +4661,13 @@ given.
@itemx --all
Equivalent to specifying @option{--file-header},
@option{--program-headers}, @option{--sections}, @option{--symbols},
-@option{--relocs}, @option{--dynamic}, @option{--notes} and
-@option{--version-info}.
+@option{--relocs}, @option{--dynamic}, @option{--notes},
+@option{--version-info}, @option{--arch-specific}, @option{--unwind},
+@option{--section-groups} and @option{--histogram}.
+
+Note - this option does not enable @option{--use-dynamic} itself, so
+if that option is not present on the command line then dynamic symbols
+and dynamic relocs will not be displayed.
@item -h
@itemx --file-header
@@ -4758,6 +4763,9 @@ When displaying symbols, this option mak
symbol hash tables in the file's dynamic section, rather than the
symbol table sections.
+When displaying relocations, this option makes @command{readelf}
+display the dynamic relocations rather than the static relocations.
+
@item -x <number or name>
@itemx --hex-dump=<number or name>
Displays the contents of the indicated section as a hexadecimal bytes.
diff -rup binutils.orig/binutils/readelf.c binutils-2.29.1/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-11-01 11:44:12.357707774 +0000
+++ binutils-2.29.1/binutils/readelf.c 2017-11-01 11:45:11.901979878 +0000
@@ -7117,7 +7117,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;