소스 검색

docs: update docs for load to mention include_bytes_aligned (#1119)

* 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.
Noah Kennedy 5 달 전
부모
커밋
df053f095b
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      aya/src/bpf.rs

+ 8 - 0
aya/src/bpf.rs

@@ -373,6 +373,10 @@ impl<'a> EbpfLoader<'a> {
 
     /// Loads eBPF bytecode from a buffer.
     ///
+    /// The buffer needs to be 4-bytes aligned. If you are bundling the bytecode statically
+    /// into your binary, it is recommended that you do so using
+    /// [`include_bytes_aligned`](crate::include_bytes_aligned).
+    ///
     /// # Examples
     ///
     /// ```no_run
@@ -896,6 +900,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 buffer needs to be 4-bytes aligned. If you are bundling the bytecode 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