diff options
author | Cary Coutant <ccoutant@google.com> | 2011-03-30 21:07:13 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2011-03-30 21:07:13 +0000 |
commit | c7975edd9eba42c2bd59948060d8d5c715456517 (patch) | |
tree | 2648d7512cb58f600066d281834f1c4d4aa53398 /gold/script.cc | |
parent | ef23e70580c5c6353e916d10f2f94eceba7a70cd (diff) | |
download | gdb-c7975edd9eba42c2bd59948060d8d5c715456517.zip gdb-c7975edd9eba42c2bd59948060d8d5c715456517.tar.gz gdb-c7975edd9eba42c2bd59948060d8d5c715456517.tar.bz2 |
* archive.cc (Archive::include_member): Adjust call to report_object.
(Add_archive_symbols::run): Add script_info to call to
report_archive_begin.
(Lib_group::include_member): Adjust call to report_object.
(Add_lib_group_symbols::run): Adjust call to report_object.
* incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
blocks. Add object count for script input files.
* incremental.cc (Incremental_inputs::report_archive_begin): Add
script_info parameter; change all callers.
(Incremental_inputs::report_object): Add script_info parameter;
change all callers.
(Incremental_inputs::report_script): Store backpointer to
incremental info entry.
(Output_section_incremental_inputs::set_final_data_size): Record
additional information for scripts.
(Output_section_incremental_inputs::write_info_blocks): Likewise.
* incremental.h (Incremental_script_entry::add_object): New function.
(Incremental_script_entry::get_object_count): New function.
(Incremental_script_entry::get_object): New function.
(Incremental_script_entry::objects_): New data member; adjust
constructor.
(Incremental_inputs::report_archive_begin): Add script_info parameter.
(Incremental_inputs::report_object): Add script_info parameter.
(Incremental_inputs_reader::get_object_count): New function.
(Incremental_inputs_reader::get_object_offset): New function.
* options.cc (Input_arguments::add_file): Return reference to
new input argument.
* options.h (Input_argument::set_script_info): New function.
(Input_argument::script_info): New function.
(Input_argument::script_info_): New data member; adjust all
constructors.
(Input_file_group::add_file): Return reference to new input argument.
(Input_file_lib::add_file): Likewise.
(Input_arguments::add_file): Likewise.
* readsyms.cc (Add_symbols::run): Adjust call to report_object.
* script.cc (Parser_closure::Parser_closure): Add script_info
parameter; adjust all callers.
(Parser_closure::script_info): New function.
(Parser_closure::script_info_): New data member.
(read_input_script): Report scripts earlier to incremental info.
(script_add_file): Set script_info in Input_argument.
(script_add_library): Likewise.
* script.h (Script_options::Script_info): Rewrite class.
Diffstat (limited to 'gold/script.cc')
-rw-r--r-- | gold/script.cc | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/gold/script.cc b/gold/script.cc index 659a0d2..b56ec1c 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -1206,7 +1206,8 @@ class Parser_closure Command_line* command_line, Script_options* script_options, Lex* lex, - bool skip_on_incompatible_target) + bool skip_on_incompatible_target, + Script_info* script_info) : filename_(filename), posdep_options_(posdep_options), parsing_defsym_(parsing_defsym), in_group_(in_group), is_in_sysroot_(is_in_sysroot), @@ -1214,7 +1215,8 @@ class Parser_closure found_incompatible_target_(false), command_line_(command_line), script_options_(script_options), version_script_info_(script_options->version_script_info()), - lex_(lex), lineno_(0), charpos_(0), lex_mode_stack_(), inputs_(NULL) + lex_(lex), lineno_(0), charpos_(0), lex_mode_stack_(), inputs_(NULL), + script_info_(script_info) { // We start out processing C symbols in the default lex mode. this->language_stack_.push_back(Version_script_info::LANGUAGE_C); @@ -1365,6 +1367,11 @@ class Parser_closure this->language_stack_.pop_back(); } + // Return a pointer to the incremental info. + Script_info* + script_info() + { return this->script_info_; } + private: // The name of the file we are reading. const char* filename_; @@ -1401,6 +1408,8 @@ class Parser_closure std::vector<Version_script_info::Language> language_stack_; // New input files found to add to the link. Input_arguments* inputs_; + // Pointer to incremental linking info. + Script_info* script_info_; }; // FILE was found as an argument on the command line. Try to read it @@ -1422,6 +1431,15 @@ read_input_script(Workqueue* workqueue, Symbol_table* symtab, Layout* layout, Lex lex(input_string.c_str(), input_string.length(), PARSING_LINKER_SCRIPT); + Script_info* script_info = NULL; + if (layout->incremental_inputs() != NULL) + { + const std::string& filename = input_file->filename(); + Timespec mtime = input_file->file().get_mtime(); + script_info = new Script_info(); + layout->incremental_inputs()->report_script(filename, script_info, mtime); + } + Parser_closure closure(input_file->filename().c_str(), input_argument->file().options(), false, @@ -1430,7 +1448,8 @@ read_input_script(Workqueue* workqueue, Symbol_table* symtab, Layout* layout, NULL, layout->script_options(), &lex, - input_file->will_search_for()); + input_file->will_search_for(), + script_info); bool old_saw_sections_clause = layout->script_options()->saw_sections_clause(); @@ -1476,16 +1495,6 @@ read_input_script(Workqueue* workqueue, Symbol_table* symtab, Layout* layout, this_blocker = nb; } - if (layout->incremental_inputs() != NULL) - { - // Like new Read_symbols(...) above, we rely on closure.inputs() - // getting leaked by closure. - const std::string& filename = input_file->filename(); - Script_info* info = new Script_info(closure.inputs()); - Timespec mtime = input_file->file().get_mtime(); - layout->incremental_inputs()->report_script(filename, info, mtime); - } - *used_next_blocker = true; return true; @@ -1535,7 +1544,8 @@ read_script_file(const char* filename, Command_line* cmdline, cmdline, script_options, &lex, - false); + false, + NULL); if (yyparse(&closure) != 0) { input_file.file().unlock(task); @@ -1594,7 +1604,7 @@ Script_options::define_symbol(const char* definition) Position_dependent_options posdep_options; Parser_closure closure("command line", posdep_options, true, - false, false, NULL, this, &lex, false); + false, false, NULL, this, &lex, false, NULL); if (yyparse(&closure) != 0) return false; @@ -2620,7 +2630,8 @@ script_add_file(void* closurev, const char* name, size_t length) Input_file_argument::INPUT_FILE_TYPE_FILE, extra_search_path, false, closure->position_dependent_options()); - closure->inputs()->add_file(file); + Input_argument& arg = closure->inputs()->add_file(file); + arg.set_script_info(closure->script_info()); } // Called by the bison parser to add a library to the link. @@ -2638,7 +2649,8 @@ script_add_library(void* closurev, const char* name, size_t length) Input_file_argument::INPUT_FILE_TYPE_LIBRARY, "", false, closure->position_dependent_options()); - closure->inputs()->add_file(file); + Input_argument& arg = closure->inputs()->add_file(file); + arg.set_script_info(closure->script_info()); } // Called by the bison parser to start a group. If we are already in |