diff --git a/main.cc b/main.cc index f85779f3..0cbef30c 100644 --- a/main.cc +++ b/main.cc @@ -855,18 +855,6 @@ int main(int argc, char **argv) { // .rela.dyn, .rela.plt. scan_rels(); - // Compute .symtab and .strtab sizes - { - MyTimer t("symtab_size", before_copy_timer); - tbb::parallel_for_each(out::files, - [](ObjectFile *file) { file->compute_symtab(); }); - - for (ObjectFile *file : out::files) { - out::symtab->shdr.sh_size += file->local_symtab_size + file->global_symtab_size; - out::strtab->shdr.sh_size += file->local_strtab_size + file->global_strtab_size; - } - } - // Add synthetic sections. out::chunks.push_back(out::got); out::chunks.push_back(out::plt); diff --git a/output_chunks.cc b/output_chunks.cc index 9a6a147e..5b53e6b8 100644 --- a/output_chunks.cc +++ b/output_chunks.cc @@ -233,6 +233,9 @@ void DynstrSection::copy_buf() { } void SymtabSection::update_shdr() { + tbb::parallel_for_each(out::files, + [](ObjectFile *file) { file->compute_symtab(); }); + shdr.sh_link = out::strtab->shndx; local_symtab_off.resize(out::files.size() + 1); @@ -260,8 +263,8 @@ void SymtabSection::update_shdr() { global_strtab_off[i - 1] + out::files[i - 1]->global_strtab_size; } - assert(global_symtab_off.back() == out::symtab->shdr.sh_size); - assert(global_strtab_off.back() == out::strtab->shdr.sh_size); + shdr.sh_size = global_symtab_off.back(); + out::strtab->shdr.sh_size = global_strtab_off.back(); } void SymtabSection::copy_buf() {