aya: obj: rename symbol_table to symbols_by_index

pull/1/head
Alessandro Decina 4 years ago
parent 286e117fe0
commit 318c16cea3

@ -35,7 +35,7 @@ pub struct Object {
pub(crate) maps: HashMap<String, Map>, pub(crate) maps: HashMap<String, Map>,
pub(crate) programs: HashMap<String, Program>, pub(crate) programs: HashMap<String, Program>,
pub(crate) relocations: HashMap<SectionIndex, Vec<Relocation>>, pub(crate) relocations: HashMap<SectionIndex, Vec<Relocation>>,
pub(crate) symbol_table: HashMap<SymbolIndex, Symbol>, pub(crate) symbols_by_index: HashMap<SymbolIndex, Symbol>,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -113,7 +113,7 @@ impl Object {
if let Some(symbol_table) = obj.symbol_table() { if let Some(symbol_table) = obj.symbol_table() {
for symbol in symbol_table.symbols() { for symbol in symbol_table.symbols() {
bpf_obj.symbol_table.insert( bpf_obj.symbols_by_index.insert(
symbol.index(), symbol.index(),
Symbol { Symbol {
name: symbol.name().ok().map(String::from), name: symbol.name().ok().map(String::from),
@ -137,7 +137,7 @@ impl Object {
maps: HashMap::new(), maps: HashMap::new(),
programs: HashMap::new(), programs: HashMap::new(),
relocations: HashMap::new(), relocations: HashMap::new(),
symbol_table: HashMap::new(), symbols_by_index: HashMap::new(),
} }
} }

@ -61,7 +61,7 @@ impl Object {
.map(|map| (map.obj.section_index, map)) .map(|map| (map.obj.section_index, map))
.collect::<HashMap<_, _>>(); .collect::<HashMap<_, _>>();
let symbol_table = &self.symbol_table; let symbol_table = &self.symbols_by_index;
for (program_name, program) in self.programs.iter_mut() { for (program_name, program) in self.programs.iter_mut() {
if let Some(relocations) = self.relocations.get(&program.section_index) { if let Some(relocations) = self.relocations.get(&program.section_index) {
relocate_program(program, relocations, &maps_by_section, symbol_table).map_err( relocate_program(program, relocations, &maps_by_section, symbol_table).map_err(

Loading…
Cancel
Save