From 0f9e6a43b669c0e13f0cc26eb2f17fc2f9d1fac1 Mon Sep 17 00:00:00 2001 From: noah <noah@despise.computer> Date: Sat, 21 Dec 2024 20:48:12 -0600 Subject: [PATCH] docs: update docs for load to mention include_bytes_aligned 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. --- aya/src/bpf.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index b812f6f2..d77211ec 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -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 @@ -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