aboutsummaryrefslogtreecommitdiff
path: root/gold/incremental.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-10-09 22:38:07 +0000
committerIan Lance Taylor <ian@airs.com>2009-10-09 22:38:07 +0000
commitc4aa1e2d740d76a37730514749c6ff2ef9f748f1 (patch)
tree1a65a3a215ee78941e8c64f57305980a55cefdc2 /gold/incremental.h
parentc549a6949c8cbbbeafa79ab903b172bbc5f2b8ea (diff)
downloadgdb-c4aa1e2d740d76a37730514749c6ff2ef9f748f1.zip
gdb-c4aa1e2d740d76a37730514749c6ff2ef9f748f1.tar.gz
gdb-c4aa1e2d740d76a37730514749c6ff2ef9f748f1.tar.bz2
elfcpp/:
* elf_file.h: (class Elf_strtab): New class. gold/: * gold.cc: (queue_initial_tasks): Pass incremental_inputs to Incremental_checker. * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to unsigned int. (class Incremental_inputs_header): New class. (Incremental_inputs_header_writer): Edit comment. (Incremental_inputs_entry): New class. (Incremental_inputs_entry_writer): Edit comment. (Sized_incremental_binary::do_find_incremental_inputs_section): Add *strtab_shndx parameter, fill it. (Sized_incremental_binary::do_check_inputs): New method. (Incremental_checker::can_incrementally_link_output_file): Use Sized_incremental_binary::check_inputs. (Incremental_inputs::report_command_line): Save command line in command_line_. * incremental.h: (Incremental_binary::find_incremental_inputs_section): New method. (Incremental_binary::do_find_incremental_inputs_section): Add strtab_shndx parameter. (Incremental_binary::do_check_inputs): New pure virtual method. (Sized_incremental_binary::do_check_inputs): Declare. (Incremental_checker::Incremental_checker): Add incremental_inputs parameter, use it to initialize incremental_inputs_. (Incremental_checker::incremental_inputs_): New field. (Incremental_checker::command_line): New method. (Incremental_checker::inputs): New method. (Incremental_checker::command_line_): New field.
Diffstat (limited to 'gold/incremental.h')
-rw-r--r--gold/incremental.h61
1 files changed, 54 insertions, 7 deletions
diff --git a/gold/incremental.h b/gold/incremental.h
index 8909324..b53f6c1 100644
--- a/gold/incremental.h
+++ b/gold/incremental.h
@@ -119,18 +119,34 @@ class Incremental_binary
void
error(const char* format, ...) const ATTRIBUTE_PRINTF_2;
-
// Find the .gnu_incremental_inputs section. It selects the first section
// of type SHT_GNU_INCREMENTAL_INPUTS. Returns false if such a section
// is not found.
bool
- find_incremental_inputs_section(Location* location)
- { return do_find_incremental_inputs_section(location); }
+ find_incremental_inputs_section(Location* location,
+ unsigned int* strtab_shndx)
+ { return do_find_incremental_inputs_section(location, strtab_shndx); }
+
+ // Check the .gnu_incremental_inputs section to see whether an incremental
+ // build is possible.
+ // TODO: on success, should report what files needs to be rebuilt.
+ // INCREMENTAL_INPUTS is used to read the canonical form of the command line
+ // and read the input arguments. TODO: for items that don't need to be
+ // rebuilt, we should also copy the incremental input information.
+ virtual bool
+ check_inputs(Incremental_inputs* incremental_inputs)
+ { return do_check_inputs(incremental_inputs); }
protected:
// Find incremental inputs section.
virtual bool
- do_find_incremental_inputs_section(Location* location) = 0;
+ do_find_incremental_inputs_section(Location* location,
+ unsigned int* strtab_shndx) = 0;
+
+ // Check the .gnu_incremental_inputs section to see whether an incremental
+ // build is possible.
+ virtual bool
+ do_check_inputs(Incremental_inputs* incremental_inputs) = 0;
private:
// Edited output file object.
@@ -151,7 +167,11 @@ class Sized_incremental_binary : public Incremental_binary
protected:
virtual bool
- do_find_incremental_inputs_section(Location* location);
+ do_find_incremental_inputs_section(Location* location,
+ unsigned int* strtab_shndx);
+
+ virtual bool
+ do_check_inputs(Incremental_inputs* incremental_inputs);
private:
// Output as an ELF file.
@@ -168,8 +188,14 @@ open_incremental_binary(Output_file* file);
class Incremental_checker
{
public:
- Incremental_checker(const char* output_name)
- : output_name_(output_name)
+ // Check if the file named OUTPUT_NAME can be linked incrementally.
+ // INCREMENTAL_INPUTS must have the canonical form of the command line
+ // and input arguments filled - at this point of linking other fields are
+ // probably not filled yet. TODO: for inputs that don't need to be
+ // rebuilt, this function should fill the incremental input information.
+ Incremental_checker(const char* output_name,
+ Incremental_inputs* incremental_inputs)
+ : output_name_(output_name), incremental_inputs_(incremental_inputs)
{ }
// Analyzes the output file to check if incremental linking is possible and
@@ -178,7 +204,12 @@ class Incremental_checker
can_incrementally_link_output_file();
private:
+ // Name of the output file to analyze.
const char* output_name_;
+
+ // The Incremental_inputs object. At this stage of link, only the command
+ // line and inputs are filled.
+ Incremental_inputs* incremental_inputs_;
};
// This class contains the information needed during an incremental
@@ -227,6 +258,17 @@ class Incremental_inputs
get_stringpool()
{ return this->strtab_; }
+ // Return the canonical form of the command line, as will be stored in
+ // .gnu_incremental_strtab.
+ const std::string&
+ command_line()
+ { return this->command_line_; }
+
+ // Return the input files found in the command line.
+ const Input_arguments*
+ inputs()
+ { return this->inputs_; }
+
private:
// Code for each of the four possible variants of create_inputs_section_data.
template<int size, bool big_endian>
@@ -289,8 +331,13 @@ class Incremental_inputs
// A map containing additional information about the input elements.
Inputs_info_map inputs_map_;
+ // Canonical form of the command line, as will be stored in
+ // .gnu_incremental_strtab.
+ std::string command_line_;
+
// The key of the command line string in the string pool.
Stringpool::Key command_line_key_;
+
// The .gnu_incremental_strtab string pool associated with the
// .gnu_incremental_inputs.
Stringpool* strtab_;