First stab at Rust BPF (#2269)

First stab at Rust BPF
This commit is contained in:
jackcmay
2019-01-02 15:12:42 -08:00
committed by GitHub
parent e3478ee2ab
commit a461c5682d
19 changed files with 792 additions and 152 deletions

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -ex
# TODO building release flavor with rust produces a bunch of output .bc files
INTERDIR=../../../target/release
OUTDIR="${1:-../../../target/debug/}"
mkdir -p "$OUTDIR"
# cargo +nightly rustc --release -- -C panic=abort --emit=llvm-ir
cargo +nightly rustc --release -- -C panic=abort --emit=llvm-bc
cp "$INTERDIR"/deps/noop_rust-*.bc "$OUTDIR"/noop_rust.bc
/usr/local/opt/llvm/bin/llc -march=bpf -filetype=obj -o "$OUTDIR"/noop_rust.o "$OUTDIR"/noop_rust.bc