With current readelf, I'm running into a dwz testsuite failure due to this warning: ... $ ~/binutils/build/binutils/readelf --string-dump=.gnu_debugaltlink \ tmp.multifile.sh/1 tmp.multifile.sh/1: Found separate debug info file: 3 String dump of section '.gnu_debugaltlink': [ 0] 3 [ 4] ^��[����;�0@���b�^M readelf: Warning: Section '.gnu_debugaltlink' was not dumped because it does not exist! ... It took me a while to realize that the warning is for file 3. This makes no sense to me. I'd expect the following of debug info links to work _exclusively_ for dwarf dumping, or for fetching dwarf information information to annotate other sections.
Hi Tom, That warning should now have gone away, tanks to a patch recently committed by H.J. But in general debug info files can contain information that is relevant to the decoding of other sections in the "main" file, even non-debug sections. (For example debug info files often contain symbol tables which are absent from the main file). This is why the automatic following of debug links behaviour was added. The addition is still being debated however and it may very change. For some information please see the thread starting here: https://sourceware.org/pipermail/binutils/2021-February/115310.html and then continuing here: https://sourceware.org/pipermail/binutils/2021-March/115582.html Cheers Nick
(In reply to Nick Clifton from comment #1) > That warning should now have gone away, tanks to a patch recently > committed by H.J. It didn't. Thanks, - Tom
(In reply to Tom de Vries from comment #2) > It didn't. Hmmm. Please could you upload the tmp.multfile.sh/1 file ? And the "3" file as well. (If I am reading the description correctly).
Created attachment 13274 [details] 1.gz
Created attachment 13275 [details] 3.gz
1.gz and 3.gz produced like this: ... $ gcc ~/hello.c -g $ cp a.out 1; cp 1 2; ./dwz -m 3 1 2 ... Reproduce: ... $ readelf --string-dump=.gnu_debugaltlink 1 1: Found separate debug info file: 3 String dump of section '.gnu_debugaltlink': [ 0] 3 [ 3] )kh]���SX�P^Q�m^Q^S� readelf: Warning: Section '.gnu_debugaltlink' was not dumped because it does not exist! ...
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ca0e11aa4ba877e180f7d40dcc5a89540740c501 commit ca0e11aa4ba877e180f7d40dcc5a89540740c501 Author: Nick Clifton <nickc@redhat.com> Date: Thu Mar 4 10:41:22 2021 +0000 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.
Hi Tom, OK, I have checked in a patch which should resolve this issue. The warning message was happening because readelf was trying to dump the contents of the .gnu_debugaltlink section in the '3' file, which of course does not exist. The patch adds a new option (--process-links) which must now be used in order to explicitly request that the other display options be applied to separate debuginfo files as well as the main file. Without this option, only information from the main file will be displayed. (The exception being debug sections, which will be dumped from both the main file and the separate debug info file, even if --process-links is not enabled. This is because in most cases the debug sections are only present in either the main file or the separate debuginfo file, but not both). Cheers Nick
(In reply to Nick Clifton from comment #8) > Hi Tom, > > OK, I have checked in a patch which should resolve this issue. > > The warning message was happening because readelf was trying to > dump the contents of the .gnu_debugaltlink section in the '3' file, > which of course does not exist. The patch adds a new option > (--process-links) which must now be used in order to explicitly > request that the other display options be applied to separate > debuginfo files as well as the main file. Without this option, > only information from the main file will be displayed. (The > exception being debug sections, which will be dumped from both > the main file and the separate debug info file, even if > --process-links is not enabled. This is because in most cases > the debug sections are only present in either the main file or > the separate debuginfo file, but not both). Hi Nick, thanks for fixing this. I've tested this against the dwz testsuite, and the fails are gone. - Tom
Tentatively reopening this. As reported in dwz PR27592: ... $ gcc ~/hello.c -g $ cp a.out 1; cp 1 2; dwz -m 3 1 2 $ readelf --string-dump=.gnu_debugaltlink 1 String dump of section '.gnu_debugaltlink': [ 0] 3 [ 6] 8�y�:�.��Y!���^^r $ ~/binutils/install/bin/readelf --string-dump=.gnu_debugaltlink 1 String dump of section '.gnu_debugaltlink': [ 0] 3 [ 6] 8�y�:�.��Y!���^^r readelf: Warning: Section '.gnu_debugaltlink' in linked file '3' was not dumped because it does not exist $ ... The error message is slightly different, but it roughly looks like the same problem.
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=835f2fae11e41956523df3839cd50471b708e97d commit 835f2fae11e41956523df3839cd50471b708e97d Author: Nick Clifton <nickc@redhat.com> Date: Thu Mar 18 14:01:25 2021 +0000 Fix section dumping so that warnings are not issued for missed sections in separate debuginfo files. PR 27478 * readelf.c (dump_section_as_strings): Mention separate filename. (dump_section_as_bytes): Likewise. (dump_section_as_ctf): Likewise. (initialise_dumkps_byname): Only issue a warning for missing sections if processing the main file. (process_section_contents): Only issue a warning for unsumped section numbers in the main file. (initialise_dump_sects): New function. Contains code extracted from ... (process_object): ... here. Also call initialise_dump_sects for separate files.
Hi Tom, Yes - you were right - that problem had resurfaced. Whilst testing a fix I also found that if you *did* want sections in separate debuginfo files to be dumped they would be omitted. So I have checked in a patch that fixes both of these problems. So now "readelf --string-dump=.gnu_debugaltlink 1" will dump the section in 1 and not complain about it missing from 3. Plus "readelf -x1 1" will dump the .interp section in 1, whilst "readelf -x1 1 -P" will dump both that section *and* the .note.gnu_build-id section in 3. Cheers Nick