nicolasbauw / rust-asm-ffi

Using FFI to Call Assembly Functions from Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using FFI to Call Assembly Functions from Rust

This is a mini-howto for people wanting to call assembly functions from their Rust code.

  • assembly is not inline assembly, but a separate .s source file
  • just replace mnemonics to fit your target CPU (here, three examples for armv6, aarch64 and riscv64)

Cross-compilation for Raspberry Pi 1B:

rustup target add arm-unknown-linux-musleabihf  
brew install arm-linux-gnueabihf-binutils  
cargo build --target="arm-unknown-linux-musleabihf" --release

Linux users could replace musleabihf by gnueabihf.

About

Using FFI to Call Assembly Functions from Rust


Languages

Language:Rust 76.7%Language:Assembly 23.3%