mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
Add --remap-inputs option to the BFD linker.
PR 30374 * ldfile.c (struct input_remap): New structure. (ldfile_add_remap): New function. (ldfile_remap_input_free): New function. (ldfile_add_remap_file): New function. (ldfile_possibly_remap_input): New function. (ldfile_print_input_remaps): New function. * ldfile.h: Add prototypes for new functions. * ldlang.c (new_afile): Call ldfile_possibly_remap_input. (lang_finish): Call ldfile_remap_input_free. (lang_map): Call ldfile_print_input_remaps. * ldlex.h (OPTION_REMAP_INPUTS, OPTION_REMAP_INPUTS_FILE): Define. * lexsup.c (ld_options): Add --remap-inputs-file and --remap-inputs. (parse_args): Handle new options. * NEWS: Mention the new feature. * ld.texi: Document the new options. * testsuite/ld-misc/input-remap.exp: New test driver. * testsuite/ld-misc/remaps.r: New file: Expected linker output. * testsuite/ld-misc/remaps.txt: New file. Input remaps file.
This commit is contained in:
@@ -1125,6 +1125,10 @@ new_afile (const char *name,
|
||||
|
||||
lang_has_input_file = true;
|
||||
|
||||
name = ldfile_possibly_remap_input (name);
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
p = new_stat (lang_input_statement, stat_ptr);
|
||||
memset (&p->the_bfd, 0,
|
||||
sizeof (*p) - offsetof (lang_input_statement_type, the_bfd));
|
||||
@@ -1328,6 +1332,7 @@ void
|
||||
lang_finish (void)
|
||||
{
|
||||
output_section_statement_table_free ();
|
||||
ldfile_remap_input_free ();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
@@ -2280,6 +2285,8 @@ lang_map (void)
|
||||
lang_memory_region_type *m;
|
||||
bool dis_header_printed = false;
|
||||
|
||||
ldfile_print_input_remaps ();
|
||||
|
||||
LANG_FOR_EACH_INPUT_STATEMENT (file)
|
||||
{
|
||||
asection *s;
|
||||
|
||||
Reference in New Issue
Block a user