aboutsummaryrefslogtreecommitdiff
path: root/gold/output.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-11-15 23:46:46 +0000
committerIan Lance Taylor <iant@google.com>2007-11-15 23:46:46 +0000
commit4f4c5f80c7482fbd1c2fd5a3b96547f5099bf3fd (patch)
treed4dbb773a8511bc57cfe9b5462fa44e3c2c2b19e /gold/output.cc
parent02d2ba740273e3f539501337eebf0c6007af0b4b (diff)
downloadbinutils-4f4c5f80c7482fbd1c2fd5a3b96547f5099bf3fd.zip
binutils-4f4c5f80c7482fbd1c2fd5a3b96547f5099bf3fd.tar.gz
binutils-4f4c5f80c7482fbd1c2fd5a3b96547f5099bf3fd.tar.bz2
From Cary Coutant: Count textrel with output sections rather than
setting a flag as we add each reloc in the target code.
Diffstat (limited to 'gold/output.cc')
-rw-r--r--gold/output.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/gold/output.cc b/gold/output.cc
index ef5c509..5832ded 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -1580,6 +1580,28 @@ Output_segment::maximum_alignment(const Output_data_list* pdl)
return ret;
}
+// Return the number of dynamic relocs applied to this segment.
+
+unsigned int
+Output_segment::dynamic_reloc_count() const
+{
+ return (this->dynamic_reloc_count_list(&this->output_data_)
+ + this->dynamic_reloc_count_list(&this->output_bss_));
+}
+
+// Return the number of dynamic relocs applied to an Output_data_list.
+
+unsigned int
+Output_segment::dynamic_reloc_count_list(const Output_data_list* pdl) const
+{
+ unsigned int count = 0;
+ for (Output_data_list::const_iterator p = pdl->begin();
+ p != pdl->end();
+ ++p)
+ count += (*p)->dynamic_reloc_count();
+ return count;
+}
+
// Set the section addresses for an Output_segment. ADDR is the
// address and *POFF is the file offset. Set the section indexes
// starting with *PSHNDX. Return the address of the immediately