aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-10-29 08:47:12 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-10-29 09:26:41 -0700
commit41e83f2b16ec57fb7e163c19fc315c86e4994b2e (patch)
treea122ed8dc81d79368cbda588ef7ba9363ed31f15
parentb10a8bc7de0087b5c509b4b0831e606b56b6702c (diff)
downloadgdb-41e83f2b16ec57fb7e163c19fc315c86e4994b2e.zip
gdb-41e83f2b16ec57fb7e163c19fc315c86e4994b2e.tar.gz
gdb-41e83f2b16ec57fb7e163c19fc315c86e4994b2e.tar.bz2
Make GOT entry size target-dependent
The GOT entry size is target-dependent. This patch adds a got_entry_size function to Sized_target class so that a target can provide a value different from default. PR gold/19184 * incremental.cc (Got_plt_view_info): Add got_entry_size. (Local_got_offset_visitor::visit): Replace got_entry_size_ with info_.got_entry_size. (Local_got_offset_visitor::got_entry_size_): Removed. (Global_got_offset_visitor::visit): Replace got_entry_size_ with info_.got_entry_size. (Global_got_offset_visitor::got_entry_size_): Removed. (Output_section_incremental_inputs::write_got_plt): Initialize view_info.got_entry_size. * target.h (Sized_target::got_entry_size): New virtual function. * x86_64.cc (Target_x86_64::got_entry_size): New function.
-rw-r--r--gold/ChangeLog15
-rw-r--r--gold/incremental.cc9
-rw-r--r--gold/target.h8
-rw-r--r--gold/x86_64.cc5
4 files changed, 33 insertions, 4 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 3b77230..7cc77ec 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,18 @@
+2015-10-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/19184
+ * incremental.cc (Got_plt_view_info): Add got_entry_size.
+ (Local_got_offset_visitor::visit): Replace got_entry_size_
+ with info_.got_entry_size.
+ (Local_got_offset_visitor::got_entry_size_): Removed.
+ (Global_got_offset_visitor::visit): Replace got_entry_size_
+ with info_.got_entry_size.
+ (Global_got_offset_visitor::got_entry_size_): Removed.
+ (Output_section_incremental_inputs::write_got_plt): Initialize
+ view_info.got_entry_size.
+ * target.h (Sized_target::got_entry_size): New virtual function.
+ * x86_64.cc (Target_x86_64::got_entry_size): New function.
+
2015-10-28 Marcin Koƛcielnicki <koriakin@0x04.net>
* testsuite/binary_test.cc: Add __attribute__((aligned(1))).
diff --git a/gold/incremental.cc b/gold/incremental.cc
index b4fff11..4e35055 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -1818,6 +1818,8 @@ struct Got_plt_view_info
unsigned int first_plt_entry_offset;
// Size of a PLT entry (this is a target-dependent value).
unsigned int plt_entry_size;
+ // Size of a GOT entry (this is a target-dependent value).
+ unsigned int got_entry_size;
// Symbol index to write in the GOT descriptor array. For global symbols,
// this is the global symbol table index; for local symbols, it is the
// local symbol table index.
@@ -1843,7 +1845,7 @@ class Local_got_offset_visitor : public Got_offset_list::Visitor
void
visit(unsigned int got_type, unsigned int got_offset)
{
- unsigned int got_index = got_offset / this->got_entry_size_;
+ unsigned int got_index = got_offset / this->info_.got_entry_size;
gold_assert(got_index < this->info_.got_count);
// We can only handle GOT entry types in the range 0..0x7e
// because we use a byte array to store them, and we use the
@@ -1856,7 +1858,6 @@ class Local_got_offset_visitor : public Got_offset_list::Visitor
}
private:
- static const unsigned int got_entry_size_ = size / 8;
struct Got_plt_view_info& info_;
};
@@ -1875,7 +1876,7 @@ class Global_got_offset_visitor : public Got_offset_list::Visitor
void
visit(unsigned int got_type, unsigned int got_offset)
{
- unsigned int got_index = got_offset / this->got_entry_size_;
+ unsigned int got_index = got_offset / this->info_.got_entry_size;
gold_assert(got_index < this->info_.got_count);
// We can only handle GOT entry types in the range 0..0x7e
// because we use a byte array to store them, and we use the
@@ -1888,7 +1889,6 @@ class Global_got_offset_visitor : public Got_offset_list::Visitor
}
private:
- static const unsigned int got_entry_size_ = size / 8;
struct Got_plt_view_info& info_;
};
@@ -1948,6 +1948,7 @@ Output_section_incremental_inputs<size, big_endian>::write_got_plt(
view_info.plt_count = target->plt_entry_count();
view_info.first_plt_entry_offset = target->first_plt_entry_offset();
view_info.plt_entry_size = target->plt_entry_size();
+ view_info.got_entry_size = target->got_entry_size();
view_info.got_type_p = pov + 8;
view_info.got_desc_p = (view_info.got_type_p
+ ((view_info.got_count + 3) & ~3));
diff --git a/gold/target.h b/gold/target.h
index db093b7..b21c56a 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -1004,6 +1004,14 @@ class Sized_target : public Target
plt_entry_size() const
{ gold_unreachable(); }
+ // Return the size of each GOT entry. This is only used for
+ // laying out the incremental link info sections. A target needs
+ // to implement this if its GOT size is different.
+
+ virtual unsigned int
+ got_entry_size() const
+ { return size / 8; }
+
// Create the GOT and PLT sections for an incremental update.
// A target needs to implement this to support incremental linking.
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index d637b5e..3651d39 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -594,6 +594,11 @@ class Target_x86_64 : public Sized_target<size, false>
unsigned int
plt_entry_size() const;
+ // Return the size of each GOT entry.
+ unsigned int
+ got_entry_size() const
+ { return 8; };
+
// Create the GOT section for an incremental update.
Output_data_got_base*
init_got_plt_for_update(Symbol_table* symtab,