]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_gcc/config.sh
Merge commit '0c89065b934397b62838fe3e4ef6f6352fc52daf' into libgccjit-codegen
[rust.git] / compiler / rustc_codegen_gcc / config.sh
1 set -e
2
3 export CARGO_INCREMENTAL=0
4
5 export GCC_PATH=$(cat gcc_path)
6
7 unamestr=`uname`
8 if [[ "$unamestr" == 'Linux' ]]; then
9    dylib_ext='so'
10 elif [[ "$unamestr" == 'Darwin' ]]; then
11    dylib_ext='dylib'
12 else
13    echo "Unsupported os"
14    exit 1
15 fi
16
17 HOST_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
18 TARGET_TRIPLE=$HOST_TRIPLE
19 #TARGET_TRIPLE="aarch64-unknown-linux-gnu"
20
21 linker=''
22 RUN_WRAPPER=''
23 if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
24    if [[ "$TARGET_TRIPLE" == "aarch64-unknown-linux-gnu" ]]; then
25       # We are cross-compiling for aarch64. Use the correct linker and run tests in qemu.
26       linker='-Clinker=aarch64-linux-gnu-gcc'
27       RUN_WRAPPER='qemu-aarch64 -L /usr/aarch64-linux-gnu'
28    else
29       echo "Unknown non-native platform"
30    fi
31 fi
32
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'
34 #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 -Clto=fat -Cembed-bitcode=yes'
35
36 # FIXME remove once the atomic shim is gone
37 if [[ `uname` == 'Darwin' ]]; then
38    export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
39 fi
40
41 RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out"
42 export RUSTC_LOG=warn # display metadata load errors
43
44 export LD_LIBRARY_PATH="$(pwd)/target/out:$(pwd)/build_sysroot/sysroot/lib/rustlib/$TARGET_TRIPLE/lib:$GCC_PATH"
45 export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
46
47 export CG_CLIF_DISPLAY_CG_TIME=1
48 export CG_CLIF_INCR_CACHE_DISABLED=1