aboutsummaryrefslogtreecommitdiff
path: root/gold/fileread.h
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 /gold/fileread.h
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 'gold/fileread.h')
-rw-r--r--gold/fileread.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/gold/fileread.h b/gold/fileread.h
index cf92367..2120135 100644
--- a/gold/fileread.h
+++ b/gold/fileread.h
@@ -207,6 +207,15 @@ class File_read
static void
print_stats();
+ // Write the dependency file listing all files read.
+ static void
+ write_dependency_file(const char* dependency_file_name,
+ const char* output_file_name);
+
+ // Record that a file was read. File_read::open does this.
+ static void
+ record_file_read(const std::string& name);
+
// Return the open file descriptor (for plugins).
int
descriptor()
@@ -214,7 +223,7 @@ class File_read
this->reopen_descriptor();
return this->descriptor_;
}
-
+
// Return the file last modification time. Calls gold_fatal if the stat
// system call failed.
Timespec
@@ -247,6 +256,9 @@ class File_read
// --stats.
static unsigned long long maximum_mapped_bytes;
+ // Set of names of all files read.
+ static std::vector<std::string> files_read;
+
// A view into the file.
class View
{