readelf: Add option to display the names of sections referenced by symbols.

PR 30684
  * readelf.c (extra_sym_info): New variable. (section_name_valid): Also check for filedata being NULL. (section_name_print): Delete. (section_index_real): New function.  Returns true if the given section index references a real section. (print_symbol): Rename to print_sumbol_name. (printable_section_name): Use a rotating array of static buffers for the return string. (printable_section_name_from_index): Merge code from dump_relocations and get_symbol_index_type into here. (long_option_values): Add OPTION_NO_EXTRA_SYM_INFO. (options): Add "extra-sym-info" and "no-extra-sym-info". (usage): Mention new options. (parse_args): Parse new options. (get_symbol_index_type): Delete. (print_dynamic_symbol_size): Rename to print_symbol_size. (print_dynamic_symbol): Rename to print_symbol. (print_symbol_table_heading): New function. (process_symbol_table): Use new function.
  * doc/binutils.texi: Document the new option.
  * NEWS: Mention the new feature.
This commit is contained in:
Nick Clifton
2023-09-05 11:08:23 +01:00
parent d486800436
commit b6ac461ace
4 changed files with 369 additions and 198 deletions

View File

@@ -4961,6 +4961,7 @@ readelf [@option{-a}|@option{--all}]
[@option{--quiet}]
[@option{--recurse-limit}|@option{--no-recurse-limit}]
[@option{-U} @var{method}|@option{--unicode=}@var{method}]
[@option{-X}|@option{--extra-sym-info}|@option{--no-extra-sym-info}]
[@option{-n}|@option{--notes}]
[@option{-r}|@option{--relocs}]
[@option{-u}|@option{--unwind}]
@@ -5152,6 +5153,20 @@ assuming that colouring is supported by the output device. The
colouring is intended to draw attention to the presence of unicode
sequences when they might not be expected.
@item -X
@itemx --extra-sym-info
When displaying details of symbols, include extra information not
normally presented. Currently this just adds the name of the section
referenced by the symbol's index field, if there is one. In the
future more information may be displayed when this option is enabled.
Enabling this option effectively enables the @option{--wide} option as
well, at least when displaying symbol information.
@item --no-extra-sym-info
Disables the effect of the @option{--extra-sym-info} option. This
is the default.
@item -e
@itemx --headers
Display all the headers in the file. Equivalent to @option{-h -l -S}.