aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-12-21 21:19:45 +0000
committerIan Lance Taylor <iant@google.com>2007-12-21 21:19:45 +0000
commita9a60db6891083f0afc4df6353a0c7ef80508874 (patch)
tree4a78b23b559b910d217cc25c71fbfea946f646cd /gold/layout.cc
parentdf1764b8ab18419eab855810f86419777d12925a (diff)
downloadgdb-a9a60db6891083f0afc4df6353a0c7ef80508874.zip
gdb-a9a60db6891083f0afc4df6353a0c7ef80508874.tar.gz
gdb-a9a60db6891083f0afc4df6353a0c7ef80508874.tar.bz2
Speed up relocations against local symbols in merged sections.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index 231e2c9..3897ec7 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -732,6 +732,12 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab,
// they contain.
off_t off = this->set_segment_offsets(target, load_seg, &shndx);
+ // Set the file offsets of all the non-data sections we've seen so
+ // far which don't have to wait for the input sections. We need
+ // this in order to finalize local symbols in non-allocated
+ // sections.
+ off = this->set_section_offsets(off, BEFORE_INPUT_SECTIONS_PASS);
+
// Create the symbol table sections.
this->create_symtab_sections(input_objects, symtab, task, &off);
if (!parameters->doing_static_link())
@@ -740,8 +746,8 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab,
// Create the .shstrtab section.
Output_section* shstrtab_section = this->create_shstrtab();
- // Set the file offsets of all the non-data sections which don't
- // have to wait for the input sections.
+ // Set the file offsets of the rest of the non-data sections which
+ // don't have to wait for the input sections.
off = this->set_section_offsets(off, BEFORE_INPUT_SECTIONS_PASS);
// Now that all sections have been created, set the section indexes.
@@ -1113,6 +1119,10 @@ Layout::set_section_offsets(off_t off, Layout::Section_offset_pass pass)
if (*p == this->symtab_section_)
continue;
+ // If we've already set the data size, don't set it again.
+ if ((*p)->is_offset_valid() && (*p)->is_data_size_valid())
+ continue;
+
if (pass == BEFORE_INPUT_SECTIONS_PASS
&& (*p)->requires_postprocessing())
{