1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 09:07:10 +03:00
This commit is contained in:
Rui Ueyama 2021-04-12 19:28:38 +09:00
parent d786c8a051
commit 134a52e6cc
2 changed files with 4 additions and 4 deletions

2
mold.h
View File

@ -837,7 +837,7 @@ public:
std::string_view shstrtab;
protected:
std::vector<Symbol<E>> local_syms;
std::unique_ptr<Symbol<E>[]> local_syms;
};
template <typename E>

View File

@ -418,13 +418,13 @@ void ObjectFile<E>::initialize_symbols(Context<E> &ctx) {
counter += elf_syms.size();
// Initialize local symbols
this->local_syms.resize(first_global);
this->local_syms.reset(new Symbol<E>[first_global]);
new (&this->local_syms[0]) Symbol<E>;
for (i64 i = 1; i < first_global; i++) {
const ElfSym<E> &esym = elf_syms[i];
Symbol<E> &sym = this->local_syms[i];
sym.set_name(symbol_strtab.data() + esym.st_name);
new (&sym) Symbol<E>(symbol_strtab.data() + esym.st_name);
if (sym.get_name().empty() && esym.st_type == STT_SECTION)
if (InputSection<E> *sec = get_section(esym))