aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <respindola@mozilla.com>2009-12-03 15:43:01 +0000
committerRafael Ávila de Espíndola <respindola@mozilla.com>2009-12-03 15:43:01 +0000
commitca55d848d811b5073b10e40a5c74b132ecae3647 (patch)
treed6d0b9935a0da385d2520d70f649085fe1861494
parent033c64b7ea4b109f1a81d18e568382089d823b0e (diff)
downloadgdb-ca55d848d811b5073b10e40a5c74b132ecae3647.zip
gdb-ca55d848d811b5073b10e40a5c74b132ecae3647.tar.gz
gdb-ca55d848d811b5073b10e40a5c74b132ecae3647.tar.bz2
2009-12-03 Rafael Avila de Espindola <espindola@google.com>
* incremental.cc (Incremental_inputs_header) (Incremental_inputs_header_write, Incremental_inputs_entry) (Incremental_inputs_entry_write): Move ... * incremental.h (Incremental_inputs_header) (Incremental_inputs_header_write, Incremental_inputs_entry) (Incremental_inputs_entry_write): here.
-rw-r--r--gold/ChangeLog9
-rw-r--r--gold/incremental.cc162
-rw-r--r--gold/incremental.h164
3 files changed, 173 insertions, 162 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 0d9e80a..8a25752 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,12 @@
+2009-12-03 Rafael Avila de Espindola <espindola@google.com>
+
+ * incremental.cc (Incremental_inputs_header)
+ (Incremental_inputs_header_write, Incremental_inputs_entry)
+ (Incremental_inputs_entry_write): Move ...
+ * incremental.h (Incremental_inputs_header)
+ (Incremental_inputs_header_write, Incremental_inputs_entry)
+ (Incremental_inputs_entry_write): here.
+
2009-12-02 Rafael Avila de Espindola <espindola@google.com>
* incremental.cc (make_sized_incremental_binary): Set the target.
diff --git a/gold/incremental.cc b/gold/incremental.cc
index 506c575..63c2f18 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -31,174 +31,12 @@
#include "output.h"
#include "target-select.h"
-using elfcpp::Convert;
-
namespace gold {
// Version information. Will change frequently during the development, later
// we could think about backward (and forward?) compatibility.
const unsigned int INCREMENTAL_LINK_VERSION = 1;
-// Accessors.
-
-// Reader class for .gnu_incremental_inputs header. See
-// Incremental_inputs_header_data for fields descriptions.
-
-template<int size, bool big_endian>
-class Incremental_inputs_header
-{
- private:
- typedef Incremental_inputs_header_data Data_type;
-
- public:
- Incremental_inputs_header(const unsigned char *p)
- : p_(reinterpret_cast<const Data_type*>(p))
- { }
-
- static const int data_size = sizeof(Data_type);
-
- elfcpp::Elf_Word
- get_version() const
- { return Convert<32, big_endian>::convert_host(this->p_->version); }
-
- elfcpp::Elf_Word
- get_input_file_count() const
- { return Convert<32, big_endian>::convert_host(this->p_->input_file_count); }
-
- elfcpp::Elf_Word
- get_command_line_offset() const
- { return Convert<32, big_endian>::convert_host(this->p_->command_line_offset); }
-
- elfcpp::Elf_Word
- get_reserved() const
- { return Convert<32, big_endian>::convert_host(this->p_->reserved); }
-
- private:
- const Data_type* p_;
-};
-
-// Writer class for .gnu_incremental_inputs header. See
-// Incremental_inputs_header_data for fields descriptions.
-
-template<int size, bool big_endian>
-class Incremental_inputs_header_write
-{
- private:
- typedef Incremental_inputs_header_data Data_type;
-
- public:
- Incremental_inputs_header_write(unsigned char *p)
- : p_(reinterpret_cast<Data_type*>(p))
- { }
-
- static const int data_size = sizeof(Data_type);
-
- void
- put_version(elfcpp::Elf_Word v)
- { this->p_->version = Convert<32, big_endian>::convert_host(v); }
-
- void
- put_input_file_count(elfcpp::Elf_Word v)
- { this->p_->input_file_count = Convert<32, big_endian>::convert_host(v); }
-
- void
- put_command_line_offset(elfcpp::Elf_Word v)
- { this->p_->command_line_offset = Convert<32, big_endian>::convert_host(v); }
-
- void
- put_reserved(elfcpp::Elf_Word v)
- { this->p_->reserved = Convert<32, big_endian>::convert_host(v); }
-
- private:
- Data_type* p_;
-};
-
-// Reader class for an .gnu_incremental_inputs entry. See
-// Incremental_inputs_entry_data for fields descriptions.
-template<int size, bool big_endian>
-class Incremental_inputs_entry
-{
- private:
- typedef Incremental_inputs_entry_data Data_type;
-
- public:
- Incremental_inputs_entry(const unsigned char *p)
- : p_(reinterpret_cast<const Data_type*>(p))
- { }
-
- static const int data_size = sizeof(Data_type);
-
- elfcpp::Elf_Word
- get_filename_offset()
- { return Convert<32, big_endian>::convert_host(this->p_->filename_offset); }
-
- elfcpp::Elf_Word
- get_data_offset()
- { return Convert<32, big_endian>::convert_host(this->p_->data_offset); }
-
- elfcpp::Elf_Xword
- get_timestamp_sec()
- { return Convert<64, big_endian>::convert_host(this->p_->timestamp_sec); }
-
- elfcpp::Elf_Word
- get_timestamp_nsec()
- { return Convert<32, big_endian>::convert_host(this->p_->timestamp_nsec); }
-
- elfcpp::Elf_Word
- get_input_type()
- { return Convert<32, big_endian>::convert_host(this->p_->input_type); }
-
- elfcpp::Elf_Word
- get_reserved()
- { return Convert<32, big_endian>::convert_host(this->p_->reserved); }
-
- private:
- const Data_type* p_;
-};
-
-// Writer class for an .gnu_incremental_inputs entry. See
-// Incremental_inputs_entry_data for fields descriptions.
-template<int size, bool big_endian>
-class Incremental_inputs_entry_write
-{
- private:
- typedef Incremental_inputs_entry_data Data_type;
-
- public:
- Incremental_inputs_entry_write(unsigned char *p)
- : p_(reinterpret_cast<Data_type*>(p))
- { }
-
- static const int data_size = sizeof(Data_type);
-
- void
- put_filename_offset(elfcpp::Elf_Word v)
- { this->p_->filename_offset = Convert<32, big_endian>::convert_host(v); }
-
- void
- put_data_offset(elfcpp::Elf_Word v)
- { this->p_->data_offset = Convert<32, big_endian>::convert_host(v); }
-
- void
- put_timestamp_sec(elfcpp::Elf_Xword v)
- { this->p_->timestamp_sec = Convert<64, big_endian>::convert_host(v); }
-
- void
- put_timestamp_nsec(elfcpp::Elf_Word v)
- { this->p_->timestamp_nsec = Convert<32, big_endian>::convert_host(v); }
-
- void
- put_input_type(elfcpp::Elf_Word v)
- { this->p_->input_type = Convert<32, big_endian>::convert_host(v); }
-
- void
- put_reserved(elfcpp::Elf_Word v)
- { this->p_->reserved = Convert<32, big_endian>::convert_host(v); }
-
- private:
- Data_type* p_;
-};
-
// Inform the user why we don't do an incremental link. Not called in
// the obvious case of missing output file. TODO: Is this helpful?
diff --git a/gold/incremental.h b/gold/incremental.h
index f6e36fa..a94f397 100644
--- a/gold/incremental.h
+++ b/gold/incremental.h
@@ -68,6 +68,80 @@ struct Incremental_inputs_header_data
elfcpp::Elf_Word reserved;
};
+// Reader class for .gnu_incremental_inputs header. See
+// Incremental_inputs_header_data for fields descriptions.
+
+template<int size, bool big_endian>
+class Incremental_inputs_header
+{
+ private:
+ typedef Incremental_inputs_header_data Data_type;
+ typedef elfcpp::Convert<32, big_endian> Convert32;
+
+ public:
+ Incremental_inputs_header(const unsigned char *p)
+ : p_(reinterpret_cast<const Data_type*>(p))
+ { }
+
+ static const int data_size = sizeof(Data_type);
+
+ elfcpp::Elf_Word
+ get_version() const
+ { return Convert32::convert_host(this->p_->version); }
+
+ elfcpp::Elf_Word
+ get_input_file_count() const
+ { return Convert32::convert_host(this->p_->input_file_count); }
+
+ elfcpp::Elf_Word
+ get_command_line_offset() const
+ { return Convert32::convert_host(this->p_->command_line_offset); }
+
+ elfcpp::Elf_Word
+ get_reserved() const
+ { return Convert32::convert_host(this->p_->reserved); }
+
+ private:
+ const Data_type* p_;
+};
+
+// Writer class for .gnu_incremental_inputs header. See
+// Incremental_inputs_header_data for fields descriptions.
+
+template<int size, bool big_endian>
+class Incremental_inputs_header_write
+{
+ private:
+ typedef Incremental_inputs_header_data Data_type;
+ typedef elfcpp::Convert<32, big_endian> Convert32;
+
+ public:
+ Incremental_inputs_header_write(unsigned char *p)
+ : p_(reinterpret_cast<Data_type*>(p))
+ { }
+
+ static const int data_size = sizeof(Data_type);
+
+ void
+ put_version(elfcpp::Elf_Word v)
+ { this->p_->version = Convert32::convert_host(v); }
+
+ void
+ put_input_file_count(elfcpp::Elf_Word v)
+ { this->p_->input_file_count = Convert32::convert_host(v); }
+
+ void
+ put_command_line_offset(elfcpp::Elf_Word v)
+ { this->p_->command_line_offset = Convert32::convert_host(v); }
+
+ void
+ put_reserved(elfcpp::Elf_Word v)
+ { this->p_->reserved = Convert32::convert_host(v); }
+
+ private:
+ Data_type* p_;
+};
+
// Data stored in .gnu_incremental_input after the header for each of the
// Incremental_input_header_data::input_file_count input entries.
struct Incremental_inputs_entry_data
@@ -91,6 +165,96 @@ struct Incremental_inputs_entry_data
elfcpp::Elf_Half reserved;
};
+// Reader class for an .gnu_incremental_inputs entry. See
+// Incremental_inputs_entry_data for fields descriptions.
+template<int size, bool big_endian>
+class Incremental_inputs_entry
+{
+ private:
+ typedef Incremental_inputs_entry_data Data_type;
+ typedef elfcpp::Convert<32, big_endian> Convert32;
+ typedef elfcpp::Convert<64, big_endian> Convert64;
+
+ public:
+ Incremental_inputs_entry(const unsigned char *p)
+ : p_(reinterpret_cast<const Data_type*>(p))
+ { }
+
+ static const int data_size = sizeof(Data_type);
+
+ elfcpp::Elf_Word
+ get_filename_offset()
+ { return Convert32::convert_host(this->p_->filename_offset); }
+
+ elfcpp::Elf_Word
+ get_data_offset()
+ { return Convert32::convert_host(this->p_->data_offset); }
+
+ elfcpp::Elf_Xword
+ get_timestamp_sec()
+ { return Convert64::convert_host(this->p_->timestamp_sec); }
+
+ elfcpp::Elf_Word
+ get_timestamp_nsec()
+ { return Convert32::convert_host(this->p_->timestamp_nsec); }
+
+ elfcpp::Elf_Word
+ get_input_type()
+ { return Convert32::convert_host(this->p_->input_type); }
+
+ elfcpp::Elf_Word
+ get_reserved()
+ { return Convert32::convert_host(this->p_->reserved); }
+
+ private:
+ const Data_type* p_;
+};
+
+// Writer class for an .gnu_incremental_inputs entry. See
+// Incremental_inputs_entry_data for fields descriptions.
+template<int size, bool big_endian>
+class Incremental_inputs_entry_write
+{
+ private:
+ typedef Incremental_inputs_entry_data Data_type;
+ typedef elfcpp::Convert<32, big_endian> Convert32;
+ typedef elfcpp::Convert<64, big_endian> Convert64;
+
+ public:
+ Incremental_inputs_entry_write(unsigned char *p)
+ : p_(reinterpret_cast<Data_type*>(p))
+ { }
+
+ static const int data_size = sizeof(Data_type);
+
+ void
+ put_filename_offset(elfcpp::Elf_Word v)
+ { this->p_->filename_offset = Convert32::convert_host(v); }
+
+ void
+ put_data_offset(elfcpp::Elf_Word v)
+ { this->p_->data_offset = Convert32::convert_host(v); }
+
+ void
+ put_timestamp_sec(elfcpp::Elf_Xword v)
+ { this->p_->timestamp_sec = Convert64::convert_host(v); }
+
+ void
+ put_timestamp_nsec(elfcpp::Elf_Word v)
+ { this->p_->timestamp_nsec = Convert32::convert_host(v); }
+
+ void
+ put_input_type(elfcpp::Elf_Word v)
+ { this->p_->input_type = Convert32::convert_host(v); }
+
+ void
+ put_reserved(elfcpp::Elf_Word v)
+ { this->p_->reserved = Convert32::convert_host(v); }
+
+ private:
+ Data_type* p_;
+};
+
// An object representing the ELF file we edit during an incremental build.
// Similar to Object or Dynobj, but operates on Output_file and contains
// method specific to file edition (TBD). This is the abstract parent class