Skip to content

Commit 7c707e4

Browse files
author
Commeownist
authored
Implement basic inline asm support (rust-lang#72)
* Implement basic support for inline assembly * Disable LTO We don't support it yet at all * Handle `inout(reg) var` correctly Turns out that `+` readwrite output registers cannot be tied with input variables. * Add limited support for llvm_asm! * Handle CHANNEL correctly * Add support for arbitrary explicit registers * Handle symbols properly * Add rudimentary asm tests * Exclude llvm_asm! tests from tests runs * Insert `__builtin_unreachable()` after diverging asm blocks
1 parent 5dad13c commit 7c707e4

File tree

8 files changed

+631
-213
lines changed

8 files changed

+631
-213
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ perf.data.old
77
*.events
88
*.string*
99
/build_sysroot/sysroot
10+
/build_sysroot/sysroot_src
1011
/build_sysroot/Cargo.lock
1112
/build_sysroot/test_target/Cargo.lock
1213
/rust
14+
/simple-raytracer
1315
/regex
1416
gimple*
1517
*asm

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
#set -x
44
set -e
55

6-
export GCC_PATH=$(cat gcc_path)
6+
if [ -f ./gcc_path ]; then
7+
export GCC_PATH=$(cat gcc_path)
8+
else
9+
echo 'Please put the path to your custom build of libgccjit in the file `gcc_path`, see Readme.md for details'
10+
exit 1
11+
fi
712

813
export LD_LIBRARY_PATH="$GCC_PATH"
914
export LIBRARY_PATH="$GCC_PATH"

cargo.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ fi
2020
cmd=$1
2121
shift
2222

23-
RUSTDOCFLAGS=$RUSTFLAGS cargo +${TOOLCHAIN} $cmd --target $TARGET_TRIPLE $@
23+
RUSTDOCFLAGS="$RUSTFLAGS" cargo +${TOOLCHAIN} $cmd --target $TARGET_TRIPLE $@

config.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ set -e
22

33
export CARGO_INCREMENTAL=0
44

5-
export GCC_PATH=$(cat gcc_path)
5+
if [ -f ./gcc_path ]; then
6+
export GCC_PATH=$(cat gcc_path)
7+
else
8+
echo 'Please put the path to your custom build of libgccjit in the file `gcc_path`, see Readme.md for details'
9+
exit 1
10+
fi
611

712
unamestr=`uname`
813
if [[ "$unamestr" == 'Linux' ]]; then
@@ -30,7 +35,7 @@ if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
3035
fi
3136
fi
3237

33-
export RUSTFLAGS=$linker' -Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend='$(pwd)'/target/'$CHANNEL'/librustc_codegen_gcc.'$dylib_ext' --sysroot '$(pwd)'/build_sysroot/sysroot'
38+
export RUSTFLAGS="$linker -Cpanic=abort -Cdebuginfo=2 -Clto=off -Zpanic-abort-tests -Zcodegen-backend=$(pwd)/target/${CHANNEL:-debug}/librustc_codegen_gcc.$dylib_ext --sysroot $(pwd)/build_sysroot/sysroot"
3439

3540
# FIXME(antoyo): remove once the atomic shim is gone
3641
if [[ `uname` == 'Darwin' ]]; then

0 commit comments

Comments
 (0)