-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpf: Remove builtin global functions
This commit removes memset and memcpy, relying instead on implementations provided by std/compiler-builtins. This commit adds `#![no_builtins]` to all the BPF programs written in Rust, and the same should be propagated to aya-template and all examples in the book and elsewhere before this commit is merged. It turns out that without the `#![no_builtins]` annotation rustc generates LLVM IR that calls LLVM intrinsics rather than libcalls. These may end up as libcalls after lowering, but not before emitting errors in BPF lowering[0]. This works thanks to rust-lang/rust#113716 which causes `#![no_builtins]` to behave similarly to `-fno-builtin` in clang, which was added in https://reviews.llvm.org/D68028 with similar motivation. This commit implies that we now require rustc nightly >= 2023-07-20. [0] https://github.com/llvm/llvm-project/blob/7b2745b/llvm/lib/Target/BPF/BPFISelLowering.cpp#L472-L474
- Loading branch information
Showing
9 changed files
with
15 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![no_std] | ||
#![no_builtins] | ||
#![no_main] | ||
#![no_std] | ||
|
||
use aya_bpf::{ | ||
bindings::xdp_action, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![no_std] | ||
#![no_builtins] | ||
#![no_main] | ||
#![no_std] | ||
|
||
use core::hint; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![no_std] | ||
#![no_builtins] | ||
#![no_main] | ||
#![no_std] | ||
|
||
use aya_bpf::{ | ||
bindings::xdp_action, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters