aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2018-04-05 09:41:42 -0700
committerCary Coutant <ccoutant@gmail.com>2018-04-05 09:45:07 -0700
commit494e49c9855c75e5cf95a2c031401d2d4f5e21fe (patch)
tree92c480f655c89a9e1f793444789eaa075b96cbc2 /gold
parentMIPS: Fix GOT page counter in multi-got links (diff)
downloadbinutils-gdb-494e49c9855c75e5cf95a2c031401d2d4f5e21fe.tar.gz
binutils-gdb-494e49c9855c75e5cf95a2c031401d2d4f5e21fe.tar.bz2
binutils-gdb-494e49c9855c75e5cf95a2c031401d2d4f5e21fe.zip
Revert previous patch and apply revised patch.
Revert: 2018-04-05 James Cowgill <james.cowgill@mips.com> PR gold/22770 * mips.cc (Mips_got_info::record_got_page_entry): Fetch existing page entries for the object's GOT. Apply: PR gold/22770 * mips.cc (Mips_got_info::record_got_page_entry): Don't insert Got_page_entry for object's GOT. (Mips_got_info::add_got_page_entries): Add all pages from from's GOT. Rename to add_got_page_count. (Got_page_entry): Remove num_pages.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog11
-rw-r--r--gold/mips.cc41
2 files changed, 19 insertions, 33 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index c1776b50e80..010dad4e185 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,16 @@
2018-04-05 James Cowgill <james.cowgill@mips.com>
+ Revert previous patch and apply revised patch.
+
+ PR gold/22770
+ * mips.cc (Mips_got_info::record_got_page_entry): Don't insert
+ Got_page_entry for object's GOT.
+ (Mips_got_info::add_got_page_entries): Add all pages from from's GOT.
+ Rename to add_got_page_count.
+ (Got_page_entry): Remove num_pages.
+
+2018-04-05 James Cowgill <james.cowgill@mips.com>
+
PR gold/22770
* mips.cc (Mips_got_info::record_got_page_entry): Fetch existing
page entries for the object's GOT.
diff --git a/gold/mips.cc b/gold/mips.cc
index 5d0ae739f6f..e54f51c0e64 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -631,11 +631,11 @@ struct Got_page_range
struct Got_page_entry
{
Got_page_entry()
- : object(NULL), symndx(-1U), ranges(NULL), num_pages(0)
+ : object(NULL), symndx(-1U), ranges(NULL)
{ }
Got_page_entry(Object* object_, unsigned int symndx_)
- : object(object_), symndx(symndx_), ranges(NULL), num_pages(0)
+ : object(object_), symndx(symndx_), ranges(NULL)
{ }
// The input object that needs the GOT page entry.
@@ -644,8 +644,6 @@ struct Got_page_entry
unsigned int symndx;
// The ranges for this page entry.
Got_page_range* ranges;
- // The maximum number of page entries needed for RANGES.
- unsigned int num_pages;
};
// Hash for Got_page_entry.
@@ -775,7 +773,7 @@ class Mips_got_info
// Add FROM's GOT page entries.
void
- add_got_page_entries(Mips_got_info<size, big_endian>* from);
+ add_got_page_count(Mips_got_info<size, big_endian>* from);
// Return GOT size.
unsigned int
@@ -928,7 +926,7 @@ class Mips_got_info
Global_got_entry_set global_got_symbols_;
// A hash table holding GOT entries.
Got_entry_set got_entries_;
- // A hash table of GOT page entries.
+ // A hash table of GOT page entries (only used in master GOT).
Got_page_entry_set got_page_entries_;
// The offset of first GOT page entry for this GOT.
unsigned int got_page_offset_start_;
@@ -5794,15 +5792,8 @@ Mips_got_info<size, big_endian>::record_got_page_entry(
else
this->got_page_entries_.insert(entry);
- // Add the same entry to the OBJECT's GOT.
- Got_page_entry* entry2 = new Got_page_entry(*entry);
+ // Get the object's GOT, but we don't need to insert an entry here.
Mips_got_info<size, big_endian>* g2 = object->get_or_create_got_info();
- typename Got_page_entry_set::iterator it2 =
- g2->got_page_entries_.find(entry);
- if (it2 != g2->got_page_entries_.end())
- entry2 = *it2;
- else
- g2->got_page_entries_.insert(entry2);
// Skip over ranges whose maximum extent cannot share a page entry
// with ADDEND.
@@ -5822,8 +5813,6 @@ Mips_got_info<size, big_endian>::record_got_page_entry(
range->max_addend = addend;
*range_ptr = range;
- ++entry->num_pages;
- ++entry2->num_pages;
++this->page_gotno_;
++g2->page_gotno_;
return;
@@ -5851,8 +5840,6 @@ Mips_got_info<size, big_endian>::record_got_page_entry(
new_pages = range->get_max_pages();
if (old_pages != new_pages)
{
- entry->num_pages += new_pages - old_pages;
- entry2->num_pages += new_pages - old_pages;
this->page_gotno_ += new_pages - old_pages;
g2->page_gotno_ += new_pages - old_pages;
}
@@ -6352,22 +6339,10 @@ Mips_got_info<size, big_endian>::add_got_entries(
template<int size, bool big_endian>
void
-Mips_got_info<size, big_endian>::add_got_page_entries(
+Mips_got_info<size, big_endian>::add_got_page_count(
Mips_got_info<size, big_endian>* from)
{
- for (typename Got_page_entry_set::iterator
- p = from->got_page_entries_.begin();
- p != from->got_page_entries_.end();
- ++p)
- {
- Got_page_entry* entry = *p;
- if (this->got_page_entries_.find(entry) == this->got_page_entries_.end())
- {
- Got_page_entry* entry2 = new Got_page_entry(*entry);
- this->got_page_entries_.insert(entry2);
- this->page_gotno_ += entry->num_pages;
- }
- }
+ this->page_gotno_ += from->page_gotno_;
}
// Mips_output_data_got methods.
@@ -6568,7 +6543,7 @@ Mips_output_data_got<size, big_endian>::merge_got_with(
// Transfer the object's GOT information from FROM to TO.
to->add_got_entries(from);
- to->add_got_page_entries(from);
+ to->add_got_page_count(from);
// Record that OBJECT should use output GOT TO.
object->set_got_info(to);