This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gold: add --incremental, --incremental-changed, --incremental-unchanged and --incremental-unknown command line options


  In this patch I use Position_dependent_options, what made the patch
much shorter. There are some small changes in behaviour compared to
previous patch - files included by scripts inherits the
--incremental-* options from the script (what solves the problem of
-lXXX), files created by plugins uses the options of the
PluginManager, while nested archives uses the option as it was at the
end of the command line to create the intermediate archive (the last
item may be not good, but I can look at it later, when the code will
be more complete. I'm also wondering if members of
--incremental-changed archives shouldn't be --incremental-unknown, but
this can be always changed)

2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>

	* options.cc (General_options::parse_incremental_changed): New function.
        (General_options::parse_incremental_unchanged): New function.
        (General_options::parse_incremental_unknown): New function.
        (General_options::General_options): Initialize new fields
incremental_disposition_ and implicit_incremental.
        (General_options::finalize): Check for uasge of
--incremental-* without --incremental
	* options.h (General_options::incremental_disposition): New function.
	(Posotion_dependent_options::set_incremental_disposition): New function.
From a0702779495c2eb4e9ba158fa60ab780497b1acb Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolajz@dhcp-172-26-79-171.nyc.corp.google.com>
Date: Fri, 6 Feb 2009 14:54:41 -0500
Subject: [PATCH] gold: add parsing of --incremental, --incremental-changed, --incremental-unchanged and --incremental-unknown command line options

---
 gold/options.cc |   31 ++++++++++++++++++++++++++++++-
 gold/options.h  |   48 +++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/gold/options.cc b/gold/options.cc
index ff9bd41..35ed863 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -290,6 +290,30 @@ General_options::parse_defsym(const char*, const char* arg,
 }
 
 void
+General_options::parse_incremental_changed(const char*, const char*,
+                                           Command_line*)
+{
+  this->implicit_incremental_ = true;
+  this->incremental_disposition_ = INCREMENTAL_CHANGED;
+}
+
+void
+General_options::parse_incremental_unchanged(const char*, const char*,
+                                             Command_line*)
+{
+  this->implicit_incremental_ = true;
+  this->incremental_disposition_ = INCREMENTAL_UNCHANGED;
+}
+
+void
+General_options::parse_incremental_unknown(const char*, const char*,
+                                           Command_line*)
+{
+  this->implicit_incremental_ = true;
+  this->incremental_disposition_ = INCREMENTAL_CHECK;
+}
+
+void
 General_options::parse_library(const char*, const char* arg,
                                Command_line* cmdline)
 {
@@ -621,7 +645,8 @@ namespace gold
 
 General_options::General_options()
   : execstack_status_(General_options::EXECSTACK_FROM_INPUT), static_(false),
-    do_demangle_(false), plugins_()
+    do_demangle_(false), plugins_(),
+    incremental_disposition_(INCREMENTAL_CHECK), implicit_incremental_(false)
 {
 }
 
@@ -839,6 +864,10 @@ General_options::finalize()
 		 "[0.0, 1.0)"),
 	       this->hash_bucket_empty_fraction());
 
+  if (this->implicit_incremental_ && !this->incremental())
+    gold_fatal(_("Options --incremental-changed, --incremental-unchanged, "
+                 "--incremental-unknown require the use of --incremental"));
+
   // FIXME: we can/should be doing a lot more sanity checking here.
 }
 
diff --git a/gold/options.h b/gold/options.h
index b980281..6862177 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -56,6 +56,18 @@ class Position_dependent_options;
 class Target;
 class Plugin_manager;
 
+// Incremental build action for a specific file, as selected by the user.
+
+enum Incremental_disposition
+{
+  // Determine the status from the timestamp (default).
+  INCREMENTAL_CHECK,
+  // Assume the file changed from the previous build.
+  INCREMENTAL_CHANGED,
+  // Assume the file didn't change from the previous build.
+  INCREMENTAL_UNCHANGED
+};
+
 // The nested namespace is to contain all the global variables and
 // structs that need to be defined in the .h file, but do not need to
 // be used outside this class.
@@ -660,6 +672,19 @@ class General_options
   DEFINE_string(dynamic_linker, options::TWO_DASHES, 'I', NULL,
                 N_("Set dynamic linker path"), N_("PROGRAM"));
 
+  DEFINE_bool(incremental, options::TWO_DASHES, '\0', false,
+              N_("Work in progress. Do not use."),
+              N_("Do a full build"));
+
+  DEFINE_special(incremental_changed, options::TWO_DASHES, '\0',
+                 N_("Assume files changed"), NULL);
+
+  DEFINE_special(incremental_unchanged, options::TWO_DASHES, '\0',
+                 N_("Assume files didn't change"), NULL);
+
+  DEFINE_special(incremental_unknown, options::TWO_DASHES, '\0',
+                 N_("Use timestamps to check files (default)"), NULL);
+
   DEFINE_special(just_symbols, options::TWO_DASHES, '\0',
                  N_("Read only symbol values from FILE"), N_("FILE"));
 
@@ -769,11 +794,11 @@ class General_options
                  N_("Do not link against shared libraries"), NULL);
 
   DEFINE_bool(gc_sections, options::TWO_DASHES, '\0', false,
-              N_("Remove unused sections"), 
+              N_("Remove unused sections"),
               N_("Don't remove unused sections (default)"));
- 
+
   DEFINE_bool(print_gc_sections, options::TWO_DASHES, '\0', false,
-              N_("List removed unused sections on stderr"), 
+              N_("List removed unused sections on stderr"),
               N_("Do not list removed unused sections"));
 
   DEFINE_bool(stats, options::TWO_DASHES, '\0', false,
@@ -969,6 +994,13 @@ class General_options
   in_dynamic_list(const char* symbol) const
   { return this->dynamic_list_.version_script_info()->symbol_is_local(symbol); }
 
+  // The disposition given by the --incremental-changed, --incremental-unchanged
+  // or --incremental-unknown. The value may change as we proceed parsing the
+  // command line flags.
+  Incremental_disposition
+  incremental_disposition() const
+  { return this->incremental_disposition_; }
+
  private:
   // Don't copy this structure.
   General_options(const General_options&);
@@ -1026,6 +1058,14 @@ class General_options
   // script.cc, we store this as a Script_options object, even though
   // we only use a single Version_tree from it.
   Script_options dynamic_list_;
+  // The disposition given by the --incremental-changed, --incremental-unchanged
+  // or --incremental-unknown. The value may change as we proceed parsing the
+  // command line flags.
+  Incremental_disposition incremental_disposition_;
+  // Wheater we have seen one of the options that require incremental
+  // build (--incremental-changed, --incremental-unchanged or
+  // --incremental-unknown)
+  bool implicit_incremental_;
 };
 
 // The position-dependent options.  We use this to store the state of
@@ -1062,12 +1102,14 @@ class Position_dependent_options
     this->set_Bdynamic(options.Bdynamic());
     this->set_format_enum(options.format_enum());
     this->set_whole_archive(options.whole_archive());
+    this->set_incremental_disposition(options.incremental_disposition());
   }
 
   DEFINE_posdep(as_needed, bool);
   DEFINE_posdep(Bdynamic, bool);
   DEFINE_posdep(format_enum, General_options::Object_format);
   DEFINE_posdep(whole_archive, bool);
+  DEFINE_posdep(incremental_disposition, Incremental_disposition);
 
  private:
   // This is a General_options with everything set to its default
-- 
1.5.4.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]