diff options
author | Nick Clifton <nickc@redhat.com> | 2021-03-04 10:41:22 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2021-03-04 10:41:22 +0000 |
commit | ca0e11aa4ba877e180f7d40dcc5a89540740c501 (patch) | |
tree | 4b63669803d3f6fdac19e967dadb1e7f521f4b75 /binutils/objdump.c | |
parent | 168bb18858e749a211125e8eb3cec27d83fc2ebb (diff) | |
download | gdb-ca0e11aa4ba877e180f7d40dcc5a89540740c501.zip gdb-ca0e11aa4ba877e180f7d40dcc5a89540740c501.tar.gz gdb-ca0e11aa4ba877e180f7d40dcc5a89540740c501.tar.bz2 |
Gate the displaying of non-debug sections in separate debuginfo files.
PR 27478
* objdump.c (process_links): New variable.
(usage): Add --process-links.
(long_options): Likewise.
(dump_bfd): Stop processing once the bfd has been loaded unless
this is the main file or process_links has been enabled.
(main): Handle the process-links option.
* readelf.c (process_links): New variable.
(struct filedata): Add is_separate field.
(options): Add --process-links.
(usage): Likewise.
(parse_args): Likewise.
(process_file_header): Include the filename when dumping
information for separate debuginfo files.
(process_program_headers): Likewise.
(process_section_headers): Likewise.
(process_section_groups): Likewise.
(process_relocs): Likewise.
(process_dynamic_section): Likewise.
(process_version_sections): Likewise.
(display_lto_symtab): Likewise.
(process_symbol_table): Likewise.
(process_syminfo): Likewise.
(initialise_dumps_by_name): Likewise.
(process_section_contents): Likewise.
(process_notes_at): Likewise.
(process_notes): Likewise.
(open_file): Add is_separate parameter. Use to initialise the
is_separate field in the filedata structure.
(open_deug): Update call to open_file.
(process_object): Add processing of the contents of separate
debuginfo files, gated by the process_links variable.
(process_archive): Update call to open_file.
(process_file): Initialise the is_separate field in the filedata
structure.
* dwarf.c (load_separate_debug_info_file): Only report the
loading of a separate file if debug links are being dumped.
* objcopy.c (keep_section_symbols): New variable.
(enum command_line_switch): Add OPTION_KEEP_SYMBOLS.
(strip_options): Add keep-section-symbols.
(copy_options): Likewise.
(copy_usage): Likewise.
(strip_usage): Likewise.
(copy_object): Keep section symbols if requested by command line
option.
(strip_main): Handle --keep-section-symbols.
(copy_main): Likewise.
* doc/binutils.texi: Document the new options.
* NEWS: Mention the new features.
* testsuite/binutils-all/compress.exp (test_gnu_debuglink):
Update options passed to objdump. Use diff rather than cmp to
compare the dumped data.
* testsuite/binutils-all/objdump.WK2: Update regexp.
* testsuite/binutils-all/objdump.WK3: Update regexp.
* testsuite/binutils-all/objdump.exp: Use --process-links
instead of --dwarf=follow-links.
* testsuite/binutils-all/readelf.exp (readelf_test): Include
readelf's output in the log when the test fails.
Add the -P option to the -wKis test.
* testsuite/binutils-all/readelf.wKis: Update expected output.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r-- | binutils/objdump.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c index 47b2309..0aa0373 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -128,6 +128,7 @@ static const char * source_comment; /* --source_comment. */ static bfd_boolean visualize_jumps = FALSE; /* --visualize-jumps. */ static bfd_boolean color_output = FALSE; /* --visualize-jumps=color. */ static bfd_boolean extended_color_output = FALSE; /* --visualize-jumps=extended-color. */ +static bfd_boolean process_links = FALSE; /* --process-links. */ static int demangle_flags = DMGL_ANSI | DMGL_PARAMS; @@ -247,6 +248,9 @@ usage (FILE *stream, int status) -WN,--dwarf=no-follow-links Do not follow links to separate debug info files (default)\n\ ")); #endif + fprintf (stream, _("\ + -L, --process-links Display the contents of non-debug sections in separate debuginfo files.\n\ +")); #ifdef ENABLE_LIBCTF fprintf (stream, _("\ --ctf=SECTION Display CTF info from SECTION\n\ @@ -383,6 +387,7 @@ static struct option long_options[]= {"line-numbers", no_argument, NULL, 'l'}, {"no-show-raw-insn", no_argument, &show_raw_insn, -1}, {"no-addresses", no_argument, &no_addresses, 1}, + {"process-links", no_argument, &process_links, TRUE}, {"prefix-addresses", no_argument, &prefix_addresses, 1}, {"recurse-limit", no_argument, NULL, OPTION_RECURSE_LIMIT}, {"recursion-limit", no_argument, NULL, OPTION_RECURSE_LIMIT}, @@ -4843,6 +4848,9 @@ dump_bfd (bfd *abfd, bfd_boolean is_mainfile) bfd_map_over_sections (abfd, adjust_addresses, &has_reloc); } + if (! is_mainfile && ! process_links) + return; + if (! dump_debugging_tags && ! suppress_bfd_header) printf (_("\n%s: file format %s\n"), sanitize_string (bfd_get_filename (abfd)), @@ -5357,6 +5365,10 @@ main (int argc, char **argv) do_demangle = TRUE; seenflag = TRUE; break; + case 'L': + process_links = TRUE; + do_follow_links = TRUE; + break; case 'W': dump_dwarf_section_info = TRUE; seenflag = TRUE; |