Add xargo example

This commit is contained in:
bjorn3 2018-10-08 19:40:06 +02:00
parent 39cfb1e51f
commit 562bd8abfd
5 changed files with 34 additions and 1 deletions

View file

@ -53,7 +53,8 @@ else
cargo build
fi
RUSTC="rustc -Zcodegen-backend=$(pwd)/target/$channel/librustc_codegen_cranelift.$dylib_ext -Cpanic=abort -L crate=target/out --out-dir target/out"
export RUSTFLAGS='-Zalways-encode-mir -Cpanic=abort -Zcodegen-backend='$(pwd)'/target/'$channel'/librustc_codegen_cranelift.'$dylib_ext
RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out"
rm -r target/out || true
mkdir -p target/out/clif
@ -71,5 +72,13 @@ build_example_bin mini_core_hello_world example/mini_core_hello_world.rs
echo "[BUILD] core"
time $RUSTC target/libcore/src/libcore/lib.rs --crate-type lib --crate-name core -Cincremental=target/incremental_core
pushd xargo
rm -r ~/.xargo/HOST
export XARGO_RUST_SRC=$(pwd)'/../target/libcore/src'
time xargo build --color always
rm -r target/
popd
cat target/out/log.txt | sort | uniq -c
#extract_data libcore.rlib core.o

4
xargo/Cargo.lock generated Normal file
View file

@ -0,0 +1,4 @@
[[package]]
name = "xargo"
version = "0.1.0"

6
xargo/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "xargo"
version = "0.1.0"
authors = ["bjorn3 <bjorn3@users.noreply.github.com>"]
[dependencies]

9
xargo/Xargo.toml Normal file
View file

@ -0,0 +1,9 @@
[dependencies]
core = {}
# Disabled due to bug in current cranelift version, fixed in master
#alloc = {}
#alloc_system = {}
# Disabled due to missing support for many things (intrinsics, etc) in rustc_codegen_cranelift
#std = {features = ["force_alloc_system"]}

5
xargo/src/lib.rs Normal file
View file

@ -0,0 +1,5 @@
#![feature(compiler_builtins)]
#![no_std]
#![compiler_builtins] // Don't link to compiler builtins
// Just a dummy