From 35e21ae0079d38e90d90fc85d29580c8b44b16d4 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Mon, 16 Oct 2023 21:47:07 +1100 Subject: [PATCH] aya: don't parse labels as programs Fixes a bug introduced by https://github.com/aya-rs/aya/pull/413 where we were generating a bunch of spurious LBB* programs. --- aya-obj/src/obj.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aya-obj/src/obj.rs b/aya-obj/src/obj.rs index 1776b3ca..9d65690e 100644 --- a/aya-obj/src/obj.rs +++ b/aya-obj/src/obj.rs @@ -599,12 +599,12 @@ impl Object { .get(symbol_index) .expect("all symbols in symbols_by_section are also in symbol_table"); - let Some(name) = symbol.name.as_ref() else { - continue; + // Here we get both ::Label (LBB*) and ::Text symbols, and we only want the latter. + let name = match (symbol.name.as_ref(), symbol.kind) { + (Some(name), SymbolKind::Text) if !name.is_empty() => name, + _ => continue, }; - if name.is_empty() { - continue; - } + let (p, f) = self.parse_program(section, program_section.clone(), name.to_string(), symbol)?; let key = p.function_key();