Skip to main content

Module syscalls

Module syscalls 

Source
Expand description

Raw Solana syscall declarations.

These are the functions provided by the Solana BPF/SBF runtime. Only available when compiling for target_os = "solana".

§Dual-mode dispatch (SIMD-0178 readiness)

Every declaration goes through define_syscall!, which emits one of two equivalent forms depending on the active build:

  • Default (relocation). With neither the static-syscalls cargo feature nor the static-syscalls target-feature enabled, the macro emits exactly the historical extern "C" declaration. This is byte-for-byte the same relocation-based syscall the framework has always used, so the default build is unchanged.

  • Static (sBPF v3 / SIMD-0178). When static-syscalls is enabled, the macro instead emits an unsafe fn that transmutes the murmur32 hash of the syscall name to the matching extern "C" function pointer and calls it. This is the static-syscall ABI the sBPF v3 loader uses in place of syscall relocations (SIMD-0178), matching the reference solana-define-syscall implementation.

The feature is opt-in and default-off: it exists so Hopper is ready to build for the v3 loader, without changing anything for today’s v0..v2 targets. The hash is computed at const-eval time from the syscall name; the constants are pinned by host tests against known Agave values (e.g. sol_memcmp_ → 0x5FDC_DE31).