@@ -17,6 +17,7 @@ Rust (user-space) virtual machine for eBPF
17
17
* [ API] ( #api )
18
18
* [ Example uses] ( #example-uses )
19
19
* [ Building eBPF programs] ( #building-ebpf-programs )
20
+ * [ Build Features] ( #build-features )
20
21
* [ Feedback welcome!] ( #feedback-welcome )
21
22
* [ Questions / Answers] ( #questions--answers )
22
23
* [ Caveats] ( #caveats )
@@ -555,6 +556,30 @@ program.add(Source::Imm, Arch::X64).set_dst(1).set_imm(0x605).push()
555
556
Again, please refer to [ the source and related tests] ( src/insn_builder.rs ) to
556
557
get more information and examples on how to use it.
557
558
559
+ ## Build features
560
+
561
+ ### ` no_std `
562
+
563
+ The ` rbpf ` crate has a Cargo feature named "std" that is enabled by default. To
564
+ use ` rbpf ` in ` no_std ` environments this feature needs to be disabled. To do
565
+ this, you need to modify your dependency on ` rbpf ` in Cargo.toml to disable the
566
+ enabled-by-default features.
567
+
568
+ ``` toml
569
+ [dependencies ]
570
+ rbpf = { version = " 1.0" , default-features = false }
571
+ ```
572
+
573
+ Note that when using this crate in ` no_std ` environments, the ` jit ` module
574
+ isn't available. This is because it depends on functions provided by ` libc `
575
+ (` libc::posix_memalign() ` , ` libc::mprotect() ` ) which aren't available on
576
+ ` no_std ` .
577
+
578
+ The ` assembler ` module is available, albeit with reduced debugging features. It
579
+ depends on the ` combine ` crate providing parser combinators. Under ` no_std `
580
+ this crate only provides simple parsers which generate less descriptive error
581
+ messages.
582
+
558
583
## Feedback welcome!
559
584
560
585
This is the author's first try at writing Rust code. He learned a lot in the
0 commit comments