aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorRoland McGrath <mcgrathr@google.com>2020-06-23 12:01:24 -0700
committerRoland McGrath <mcgrathr@google.com>2020-06-23 12:01:24 -0700
commitf37b21b481a7804a13c5806098c19b6119288ba4 (patch)
tree3949b039081a31a28f9c9c227c7810e13ea2f25a /ld/lexsup.c
parent236ef0346d88efffd1ca1da1a5d80724cb145660 (diff)
downloadgdb-f37b21b481a7804a13c5806098c19b6119288ba4.zip
gdb-f37b21b481a7804a13c5806098c19b6119288ba4.tar.gz
gdb-f37b21b481a7804a13c5806098c19b6119288ba4.tar.bz2
PR 22843: ld, gold: Add --dependency-file option.
gold/ * options.h (class General_options): Add --dependency-file option. * fileread.cc (File_read::files_read): New static variable. (File_read::open): Add the file to the files_read list. (File_read::record_file_read): New static member function. (File_read::write_dependency_file): New static member function. * fileread.h (class File_read): Declare them. * layout.cc (Layout::read_layout_from_file): Call record_file_read. (Close_task_runner::run): Call write_dependency_file if --dependency-file was passed. ld/ * NEWS: Note --dependency-file. * ld.texi (Options): Document --dependency-file. * ldlex.h (enum option_values): Add OPTION_DEPENDENCY_FILE. * ld.h (ld_config_type): New member dependency_file. * lexsup.c (ld_options, parse_args): Parse --dependency-file. * ldmain.c (struct dependency_file): New type. (dependency_files, dependency_files_tail): New static variables. (track_dependency_files): New function. (write_dependency_file): New function. (main): Call it when --dependency-file was passed. * ldfile.c (ldfile_try_open_bfd): Call track_dependency_files. (ldfile_open_command_file_1): Likewise. * ldelf.c (ldelf_try_needed): Likewise. * pe-dll.c (pe_implied_import_dll): Likewise.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 65a9453..48c6eca 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -111,6 +111,8 @@ static const struct ld_option ld_options[] =
'c', N_("FILE"), N_("Read MRI format linker script"), TWO_DASHES },
{ {"dc", no_argument, NULL, 'd'},
'd', NULL, N_("Force common symbols to be defined"), ONE_DASH },
+ { {"dependency-file", required_argument, NULL, OPTION_DEPENDENCY_FILE},
+ '\0', N_("FILE"), N_("Write dependency file"), TWO_DASHES },
{ {"dp", no_argument, NULL, 'd'},
'\0', NULL, NULL, ONE_DASH },
{ {"force-group-allocation", no_argument, NULL,
@@ -1441,7 +1443,7 @@ parse_args (unsigned argc, char **argv)
= lang_new_vers_pattern (NULL, xstrdup (optarg), NULL,
FALSE);
lang_append_dynamic_list (&export_list, expr);
- }
+ }
break;
case OPTION_EXPORT_DYNAMIC_SYMBOL_LIST:
/* This option indicates a small script that only specifies
@@ -1631,6 +1633,10 @@ parse_args (unsigned argc, char **argv)
case OPTION_PRINT_MAP_DISCARDED:
config.print_map_discarded = TRUE;
break;
+
+ case OPTION_DEPENDENCY_FILE:
+ config.dependency_file = optarg;
+ break;
}
}
@@ -1906,14 +1912,14 @@ elf_shlib_list_options (FILE *file)
}
fprintf (file, _("\
-P AUDITLIB, --depaudit=AUDITLIB\n" "\
- Specify a library to use for auditing dependencies\n"));
+ Specify a library to use for auditing dependencies\n"));
fprintf (file, _("\
-z combreloc Merge dynamic relocs into one section and sort\n"));
fprintf (file, _("\
-z nocombreloc Don't merge dynamic relocs into one section\n"));
fprintf (file, _("\
-z global Make symbols in DSO available for subsequently\n\
- loaded objects\n"));
+ loaded objects\n"));
fprintf (file, _("\
-z initfirst Mark DSO to be initialized first at runtime\n"));
fprintf (file, _("\
@@ -1936,7 +1942,7 @@ elf_shlib_list_options (FILE *file)
-z now Mark object non-lazy runtime binding\n"));
fprintf (file, _("\
-z origin Mark object requiring immediate $ORIGIN\n\
- processing at runtime\n"));
+ processing at runtime\n"));
#if DEFAULT_LD_Z_RELRO
fprintf (file, _("\
-z relro Create RELRO program header (default)\n"));
@@ -1994,13 +2000,13 @@ elf_static_list_options (FILE *file)
--build-id[=STYLE] Generate build ID note\n"));
fprintf (file, _("\
--compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi]\n\
- Compress DWARF debug sections using zlib\n"));
+ Compress DWARF debug sections using zlib\n"));
#ifdef DEFAULT_FLAG_COMPRESS_DEBUG
fprintf (file, _("\
- Default: zlib-gabi\n"));
+ Default: zlib-gabi\n"));
#else
fprintf (file, _("\
- Default: none\n"));
+ Default: none\n"));
#endif
fprintf (file, _("\
-z common-page-size=SIZE Set common page size to SIZE\n"));
@@ -2025,7 +2031,7 @@ elf_plt_unwind_list_options (FILE *file)
--ld-generated-unwind-info Generate exception handling info for PLT\n"));
fprintf (file, _("\
--no-ld-generated-unwind-info\n\
- Don't generate exception handling info for PLT\n"));
+ Don't generate exception handling info for PLT\n"));
}
static void