aya: use correct program name when relocating

pull/130/head
Will 3 years ago
parent c0f695c4b6
commit bb8a813eef

@ -2,6 +2,7 @@ use std::{
collections::HashMap, collections::HashMap,
convert::{TryFrom, TryInto}, convert::{TryFrom, TryInto},
io, mem, ptr, io, mem, ptr,
str::FromStr,
}; };
use thiserror::Error; use thiserror::Error;
@ -16,7 +17,7 @@ use crate::{
fields_are_compatible, member_bit_field_size, member_bit_offset, types_are_compatible, fields_are_compatible, member_bit_field_size, member_bit_offset, types_are_compatible,
BtfType, MAX_SPEC_LEN, BtfType, MAX_SPEC_LEN,
}, },
Btf, BtfError, Object, Program, Btf, BtfError, Object, Program, ProgramSection,
}, },
BpfError, BpfError,
}; };
@ -161,12 +162,12 @@ impl Object {
for (sec_name_off, relos) in btf_ext.relocations() { for (sec_name_off, relos) in btf_ext.relocations() {
let section_name = local_btf.string_at(*sec_name_off)?; let section_name = local_btf.string_at(*sec_name_off)?;
// FIXME let program_section = match ProgramSection::from_str(&section_name) {
let parts = section_name.split('/').collect::<Vec<_>>(); Ok(program) => program,
if parts.len() < 2 { Err(_) => continue,
continue; };
} let section_name = program_section.name();
let section_name = parts[1];
let program = self let program = self
.programs .programs
.get_mut(section_name) .get_mut(section_name)

Loading…
Cancel
Save