2016-12-12 00:17:21 +08:00
|
|
|
set -ex
|
2016-10-01 08:04:48 +08:00
|
|
|
|
2017-06-24 12:36:36 +08:00
|
|
|
case $1 in
|
|
|
|
thumb*)
|
|
|
|
cargo=xargo
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cargo=cargo
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
INTRINSICS_FEATURES="c"
|
2017-06-25 01:04:00 +08:00
|
|
|
|
|
|
|
# Some architectures like ARM apparently seem to require the `mem` feature
|
|
|
|
# enabled to successfully compile the `intrinsics` example, and... we're not
|
|
|
|
# sure why!
|
2017-06-24 12:36:36 +08:00
|
|
|
if [ -z "$INTRINSICS_FAILS_WITH_MEM_FEATURE" ]; then
|
|
|
|
INTRINSICS_FEATURES="$INTRINSICS_FEATURES mem"
|
|
|
|
fi
|
|
|
|
|
2016-09-30 07:50:04 +08:00
|
|
|
# Test our implementation
|
|
|
|
case $1 in
|
|
|
|
thumb*)
|
2017-04-11 06:16:13 +08:00
|
|
|
for t in $(ls tests); do
|
|
|
|
t=${t%.rs}
|
|
|
|
|
|
|
|
# TODO(#154) enable these tests when aeabi_*mul are implemented
|
|
|
|
case $t in
|
|
|
|
powi*f2)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2017-04-11 06:27:25 +08:00
|
|
|
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run
|
2017-04-11 06:16:13 +08:00
|
|
|
qemu-arm-static target/${1}/debug/$t-*
|
|
|
|
|
2017-04-11 06:27:25 +08:00
|
|
|
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release
|
2017-04-11 06:16:13 +08:00
|
|
|
qemu-arm-static target/${1}/release/$t-*
|
|
|
|
done
|
2016-09-30 07:50:04 +08:00
|
|
|
;;
|
|
|
|
*)
|
2017-06-25 03:44:00 +08:00
|
|
|
run="cargo test --no-default-features --target $1"
|
|
|
|
$run --features 'gen-tests mangled-names'
|
|
|
|
$run --features 'gen-tests mangled-names' --release
|
|
|
|
$run --features 'gen-tests mangled-names c'
|
|
|
|
$run --features 'gen-tests mangled-names c' --release
|
2016-09-30 07:50:04 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
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
|
|
|
|
|
2017-06-24 01:44:29 +08:00
|
|
|
case "$TRAVIS_OS_NAME" in
|
2016-09-30 07:50:04 +08:00
|
|
|
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
|
|
|
|
|
2017-06-24 12:23:52 +08:00
|
|
|
if [ -d /target ]; then
|
2016-12-31 12:18:17 +08:00
|
|
|
path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
|
2017-06-24 12:23:52 +08:00
|
|
|
else
|
|
|
|
path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
|
2016-10-08 03:29:34 +08:00
|
|
|
fi
|
|
|
|
|
2017-06-24 02:52:22 +08:00
|
|
|
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
|
2016-12-31 12:18:17 +08:00
|
|
|
for rlib in $(echo $path); do
|
2017-06-24 01:44:29 +08:00
|
|
|
set +x
|
|
|
|
stdout=$($PREFIX$NM -g --defined-only $rlib 2>&1)
|
2016-10-01 08:04:48 +08:00
|
|
|
|
2017-06-25 01:12:17 +08:00
|
|
|
# NOTE On i586, It's normal that the get_pc_thunk symbol appears several
|
|
|
|
# times so ignore it
|
|
|
|
#
|
|
|
|
# FIXME(#167) - we shouldn't ignore `__builtin_cl` style symbols here.
|
2016-12-31 12:18:17 +08:00
|
|
|
set +e
|
2017-06-25 01:12:17 +08:00
|
|
|
echo "$stdout" | \
|
|
|
|
sort | \
|
|
|
|
uniq -d | \
|
|
|
|
grep -v __x86.get_pc_thunk | \
|
|
|
|
grep -v __builtin_cl | \
|
|
|
|
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
|
2017-06-24 01:44:29 +08:00
|
|
|
set -ex
|
2016-12-31 12:18:17 +08:00
|
|
|
done
|
|
|
|
|
2017-06-24 06:16:07 +08:00
|
|
|
rm -f $path
|
|
|
|
|
2017-06-25 01:04:00 +08:00
|
|
|
# Verify that we haven't drop any intrinsic/symbol
|
2017-06-25 02:43:57 +08:00
|
|
|
RUSTFLAGS="-C debug-assertions=no" \
|
2017-06-26 00:25:54 +08:00
|
|
|
$cargo build --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics -v
|
2017-06-25 01:04:00 +08:00
|
|
|
|
|
|
|
# Verify that there are no undefined symbols to `panic` within our
|
|
|
|
# implementations
|
|
|
|
#
|
2017-06-24 06:16:07 +08:00
|
|
|
# TODO(#79) fix the undefined references problem for debug-assertions+lto
|
2017-06-24 12:36:36 +08:00
|
|
|
if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then
|
|
|
|
RUSTFLAGS="-C debug-assertions=no" \
|
|
|
|
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics -- -C lto
|
|
|
|
fi
|
|
|
|
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics --release -- -C lto
|
2017-06-24 06:16:07 +08:00
|
|
|
|
2017-06-24 02:52:22 +08:00
|
|
|
# Ensure no references to a panicking function
|
|
|
|
for rlib in $(echo $path); do
|
2017-06-24 06:16:07 +08:00
|
|
|
set +ex
|
2017-06-24 02:52:22 +08:00
|
|
|
$PREFIX$NM -u $rlib 2>&1 | grep panicking
|
|
|
|
|
|
|
|
if test $? = 0; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -ex
|
|
|
|
done
|
|
|
|
|
2016-12-31 12:18:17 +08:00
|
|
|
true
|