2016-12-12 00:17:21 +08:00
|
|
|
set -ex
|
2016-10-01 08:04:48 +08:00
|
|
|
|
2016-09-30 07:50:04 +08:00
|
|
|
# Test our implementation
|
|
|
|
case $1 in
|
|
|
|
thumb*)
|
|
|
|
xargo build --target $1
|
|
|
|
xargo build --target $1 --release
|
|
|
|
;;
|
|
|
|
*)
|
2016-12-12 05:18:43 +08:00
|
|
|
cargo test --no-default-features --target $1
|
|
|
|
cargo test --no-default-features --target $1 --release
|
2016-09-30 07:50:04 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Verify that we haven't drop any intrinsic/symbol
|
|
|
|
case $1 in
|
|
|
|
thumb*)
|
|
|
|
xargo build --features c --target $1 --bin intrinsics
|
|
|
|
;;
|
|
|
|
*)
|
2016-12-12 05:18:43 +08:00
|
|
|
cargo build --no-default-features --features c --target $1 --bin intrinsics
|
2016-09-30 07:50:04 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-10-01 12:10:30 +08:00
|
|
|
# Verify that there are no undefined symbols to `panic` within our implementations
|
2016-10-08 06:48:37 +08:00
|
|
|
# TODO(#79) fix the undefined references problem for debug-assertions+lto
|
2016-10-01 12:10:30 +08:00
|
|
|
case $1 in
|
|
|
|
thumb*)
|
2016-12-31 12:18:17 +08:00
|
|
|
RUSTFLAGS="-C debug-assertions=no" xargo rustc --no-default-features --features c --target $1 --bin intrinsics -- -C lto -C link-arg=-nostartfiles
|
2016-12-12 05:18:43 +08:00
|
|
|
xargo rustc --no-default-features --features c --target $1 --bin intrinsics --release -- -C lto
|
2016-10-01 12:10:30 +08:00
|
|
|
;;
|
|
|
|
*)
|
2016-12-12 05:18:43 +08:00
|
|
|
RUSTFLAGS="-C debug-assertions=no" cargo rustc --no-default-features --features c --target $1 --bin intrinsics -- -C lto
|
|
|
|
cargo rustc --no-default-features --features c --target $1 --bin intrinsics --release -- -C lto
|
2016-10-01 12:10:30 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-09-30 07:50:04 +08:00
|
|
|
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
|
2016-10-01 08:04:48 +08:00
|
|
|
PREFIX=$(echo $1 | sed -e 's/unknown-//')-
|
2016-09-30 07:50:04 +08:00
|
|
|
case $1 in
|
|
|
|
armv7-*)
|
|
|
|
PREFIX=arm-linux-gnueabihf-
|
|
|
|
;;
|
|
|
|
thumb*)
|
|
|
|
PREFIX=arm-none-eabi-
|
|
|
|
;;
|
2016-09-30 08:47:44 +08:00
|
|
|
*86*-*)
|
2016-09-30 07:50:04 +08:00
|
|
|
PREFIX=
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $TRAVIS_OS_NAME in
|
|
|
|
osx)
|
|
|
|
# NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
|
|
|
|
# Use GNU nm instead
|
2016-10-01 06:21:54 +08:00
|
|
|
NM=gnm
|
2016-09-30 07:50:04 +08:00
|
|
|
brew install binutils
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
NM=nm
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-10-08 03:29:34 +08:00
|
|
|
if [ $TRAVIS_OS_NAME = osx ]; then
|
2016-12-31 12:18:17 +08:00
|
|
|
path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
|
2016-10-08 03:29:34 +08:00
|
|
|
else
|
2016-12-31 12:18:17 +08:00
|
|
|
path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
|
2016-10-08 03:29:34 +08:00
|
|
|
fi
|
|
|
|
|
2016-12-31 12:18:17 +08:00
|
|
|
for rlib in $(echo $path); do
|
|
|
|
stdout=$($PREFIX$NM -g --defined-only $rlib)
|
2016-10-01 08:04:48 +08:00
|
|
|
|
2016-12-31 12:18:17 +08:00
|
|
|
# NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
|
|
|
|
set +e
|
|
|
|
echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
|
2016-09-30 07:50:04 +08:00
|
|
|
|
2016-12-31 12:18:17 +08:00
|
|
|
if test $? = 0; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
true
|