Skip to content

Commit

Permalink
docs: update docs for load to mention include_bytes_aligned
Browse files Browse the repository at this point in the history
This macro is required if you are bundling programs statically into your binary, which is not an uncommon thing to do.

This change updates the documentation for the load function to mention this macro and the need for alignment.
  • Loading branch information
Noah-Kennedy committed Dec 22, 2024
1 parent cc2da4a commit f032997
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions aya/src/bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ impl<'a> EbpfLoader<'a> {

/// Loads eBPF bytecode from a buffer.
///
/// The program will need to be aligned properly for you to use it.
/// If you are bundling this statically into your binary, it is recommended that you do so
/// using [`include_bytes_aligned`](crate::include_bytes_aligned).
///
/// # Examples
///
/// ```no_run
Expand Down Expand Up @@ -898,6 +902,10 @@ impl Ebpf {
/// [maps](crate::maps) defined in it. If the kernel supports [BTF](Btf)
/// debug info, it is automatically loaded from `/sys/kernel/btf/vmlinux`.
///
/// The program will need to be aligned properly for you to use it.
/// If you are bundling this statically into your binary, it is recommended that you do so
/// using [`include_bytes_aligned`](crate::include_bytes_aligned).
///
/// For more loading options, see [EbpfLoader].
///
/// # Examples
Expand Down

0 comments on commit f032997

Please sign in to comment.