diff --git a/src/elf.cpp b/src/elf.cpp index d83908c..25f84da 100644 --- a/src/elf.cpp +++ b/src/elf.cpp @@ -165,27 +165,30 @@ bool read_symbols(N64Recomp::Context& context, const ELFIO::elfio& elf_file, ELF // The symbol wasn't detected as a function, so add it to the data symbols if the context is being dumped. if (!recorded_symbol && dumping_context && !name.empty()) { - uint32_t vram = static_cast(value); + // Skip internal symbols. + if (ELF_ST_VISIBILITY(other) != ELFIO::STV_INTERNAL) { + uint32_t vram = static_cast(value); - // Place this symbol in the absolute symbol list if it's in the absolute section. - uint16_t target_section_index = section_index; - if (section_index == ELFIO::SHN_ABS) { - target_section_index = N64Recomp::SectionAbsolute; - } - else if (section_index >= context.sections.size()) { - fmt::print("Symbol \"{}\" not in a valid section ({})\n", name, section_index); - } + // Place this symbol in the absolute symbol list if it's in the absolute section. + uint16_t target_section_index = section_index; + if (section_index == ELFIO::SHN_ABS) { + target_section_index = N64Recomp::SectionAbsolute; + } + else if (section_index >= context.sections.size()) { + fmt::print("Symbol \"{}\" not in a valid section ({})\n", name, section_index); + } - // Move this symbol into the corresponding non-bss section if it's in a bss section. - auto find_bss_it = bss_section_to_target_section.find(target_section_index); - if (find_bss_it != bss_section_to_target_section.end()) { - target_section_index = find_bss_it->second; - } + // Move this symbol into the corresponding non-bss section if it's in a bss section. + auto find_bss_it = bss_section_to_target_section.find(target_section_index); + if (find_bss_it != bss_section_to_target_section.end()) { + target_section_index = find_bss_it->second; + } - data_syms[target_section_index].emplace_back( - vram, - std::move(name) - ); + data_syms[target_section_index].emplace_back( + vram, + std::move(name) + ); + } } }