-
Notifications
You must be signed in to change notification settings - Fork 139
address: Add bpf target #389
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
base: master
Are you sure you want to change the base?
Conversation
|
Needs #387 to go first. |
| bytemuck = ["copy", "dep:bytemuck", "dep:bytemuck_derive"] | ||
| copy = [] | ||
| curve25519 = ["dep:curve25519-dalek", "error", "sha2"] | ||
| curve25519 = ["dep:curve25519-dalek", "sha2", "syscalls"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling feature "curve25519" will enable the syscalls module, which will try to use solana-define-syscall dependency when target_os = "solana" or target_arch = "bpf", breaking the build. The fix here enables the "syscalls" feature so the dependency is found; it has no effect on other targets, it will only bring the required "error" feature.
Alternatively, we could improve the separation between the "curve25519" and "syscalls" features, but this does not seem necessary at the moment.
|
|
||
| /// Marker used to find program derived addresses (PDAs). | ||
| #[cfg(target_arch = "bpf")] | ||
| pub static PDA_MARKER: &[u8; 21] = b"ProgramDerivedAddress"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target_arch = "bpf" only supports scalar constants, so we need to switch this to be static instead.
| macro_rules! declare_id { | ||
| ($address:expr) => { | ||
| /// The const program ID. | ||
| pub static ID: $crate::Address = $crate::Address::from_str_const($address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, needs to be static for target_arch = "bpf".
d2eb205 to
2ecd2ac
Compare
Problem
The upstream compiler uses
target_arch = "bpf"when compiling tobpfel-unknown-nonetarget, while thecfgconditional compilation is currently using onlytarget_os = "solana".Solution
Add
target_arch = "bpf"along sidetarget_os = "solana".