|
|
|
@ -31,17 +31,18 @@
|
|
|
|
|
//! This example loads a simple eBPF program and runs it with [rbpf].
|
|
|
|
|
//!
|
|
|
|
|
//! ```no_run
|
|
|
|
|
//! use aya_obj::{generated::bpf_insn, Object};
|
|
|
|
|
//!
|
|
|
|
|
//! use aya_obj::{generated::bpf_insn, Object, Map};
|
|
|
|
|
//!
|
|
|
|
|
//! // Parse the object file
|
|
|
|
|
//! let bytes = std::fs::read("program.o").unwrap();
|
|
|
|
|
//! let mut object = Object::parse(&bytes).unwrap();
|
|
|
|
|
//! // Relocate the programs
|
|
|
|
|
//! #[cfg(feature = "std")]
|
|
|
|
|
//! let text_sections = std::collections::HashSet::new();
|
|
|
|
|
//! let ignore_maps = std::collections::HashMap::new();
|
|
|
|
|
//! let ignore_maps: std::collections::HashMap<String, Map> = std::collections::HashMap::new();
|
|
|
|
|
//! #[cfg(not(feature = "std"))]
|
|
|
|
|
//! let text_sections = hashbrown::HashSet::new();
|
|
|
|
|
//! let ignore_maps = hashbrown::HashMap::new();
|
|
|
|
|
//! object.relocate_calls(&text_sections).unwrap();
|
|
|
|
|
//! object.relocate_maps(std::iter::empty(), &text_sections, &ignore_maps).unwrap();
|
|
|
|
|
//!
|
|
|
|
|