From 266d0a7434a91dead63fe66891fcf17f5c6b187c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Feb 2009 23:49:43 +0000 Subject: [PATCH] * options.h (enum Incremental_disposition): Define. (class General_options): Add new options: --incremental, --incremental_changed, --incremental_unchanged, --incremental_unknown. Add incremental_disposition_ and implicit_incremental_ fields. (General_options::incremental_disposition): New function. (class Position_dependent_options): Add incremental_disposition option. (Position_dependent_options::copy_from_options): Set incremental dispositions. * 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. --- gold/ChangeLog | 21 +++++++++++++++++++++ gold/options.cc | 31 ++++++++++++++++++++++++++++++- gold/options.h | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 96 insertions(+), 4 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 7af0d90..957a0d5 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,24 @@ +2009-02-06 Mikolaj Zalewski + + * options.h (enum Incremental_disposition): Define. + (class General_options): Add new options: --incremental, + --incremental_changed, --incremental_unchanged, + --incremental_unknown. Add incremental_disposition_ and + implicit_incremental_ fields. + (General_options::incremental_disposition): New function. + (class Position_dependent_options): Add incremental_disposition + option. + (Position_dependent_options::copy_from_options): Set incremental + dispositions. + * 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. + 2009-02-06 Chris Demetriou * gold.h (gold_undefined_symbol): Change to take only a Symbol 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..1d30a56 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 option. 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 option. 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 -- 2.7.4