diff options
Diffstat (limited to 'gold/layout.cc')
-rw-r--r-- | gold/layout.cc | 14 |
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()) { |