@@ -93,15 +93,6 @@ InputFile<E>::InputFile(Context<E> &ctx, MappedFile *mf)
9393 shstrtab = this ->get_string (ctx, shstrtab_idx);
9494}
9595
96- template <typename E>
97- void InputFile<E>::populate_symbol_names() {
98- symbol_names.reserve (elf_syms.size ());
99- for (const ElfSym<E> &esym : elf_syms) {
100- const char *p = symbol_strtab.data () + esym.st_name ;
101- symbol_names.emplace_back (p, strlen (p));
102- }
103- }
104-
10596template <typename E>
10697ElfShdr<E> *InputFile<E>::find_section(i64 type) {
10798 for (ElfShdr<E> &sec : elf_sections)
@@ -338,7 +329,7 @@ void ObjectFile<E>::initialize_sections(Context<E> &ctx) {
338329 signature = this ->shstrtab .data () +
339330 this ->elf_sections [get_shndx (esym)].sh_name ;
340331 } else {
341- signature = this ->symbol_names [shdr. sh_info ] ;
332+ signature = this ->symbol_strtab . data () + esym. st_name ;
342333 }
343334
344335 // Ignore a broken comdat group GCC emits for .debug_macros.
@@ -655,7 +646,7 @@ void ObjectFile<E>::initialize_symbols(Context<E> &ctx) {
655646 if (esym.st_type == STT_SECTION)
656647 name = this ->shstrtab .data () + this ->elf_sections [get_shndx (esym)].sh_name ;
657648 else
658- name = this ->symbol_names [i] ;
649+ name = this ->symbol_strtab . data () + esym. st_name ;
659650
660651 Symbol<E> &sym = this ->local_syms [i];
661652 sym.set_name (name);
@@ -683,7 +674,7 @@ void ObjectFile<E>::initialize_symbols(Context<E> &ctx) {
683674 has_common_symbol = true ;
684675
685676 // Get a symbol name
686- std::string_view key = this ->symbol_names [i] ;
677+ std::string_view key = this ->symbol_strtab . data () + esym. st_name ;
687678 std::string_view name = key;
688679
689680 // Parse symbol version after atsign
@@ -898,7 +889,6 @@ void ObjectFile<E>::parse(Context<E> &ctx) {
898889 this ->first_global = symtab_sec->sh_info ;
899890 this ->elf_syms = this ->template get_data <ElfSym<E>>(ctx, *symtab_sec);
900891 this ->symbol_strtab = this ->get_string (ctx, symtab_sec->sh_link );
901- this ->populate_symbol_names ();
902892
903893 if (ElfShdr<E> *shdr = this ->find_section (SHT_SYMTAB_SHNDX))
904894 symtab_shndx_sec = this ->template get_data <U32<E>>(ctx, *shdr);
0 commit comments