Don't infer sizes for labels within another symbol

This commit is contained in:
2025-03-03 21:01:22 -07:00
parent ae6d37a10b
commit 4f34dfa194
10 changed files with 3785 additions and 9 deletions

View File

@@ -151,14 +151,22 @@ fn infer_symbol_sizes(symbols: &mut [Symbol], sections: &[Section]) {
// Set symbol sizes based on the next symbol's address
let mut iter_idx = 0;
let mut last_end = (0, 0);
while iter_idx < symbols_with_section.len() {
let symbol_idx = symbols_with_section[iter_idx];
let symbol = &symbols[symbol_idx];
let section_idx = symbol.section.unwrap();
iter_idx += 1;
if symbol.size != 0 {
if symbol.kind != SymbolKind::Section {
last_end = (section_idx, symbol.address + symbol.size);
}
continue;
}
// Skip over symbols that are contained within the previous symbol
if last_end.0 == section_idx && last_end.1 > symbol.address {
continue;
}
let section_idx = symbol.section.unwrap();
let next_symbol = match symbol.kind {
// For function/object symbols, find the next function/object symbol (in other words:
// skip over labels)