Diff cleanup & fixes

This commit is contained in:
Luke Street
2024-03-18 22:56:13 -06:00
parent 3c74b89f15
commit 4dfc28fc68
6 changed files with 59 additions and 65 deletions
+14
View File
@@ -139,3 +139,17 @@ pub struct ObjReloc {
pub target: ObjSymbol,
pub target_section: Option<String>,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SymbolRef {
pub section_idx: usize,
pub symbol_idx: usize,
}
impl ObjInfo {
pub fn section_symbol(&self, symbol_ref: SymbolRef) -> (&ObjSection, &ObjSymbol) {
let section = &self.sections[symbol_ref.section_idx];
let symbol = &section.symbols[symbol_ref.symbol_idx];
(section, symbol)
}
}