Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@febo
Copy link
Contributor

@febo febo commented Oct 17, 2025

Problem

The upstream compiler uses target_arch = "bpf" when compiling to bpfel-unknown-none target, while the cfg conditional compilation is currently using only target_os = "solana".

Solution

Add target_arch = "bpf" along side target_os = "solana".

vadorovsky
vadorovsky previously approved these changes Oct 20, 2025
pub mod definitions;

#[cfg(target_feature = "static-syscalls")]
#[cfg(any(target_feature = "static-syscalls", target_arch = "bpf"))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, just to make sure, but is this correct?

From what I understand, static-syscalls are only supported with sbfv3, which might not be enabled. The SIMD still hasn't been accepted: solana-foundation/solana-improvement-documents#178

In that case, shouldn't we avoid using static syscalls for bpf for now and instead use the old model?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point – we had an offline discussion about this. The use of static syscalls for sbpf v0 is unstable, since it was not designed to work with it. While the current implementation works, they have never been tested for v0.

To make this more explicitly, an "unstable-static-syscalls" feature was added to the crate, which needs to be enabled on target_arch = "bpf".

Comment on lines 15 to 17
[features]
unstable-static-syscalls = []

Copy link
Contributor

@LucasSte LucasSte Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this feature is reasonable, because it conveys the message that it is usable, but we don't guarantee it to work.

To complement, we could write a short comment here saying "static syscalls for eBPF are experimental and not guaranteed to work".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants