diff --git a/input_sections.cc b/input_sections.cc index cdad8783..27766b5a 100644 --- a/input_sections.cc +++ b/input_sections.cc @@ -126,6 +126,11 @@ void InputSection::scan_relocations() { if (!sym->file || !sym->file->is_alive) continue; + if (sym->file->is_dso && set_flag(sym, Symbol::NEEDS_DYNSYM)) { + sym->file->dynsym_size += sizeof(ELF64LE::Sym); + sym->file->dynstr_size += sym->name.size() + 1; + } + switch (rel.getType(false)) { case R_X86_64_GOT32: case R_X86_64_GOT64: diff --git a/mold.h b/mold.h index bba731ba..e6cfdb32 100644 --- a/mold.h +++ b/mold.h @@ -209,7 +209,7 @@ public: u8 is_undef_weak : 1; u8 traced : 1; - enum { NEEDS_GOT = 1, NEEDS_GOTTP = 2, NEEDS_PLT = 4 }; + enum { NEEDS_GOT = 1, NEEDS_GOTTP = 2, NEEDS_PLT = 4, NEEDS_DYNSYM = 8 }; std::atomic_uint8_t flags = ATOMIC_VAR_INIT(0); u8 visibility = 0;