capstone-rust / capstone-rs

high-level Capstone system bindings for Rust
217 stars 75 forks source link

Support wasm32-wasi #70

Closed tmfink closed 5 years ago

tmfink commented 5 years ago

Requirements

Build cstool

Tell cc crate to use our WASI sysroot and clang-8 compiler:

cd cstool  # go to path with cstool dir
CFLAGS_wasm32_wasi="--sysroot=/path/to/wasi/sysroot" \
    CC=clang-8 \
    cargo +nightly build --target=wasm32-wasi

Run cstool

cd cstool  # go to path with cstool dir
wasmer run ../target/wasm32-wasi/debug/cstool.wasm -- --arch x86 --mode mode32 --code 909090e812345678
codecov[bot] commented 5 years ago

Codecov Report

Merging #70 into master will increase coverage by 0.75%. The diff coverage is 95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #70      +/-   ##
==========================================
+ Coverage   94.82%   95.57%   +0.75%     
==========================================
  Files          19       19              
  Lines        3727     4381     +654     
==========================================
+ Hits         3534     4187     +653     
- Misses        193      194       +1
Impacted Files Coverage Δ
capstone-rs/src/arch/arm.rs 90.21% <ø> (-0.2%) :arrow_down:
capstone-rs/src/arch/mips.rs 97.5% <ø> (ø) :arrow_up:
capstone-rs/src/arch/xcore.rs 92.5% <ø> (+0.19%) :arrow_up:
capstone-rs/src/capstone.rs 98.46% <ø> (+2.8%) :arrow_up:
capstone-rs/src/arch/sparc.rs 94.59% <ø> (+3.29%) :arrow_up:
capstone-rs/src/arch/mod.rs 92.85% <ø> (+1.45%) :arrow_up:
capstone-rs/src/arch/tms320c64x.rs 99.02% <ø> (+1.35%) :arrow_up:
capstone-rs/src/instruction.rs 88.43% <ø> (ø) :arrow_up:
capstone-rs/src/arch/evm.rs 86.11% <ø> (-2.36%) :arrow_down:
capstone-rs/src/ffi.rs 100% <ø> (ø) :arrow_up:
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a74126c...faade79. Read the comment docs.

tmfink commented 5 years ago

https://github.com/rust-lang/libc/pull/1407 fixes the issue:

cannot find type `c_schar` in module `libc`