summaryrefslogtreecommitdiff
path: root/gold/parameters.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2010-10-14 22:10:22 +0000
committerCary Coutant <ccoutant@google.com>2010-10-14 22:10:22 +0000
commit8c21d9d382512278b484e29aa85053d9378c8b63 (patch)
tree038ec21bf537ae5a092363241d2347be7091b849 /gold/parameters.cc
parentcfc08d490ef2b07c1faaf6ca72ba512dfd764f89 (diff)
* debug.h (DEBUG_INCREMENTAL): New flag.
(debug_string_to_enum): Add DEBUG_INCREMENTAL). * gold.cc (queue_initial_tasks): Check parameters for incremental link mode. * incremental.cc (report_command_line): Ignore all forms of --incremental. * layout.cc (Layout::Layout): Check parameters for incremental link mode. * options.cc (General_options::parse_incremental): New function. (General_options::parse_no_incremental): New function. (General_options::parse_incremental_full): New function. (General_options::parse_incremental_update): New function. (General_options::incremental_mode_): New data member. (General_options::finalize): Check incremental_mode_. * options.h (General_options): Update help text for --incremental. Add --no-incremental, --incremental-full, --incremental-update. (General_options::Incremental_mode): New enum type. (General_options::incremental_mode): New function. (General_options::incremental_mode_): New data member. * parameters.cc (Parameters::incremental_mode_): New data member. (Parameters::set_options): Set incremental_mode_. (Parameters::set_incremental_full): New function. (Parameters::incremental): New function. (Parameters::incremental_update): New function. (set_parameters_incremental_full): New function. * parameters.h (Parameters::set_incremental_full): New function. (Parameters::incremental): New function. (Parameters::incremental_update): New function. (Parameters::incremental_mode_): New data member. (set_parameters_incremental_full): New function. * plugin.cc (Plugin_manager::add_input_file): Check parameters for incremental link mode. * reloc.cc (Sized_relobj::do_read_relocs): Likewise. (Sized_relobj::do_relocate_sections): Likewise. * testsuite/Makefile.am (incremental_test): Use --incremental-full option. * testsuite/Makefile.in: Regenerate. * testsuite/incremental_test.sh: Filter all forms of --incremental.
Diffstat (limited to 'gold/parameters.cc')
-rw-r--r--gold/parameters.cc45
1 files changed, 44 insertions, 1 deletions
diff --git a/gold/parameters.cc b/gold/parameters.cc
index 4430388a67..e04168f924 100644
--- a/gold/parameters.cc
+++ b/gold/parameters.cc
@@ -66,7 +66,7 @@ Set_parameters_target_once set_parameters_target_once(&static_parameters);
Parameters::Parameters()
: errors_(NULL), options_(NULL), target_(NULL),
doing_static_link_valid_(false), doing_static_link_(false),
- debug_(0),
+ debug_(0), incremental_mode_(General_options::INCREMENTAL_OFF),
set_parameters_target_once_(&set_parameters_target_once)
{
}
@@ -86,6 +86,9 @@ Parameters::set_options(const General_options* options)
// For speed, we convert the options() debug var from a string to an
// enum (from debug.h).
this->debug_ = debug_string_to_enum(this->options().debug());
+ // Set incremental_mode_ based on the value of the --incremental option.
+ // We copy the mode into parameters because it can change based on inputs.
+ this->incremental_mode_ = this->options().incremental_mode();
// If --verbose is set, it acts as "--debug=files".
if (options->verbose())
this->debug_ |= DEBUG_FILES;
@@ -208,6 +211,38 @@ Parameters::check_target_endianness()
}
}
+// Set the incremental linking mode to INCREMENTAL_FULL. Used when
+// the linker determines that an incremental update is not possible.
+// Returns false if the incremental mode was INCREMENTAL_UPDATE,
+// indicating that the linker should exit if an update is not possible.
+
+bool
+Parameters::set_incremental_full()
+{
+ gold_assert(this->incremental_mode_ != General_options::INCREMENTAL_OFF);
+ if (this->incremental_mode_ == General_options::INCREMENTAL_UPDATE)
+ return false;
+ this->incremental_mode_ = General_options::INCREMENTAL_FULL;
+ return true;
+}
+
+// Return true if we need to prepare incremental linking information.
+
+bool
+Parameters::incremental() const
+{
+ return this->incremental_mode_ != General_options::INCREMENTAL_OFF;
+}
+
+// Return true if we are doing an incremental update.
+
+bool
+Parameters::incremental_update() const
+{
+ return (this->incremental_mode_ == General_options::INCREMENTAL_UPDATE
+ || this->incremental_mode_ == General_options::INCREMENTAL_AUTO);
+}
+
void
set_parameters_errors(Errors* errors)
{ static_parameters.set_errors(errors); }
@@ -227,6 +262,14 @@ void
set_parameters_doing_static_link(bool doing_static_link)
{ static_parameters.set_doing_static_link(doing_static_link); }
+// Set the incremental linking mode to INCREMENTAL_FULL. Used when
+// the linker determines that an incremental update is not possible.
+// Returns false if the incremental mode was INCREMENTAL_UPDATE,
+// indicating that the linker should exit if an update is not possible.
+bool
+set_parameters_incremental_full()
+{ return static_parameters.set_incremental_full(); }
+
// Force the target to be valid by using the default. Use the
// --oformat option is set; this supports the x86_64 kernel build,
// which converts a binary file to an object file using -r --format