-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: Remove builtin global functions #698
Conversation
✅ Deploy Preview for aya-rs-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
8234717
to
08bced8
Compare
Add #![no_builtins] to all test programs; see aya-rs/aya#698 for rationale.
Add #![no_builtins] to all test programs; see aya-rs/aya#698 for rationale.
See aya-rs/aya#698 for rationale.
See aya-rs/aya#698 for rationale.
The compiler-builtins fallbacks don't pass the verifier, which is why we provide our own |
I don't think that's correct; if it were, the integration tests would fail here. |
Ignore errors emitted on calls to builtins which are spurious. These builtins end up being lowered to libcalls to hidden functions, which are totally OK. See https://reviews.llvm.org/D155894 and aya-rs/aya#698 for some additional discussion. There doesn't seem to be a silver bullet here; BPF is fundamentally adversarial to these memory intrinsics. We can revisit this once we have DI and can more easily locate the source location that results in their inclusion.
Add #![no_builtins] to all test programs; see aya-rs/aya#698 for rationale.
Add #![no_builtins] to all test programs; see aya-rs/aya#698 for rationale.
We've discussed this on discord, the tests are passing because of inlining. Can we close? |
I'd still like to write better tests, marking as draft if that's ok. |
See aya-rs/aya#698 for rationale.
See aya-rs/aya#698 for rationale.
@tamird, this pull request is now in conflict and requires a rebase. |
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
08bced8
to
e9a099f
Compare
See aya-rs/aya#698 for rationale.
See aya-rs/aya#698 for rationale.
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 inRust, 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 rustcgenerates 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