Report scripts and libraries searched for ld --trace

The idea of this change is to make -t output useful for users wanting
to package all the object files involved in linking for a bug report.

Something like the following should do the trick.
gcc hello.c -save-temps -Wl,-t | xargs realpath | sort | uniq > files
tar cJf test.tar.xz `cat files`

	* ldlang.c (load_symbols): When -t, print file names for script
	files and archives.
	* ldmain.c (trace_files): Make an int.
	(add_archive_element): Print archive elements only with multiple
	-t options, or when archive is thin.
	* ldmain.h (trace_files): Update.
	* ldmisc.c (vfinfo): Don't print both original path and path in
	sysroot.
	* lexsup.c (parse_args <t>): Increment trace_files.
This commit is contained in:
Alan Modra 2018-10-29 18:10:06 +10:30
parent 5c87f94bb8
commit 727a29badd
6 changed files with 27 additions and 14 deletions

View file

@ -2935,6 +2935,9 @@ load_symbols (lang_input_statement_type *entry,
if (entry->flags.missing_file)
return TRUE;
if (trace_files || verbose)
info_msg ("%pI\n", entry);
if (!bfd_check_format (entry->the_bfd, bfd_archive)
&& !bfd_check_format_matches (entry->the_bfd, bfd_object, &matching))
{
@ -3010,8 +3013,6 @@ load_symbols (lang_input_statement_type *entry,
case bfd_object:
if (!entry->flags.reload)
ldlang_add_file (entry);
if (trace_files || verbose)
info_msg ("%pI\n", entry);
break;
case bfd_archive: