Skip to content

Commit d404840

Browse files
committed
Merge commit '5988bbd24aa87732bfa1d111ba00bcdaa22c481a' into sync_cg_clif-2020-11-27
1 parent b5f6c00 commit d404840

33 files changed

+400
-222
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* text=auto eol=lf
2+
*.rs diff=rust

Cargo.lock

Lines changed: 55 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", bran
1515
cranelift-simplejit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
1616
cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1717
target-lexicon = "0.11.0"
18-
gimli = { version = "0.22.0", default-features = false, features = ["write"]}
19-
object = { version = "0.21.1", default-features = false, features = ["std", "read_core", "write", "coff", "elf", "macho", "pe"] }
18+
gimli = { version = "0.23.0", default-features = false, features = ["write"]}
19+
object = { version = "0.22.0", default-features = false, features = ["std", "read_core", "write", "coff", "elf", "macho", "pe"] }
2020

2121
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
2222
indexmap = "1.0.2"

Readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This should build and run your project with rustc_codegen_cranelift instead of t
5151
> You should prefer using the Cargo method.
5252
5353
```bash
54-
$ $cg_clif_dir/build/cg_clif my_crate.rs
54+
$ $cg_clif_dir/build/bin/cg_clif my_crate.rs
5555
```
5656

5757
### Jit mode
@@ -68,7 +68,7 @@ $ $cg_clif_dir/build/cargo.sh jit
6868
or
6969

7070
```bash
71-
$ $cg_clif_dir/build/cg_clif --jit my_crate.rs
71+
$ $cg_clif_dir/build/bin/cg_clif --jit my_crate.rs
7272
```
7373

7474
### Shell
@@ -77,7 +77,7 @@ These are a few functions that allow you to easily run rust code from the shell
7777

7878
```bash
7979
function jit_naked() {
80-
echo "$@" | $cg_clif_dir/build/cg_clif - --jit
80+
echo "$@" | $cg_clif_dir/build/bin/cg_clif - --jit
8181
}
8282

8383
function jit() {

build.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,35 @@ while [[ $# != 0 ]]; do
2626
done
2727

2828
# Build cg_clif
29+
unset CARGO_TARGET_DIR
2930
export RUSTFLAGS="-Zrun_dsymutil=no"
31+
unamestr=$(uname)
32+
if [[ "$unamestr" == 'Linux' ]]; then
33+
export RUSTFLAGS='-Clink-arg=-Wl,-rpath=$ORIGIN/../lib '$RUSTFLAGS
34+
elif [[ "$unamestr" == 'Darwin' ]]; then
35+
export RUSTFLAGS='-Clink-arg=-Wl,-rpath,@loader_path/../lib -Zosx-rpath-install-name '$RUSTFLAGS
36+
dylib_ext='dylib'
37+
else
38+
echo "Unsupported os"
39+
exit 1
40+
fi
3041
if [[ "$CHANNEL" == "release" ]]; then
3142
cargo build --release
3243
else
3344
cargo build
3445
fi
3546

36-
rm -rf $target_dir
37-
mkdir $target_dir
38-
cp -a target/$CHANNEL/cg_clif{,_build_sysroot} target/$CHANNEL/*rustc_codegen_cranelift* $target_dir/
39-
cp -a rust-toolchain scripts/config.sh scripts/cargo.sh $target_dir
47+
rm -rf "$target_dir"
48+
mkdir "$target_dir"
49+
mkdir "$target_dir"/bin "$target_dir"/lib
50+
ln target/$CHANNEL/cg_clif{,_build_sysroot} "$target_dir"/bin
51+
ln target/$CHANNEL/*rustc_codegen_cranelift* "$target_dir"/lib
52+
ln rust-toolchain scripts/config.sh scripts/cargo.sh "$target_dir"
4053

4154
if [[ "$build_sysroot" == "1" ]]; then
4255
echo "[BUILD] sysroot"
4356
export CG_CLIF_INCR_CACHE_DISABLED=1
4457
dir=$(pwd)
45-
cd $target_dir
46-
time $dir/build_sysroot/build_sysroot.sh
58+
cd "$target_dir"
59+
time "$dir/build_sysroot/build_sysroot.sh"
4760
fi

0 commit comments

Comments
 (0)