diff options
author | Roland McGrath <mcgrathr@google.com> | 2020-06-23 12:01:24 -0700 |
---|---|---|
committer | Roland McGrath <mcgrathr@google.com> | 2020-06-23 12:01:24 -0700 |
commit | f37b21b481a7804a13c5806098c19b6119288ba4 (patch) | |
tree | 3949b039081a31a28f9c9c227c7810e13ea2f25a /ld/ld.texi | |
parent | 236ef0346d88efffd1ca1da1a5d80724cb145660 (diff) | |
download | gdb-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/ld.texi')
-rw-r--r-- | ld/ld.texi | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -893,6 +893,21 @@ Use @var{output} as the name for the program produced by @command{ld}; if this option is not specified, the name @file{a.out} is used by default. The script command @code{OUTPUT} can also specify the output file name. +@kindex --dependency-file=@var{depfile} +@cindex dependency file +@item --dependency-file=@var{depfile} +Write a @dfn{dependency file} to @var{depfile}. This file contains a rule +suitable for @code{make} describing the output file and all the input files +that were read to produce it. The output is similar to the compiler's +output with @samp{-M -MP} (@pxref{Preprocessor Options,, Options +Controlling the Preprocessor, gcc.info, Using the GNU Compiler +Collection}). Note that there is no option like the compiler's @samp{-MM}, +to exclude ``system files'' (which is not a well-specified concept in the +linker, unlike ``system headers'' in the compiler). So the output from +@samp{--dependency-file} is always specific to the exact state of the +installation where it was produced, and should not be copied into +distributed makefiles without careful editing. + @kindex -O @var{level} @cindex generating optimized output @item -O @var{level} |