(queue_initial_tasks): Call Incremental_checker methods.
* incremental.cc: Include "output.h".
(Incremental_checker::can_incrementally_link_output_file): New
method.
* incremental.h (Incremental_checker): New class.
+2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
+
+ * gold.cc: Include "incremental.h".
+ (queue_initial_tasks): Call Incremental_checker methods.
+ * incremental.cc: Include "output.h".
+ (Incremental_checker::can_incrementally_link_output_file): New
+ method.
+ * incremental.h (Incremental_checker): New class.
+
+ * output.cc (Output_file::open_for_modification): New method.
+ (Output_file::map_anonymous): Changed return type to bool. Record
+ map in base_ field.
+ (Output_file::map_no_anonymous): New method, broken out of map.
+ (Output_file::map): Use map_no_anonymous and map_anonymous.
+ * output.h (class Output_file): Update declarations.
+
2009-08-24 Cary Coutant <ccoutant@google.com>
* options.h (Command_line::Pre_options): New class.
#include "defstd.h"
#include "plugin.h"
#include "icf.h"
+#include "incremental.h"
namespace gold
{
thread_count = cmdline.number_of_input_files();
workqueue->set_thread_count(thread_count);
+ if (cmdline.options().incremental())
+ {
+ Incremental_checker incremental_checker(
+ parameters->options().output_file_name());
+ if (incremental_checker.can_incrementally_link_output_file())
+ {
+ // TODO: remove when incremental linking implemented.
+ printf("Incremental linking might be possible "
+ "(not implemented yet)\n");
+ }
+ // TODO: If we decide on an incremental build, fewer tasks
+ // should be scheduled.
+ }
+
// Read the input files. We have to add the symbols to the symbol
// table in order. We do this by creating a separate blocker for
// each input file. We associate the blocker with the following
}
}
-// Queue up a set of tasks to be done before queueing the middle set
-// of tasks. This is only necessary when garbage collection
+// Queue up a set of tasks to be done before queueing the middle set
+// of tasks. This is only necessary when garbage collection
// (--gc-sections) of unused sections is desired. The relocs are read
// and processed here early to determine the garbage sections before the
// relocs can be scanned in later tasks.
#include "output.h"
#include "incremental.h"
#include "archive.h"
+#include "output.h"
using elfcpp::Convert;
internal::Incremental_inputs_entry_data* p_;
};
+// Analyzes the output file to check if incremental linking is possible and
+// (to be done) what files need to be relinked.
+
+bool
+Incremental_checker::can_incrementally_link_output_file()
+{
+ Output_file output(this->output_name_);
+ if (!output.open_for_modification())
+ return false;
+ return true;
+}
+
// Add the command line to the string table, setting
// command_line_key_. In incremental builds, the command line is
// stored in .gnu_incremental_inputs so that the next linker run can
INCREMENTAL_INPUT_SCRIPT = 4
};
+// Code invoked early during an incremental link that checks what files need
+// to be relinked.
+class Incremental_checker
+{
+ public:
+ Incremental_checker(const char* output_name)
+ : output_name_(output_name)
+ { }
+
+ // Analyzes the output file to check if incremental linking is possible and
+ // what files needs to be relinked.
+ bool
+ can_incrementally_link_output_file();
+
+ private:
+ const char* output_name_;
+};
+
// This class contains the information needed during an incremental
// build about the inputs necessary to build the .gnu_incremental_inputs.
class Incremental_inputs
{
// 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;
};
// Position of the entry information in the output section.
unsigned int index;
-
+
// Last modification time of the file.
Timespec mtime;
};
// 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_;