From 4a687e0b6824948b2662a74b1677f1430735b13e Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 17 Nov 2020 00:45:02 +0900 Subject: [PATCH] temporary --- main.cc | 14 +++----------- output_chunks.cc | 1 + 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/main.cc b/main.cc index d9f62dcb..33e6ce71 100644 --- a/main.cc +++ b/main.cc @@ -985,24 +985,16 @@ int main(int argc, char **argv) { // Initialize synthetic section contents out::files = files; out::chunks = chunks; - out::shdr->update_shdr(); - out::phdr->update_shdr(); - - if (out::dynamic) - out::dynamic->update_shdr(); - - if (out::hash) - out::hash->update_shdr(); out::symtab->shdr.sh_link = out::strtab->shndx; out::relplt->shdr.sh_link = out::dynsym->shndx; - if (out::hash && out::dynsym) - out::hash->shdr.sh_link = out::dynsym->shndx; - if (out::reldyn) out::reldyn->shdr.sh_link = out::dynsym->shndx; + for (OutputChunk *chunk : chunks) + chunk->update_shdr(); + // Assign offsets to output sections u64 filesize = set_osec_offsets(chunks); diff --git a/output_chunks.cc b/output_chunks.cc index 924141ea..9f4ee513 100644 --- a/output_chunks.cc +++ b/output_chunks.cc @@ -345,6 +345,7 @@ void HashSection::update_shdr() { int header_size = 8; int num_slots = out::dynsym->symbols.size() + 1; shdr.sh_size = header_size + num_slots * 8; + shdr.sh_link = out::dynsym->shndx; } void HashSection::copy_to(u8 *buf) {