aboutsummaryrefslogtreecommitdiff
path: root/gold/incremental.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-05-15 17:01:04 +0000
committerIan Lance Taylor <ian@airs.com>2009-05-15 17:01:04 +0000
commit072fe7ce7a6d9d6b401284de5858495157a35df3 (patch)
treeca7231716f83cae7acf0c8b04566ffcef0f4c762 /gold/incremental.h
parent17a37d488c16b07d3a1f069ef727e2e53c622722 (diff)
downloadbinutils-072fe7ce7a6d9d6b401284de5858495157a35df3.zip
binutils-072fe7ce7a6d9d6b401284de5858495157a35df3.tar.gz
binutils-072fe7ce7a6d9d6b401284de5858495157a35df3.tar.bz2
* gold.h (Incremental_argument_list): Remove (invalid) forward
declaration. * incremental.cc (Incremental_inputs::report_achive): New method. (Incremental_inputs::report_object): New method. (Incremental_inputs::report_script): New method. (Incremental_inputs::finalize_inputs): New method. (Incremental_inputs::finalize): Call finalize_inputs(). (Incremental_inputs::sized_create_incremental_inputs_section_data): Create inputs entries. * incremental.h (Incremental_input_type): New enum. (Incremental_inputs::Incremental_input): Initialize new fields. (Incremental_inputs::report_inputs): New method. (Incremental_inputs::report_achive): New method. (Incremental_inputs::report_object): New method. (Incremental_inputs::report_script): New method. (Incremental_inputs::finalize_inputs): New method. (Incremental_inputs::Input_info): New struct. (Incremental_inputs::Input_info_map): New typedef. (Incremental_inputs::lock_): New field. (Incremental_inputs::Inputs_): New field. (Incremental_inputs::Inputs_map): New field. * main.cc (main): Call Incremental_input::report_inputs. * options.h (Input_argument_list): Typedef moved from Input_arguments. (Input_file_group::Files): Remove, use ::Input_argument_list. (Input_file_group::Input_argument_list): Remove, use ::Input_argument_list. * plugin.cc (Plugin_manager::add_input_file): Add error in incremental build. * read_syms.cc (do_read_syms): Call Incremental_input::report_* functions. * script.cc (read_input_script): Call Incremental_input::report_script. * script.h (Script_info): New class.
Diffstat (limited to 'gold/incremental.h')
-rw-r--r--gold/incremental.h90
1 files changed, 85 insertions, 5 deletions
diff --git a/gold/incremental.h b/gold/incremental.h
index dd9ebc5..ed074ae 100644
--- a/gold/incremental.h
+++ b/gold/incremental.h
@@ -23,6 +23,7 @@
#ifndef GOLD_INCREMENTAL_H
#define GOLD_INCREMENTAL_H
+#include <map>
#include <vector>
#include "stringpool.h"
@@ -37,20 +38,49 @@ class Incremental_inputs_checker;
class Object;
class Output_section_data;
+// Incremental input type as stored in .gnu_incremental_inputs.
+
+enum Incremental_input_type
+{
+ INCREMENTAL_INPUT_INVALID = 0,
+ INCREMENTAL_INPUT_OBJECT = 1,
+ INCREMENTAL_INPUT_ARCHIVE = 2,
+ INCREMENTAL_INPUT_SHARED_LIBRARY = 3,
+ INCREMENTAL_INPUT_SCRIPT = 4
+};
+
// This class contains the information needed during an incremental
// build about the inputs necessary to build the .gnu_incremental_inputs.
class Incremental_inputs
{
public:
Incremental_inputs()
- : command_line_key_(0), strtab_(new Stringpool())
+ : lock_(new Lock()), inputs_(NULL), command_line_key_(0),
+ strtab_(new Stringpool())
{ }
~Incremental_inputs() { delete this->strtab_; }
// Record the command line.
void
report_command_line(int argc, const char* const* argv);
-
+
+ // Record the input arguments obtained from parsing the command line.
+ void
+ report_inputs(const Input_arguments& inputs)
+ { this->inputs_ = &inputs; }
+
+ // Record that the input argument INPUT is an archive ARCHIVE.
+ void
+ report_archive(const Input_argument* input, Archive* archive);
+
+ // Record that the input argument INPUT is to an object OBJ.
+ void
+ report_object(const Input_argument* input, Object* obj);
+
+ // Record that the input argument INPUT is to an script SCRIPT.
+ void
+ report_script(const Input_argument* input, Script_info* script);
+
// Prepare for layout. Called from Layout::finalize.
void
finalize();
@@ -58,8 +88,8 @@ class Incremental_inputs
// Create the content of the .gnu_incremental_inputs section.
Output_section_data*
create_incremental_inputs_section_data();
-
- // Return the .gnu_incremental_strtab stringpool.
+
+ // Return the .gnu_incremental_strtab stringpool.
Stringpool*
get_stringpool()
{ return this->strtab_; }
@@ -68,7 +98,57 @@ class Incremental_inputs
// Code for each of the four possible variants of create_inputs_section_data.
template<int size, bool big_endian>
Output_section_data*
- sized_create_inputs_section_data();
+ sized_create_inputs_section_data();
+
+ // Compute indexes in the order in which the inputs should appear in
+ // .gnu_incremental_inputs and put file names to the stringtable.
+ // This needs to be done after all the scripts are parsed.
+
+ void
+ finalize_inputs(Input_argument_list::const_iterator begin,
+ Input_argument_list::const_iterator end,
+ unsigned int* index);
+
+ // Additional data about an input needed for an incremental link.
+ // None of these pointers is owned by the structure.
+ struct Input_info
+ {
+ Input_info()
+ : type(INCREMENTAL_INPUT_INVALID), archive(NULL), object(NULL),
+ script(NULL), filename_key(0), index(0)
+ { }
+
+ // Type of the file pointed by this argument.
+ Incremental_input_type type;
+
+ // Present if type == INCREMENTAL_INPUT_ARCHIVE.
+ Archive* archive;
+
+ // Present if type == INCREMENTAL_INPUT_OBJECT or
+ // INCREMENTAL_INPUT_SHARED_LIBRARY.
+ Object* object;
+
+ // Present if type == INCREMENTAL_INPUT_SCRIPT.
+ Script_info* script;
+
+ // Key of the filename string in the section stringtable.
+ Stringpool::Key filename_key;
+
+ // Position of the entry information in the output section.
+ unsigned int index;
+ };
+
+ typedef std::map<const Input_argument*, Input_info> Inputs_info_map;
+
+ // A lock guarding access to inputs_ during the first phase of linking, when
+ // report_ function may be called from multiple threads.
+ Lock* lock_;
+
+ // The list of input arguments obtained from parsing the command line.
+ const Input_arguments* inputs_;
+
+ // A map containing additional information about the input elements.
+ Inputs_info_map inputs_map_;
// The key of the command line string in the string pool.
Stringpool::Key command_line_key_;