diff --git a/src/asm_files.cpp b/src/asm_files.cpp index a07559996..f10f9da77 100644 --- a/src/asm_files.cpp +++ b/src/asm_files.cpp @@ -499,7 +499,7 @@ vector read_elf(std::istream& input_stream, const std::string& path // Now that we've incorporated any subprograms from other sections, we can narrow the list // to return to just those programs in the desired section, if any. - if (!desired_section.empty()) { + if (!desired_section.empty() && !res.empty()) { for (int index = res.size() - 1; index >= 0; index--) { if (res[index].section_name != desired_section) { res.erase(res.begin() + index); diff --git a/src/spec_type_descriptors.hpp b/src/spec_type_descriptors.hpp index 3a5381d74..2e2bd2445 100644 --- a/src/spec_type_descriptors.hpp +++ b/src/spec_type_descriptors.hpp @@ -70,6 +70,9 @@ struct raw_program { std::string function_name{}; std::vector prog{}; program_info info{}; + + // Track whether subprograms for this raw_program have been resolved, + // preventing duplicate resolution when multiple programs exist in a section. bool resolved_subprograms{}; };