mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 16:53:50 +08:00
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:
12
ld/ChangeLog
12
ld/ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2018-10-29 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2018-10-29 Alan Modra <amodra@gmail.com>
|
2018-10-29 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* ldmain.c (main): Print emulation mode and "deleting executable"
|
* ldmain.c (main): Print emulation mode and "deleting executable"
|
||||||
|
@ -2935,6 +2935,9 @@ load_symbols (lang_input_statement_type *entry,
|
|||||||
if (entry->flags.missing_file)
|
if (entry->flags.missing_file)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
if (trace_files || verbose)
|
||||||
|
info_msg ("%pI\n", entry);
|
||||||
|
|
||||||
if (!bfd_check_format (entry->the_bfd, bfd_archive)
|
if (!bfd_check_format (entry->the_bfd, bfd_archive)
|
||||||
&& !bfd_check_format_matches (entry->the_bfd, bfd_object, &matching))
|
&& !bfd_check_format_matches (entry->the_bfd, bfd_object, &matching))
|
||||||
{
|
{
|
||||||
@ -3010,8 +3013,6 @@ load_symbols (lang_input_statement_type *entry,
|
|||||||
case bfd_object:
|
case bfd_object:
|
||||||
if (!entry->flags.reload)
|
if (!entry->flags.reload)
|
||||||
ldlang_add_file (entry);
|
ldlang_add_file (entry);
|
||||||
if (trace_files || verbose)
|
|
||||||
info_msg ("%pI\n", entry);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bfd_archive:
|
case bfd_archive:
|
||||||
|
@ -77,7 +77,7 @@ int ld_canon_sysroot_len;
|
|||||||
int g_switch_value = 8;
|
int g_switch_value = 8;
|
||||||
|
|
||||||
/* Nonzero means print names of input files as processed. */
|
/* Nonzero means print names of input files as processed. */
|
||||||
bfd_boolean trace_files;
|
unsigned int trace_files;
|
||||||
|
|
||||||
/* Nonzero means report actions taken by the linker, and describe the linker script in use. */
|
/* Nonzero means report actions taken by the linker, and describe the linker script in use. */
|
||||||
bfd_boolean verbose;
|
bfd_boolean verbose;
|
||||||
@ -926,7 +926,9 @@ add_archive_element (struct bfd_link_info *info,
|
|||||||
minfo ("(%s)\n", name);
|
minfo ("(%s)\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trace_files || verbose)
|
if (verbose
|
||||||
|
|| trace_files > 1
|
||||||
|
|| (trace_files && bfd_is_thin_archive (orig_input.the_bfd->my_archive)))
|
||||||
info_msg ("%pI\n", &orig_input);
|
info_msg ("%pI\n", &orig_input);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ extern FILE *saved_script_handle;
|
|||||||
extern FILE *previous_script_handle;
|
extern FILE *previous_script_handle;
|
||||||
extern bfd_boolean force_make_executable;
|
extern bfd_boolean force_make_executable;
|
||||||
extern char *default_target;
|
extern char *default_target;
|
||||||
extern bfd_boolean trace_files;
|
extern unsigned int trace_files;
|
||||||
extern bfd_boolean verbose;
|
extern bfd_boolean verbose;
|
||||||
extern bfd_boolean version_printed;
|
extern bfd_boolean version_printed;
|
||||||
extern bfd_boolean demangling;
|
extern bfd_boolean demangling;
|
||||||
|
14
ld/ldmisc.c
14
ld/ldmisc.c
@ -476,15 +476,13 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning)
|
|||||||
fmt++;
|
fmt++;
|
||||||
i = (lang_input_statement_type *) args[arg_no].p;
|
i = (lang_input_statement_type *) args[arg_no].p;
|
||||||
++arg_count;
|
++arg_count;
|
||||||
if (i->the_bfd->my_archive != NULL
|
if (i->the_bfd != NULL
|
||||||
|
&& i->the_bfd->my_archive != NULL
|
||||||
&& !bfd_is_thin_archive (i->the_bfd->my_archive))
|
&& !bfd_is_thin_archive (i->the_bfd->my_archive))
|
||||||
fprintf (fp, "(%s)",
|
fprintf (fp, "(%s)%s", i->the_bfd->my_archive->filename,
|
||||||
bfd_get_filename (i->the_bfd->my_archive));
|
i->local_sym_name);
|
||||||
fprintf (fp, "%s", i->local_sym_name);
|
else
|
||||||
if ((i->the_bfd->my_archive == NULL
|
fprintf (fp, "%s", i->filename);
|
||||||
|| bfd_is_thin_archive (i->the_bfd->my_archive))
|
|
||||||
&& filename_cmp (i->local_sym_name, i->filename) != 0)
|
|
||||||
fprintf (fp, " (%s)", i->filename);
|
|
||||||
}
|
}
|
||||||
else if (*fmt == 'R')
|
else if (*fmt == 'R')
|
||||||
{
|
{
|
||||||
|
@ -1233,7 +1233,7 @@ parse_args (unsigned argc, char **argv)
|
|||||||
command_line.symbolic = symbolic_functions;
|
command_line.symbolic = symbolic_functions;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
trace_files = TRUE;
|
++trace_files;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
previous_script_handle = saved_script_handle;
|
previous_script_handle = saved_script_handle;
|
||||||
|
Reference in New Issue
Block a user