2016-12-11 16:17:21 +00:00
|
|
|
set -ex
|
2016-10-01 00:04:48 +00:00
|
|
|
|
2019-04-02 18:44:28 +00:00
|
|
|
cargo=cargo
|
2017-06-24 04:36:36 +00:00
|
|
|
|
2016-09-29 23:50:04 +00:00
|
|
|
# Test our implementation
|
2019-04-02 18:44:28 +00:00
|
|
|
if [ "$XARGO" = "1" ]; then
|
2019-05-14 19:26:09 +00:00
|
|
|
# FIXME: currently these tests don't work...
|
|
|
|
echo nothing to do
|
2019-04-02 18:44:28 +00:00
|
|
|
else
|
|
|
|
run="cargo test --manifest-path testcrate/Cargo.toml --target $1"
|
|
|
|
$run
|
|
|
|
$run --release
|
|
|
|
$run --features c
|
|
|
|
$run --features c --release
|
2020-11-09 15:24:25 +00:00
|
|
|
$run --features no-asm
|
|
|
|
$run --features no-asm --release
|
2019-04-02 18:44:28 +00:00
|
|
|
fi
|
2016-09-29 23:50:04 +00:00
|
|
|
|
2019-05-14 19:26:09 +00:00
|
|
|
cargo build --target $1
|
|
|
|
cargo build --target $1 --release
|
|
|
|
cargo build --target $1 --features c
|
|
|
|
cargo build --target $1 --release --features c
|
2020-11-09 15:24:25 +00:00
|
|
|
cargo build --target $1 --features no-asm
|
|
|
|
cargo build --target $1 --release --features no-asm
|
2019-05-14 19:26:09 +00:00
|
|
|
|
2016-10-01 00:04:48 +00:00
|
|
|
PREFIX=$(echo $1 | sed -e 's/unknown-//')-
|
2016-09-29 23:50:04 +00:00
|
|
|
case $1 in
|
|
|
|
armv7-*)
|
|
|
|
PREFIX=arm-linux-gnueabihf-
|
|
|
|
;;
|
|
|
|
thumb*)
|
|
|
|
PREFIX=arm-none-eabi-
|
|
|
|
;;
|
2016-09-30 00:47:44 +00:00
|
|
|
*86*-*)
|
2016-09-29 23:50:04 +00:00
|
|
|
PREFIX=
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-05-29 19:38:29 +00:00
|
|
|
NM=$(find $(rustc --print sysroot) -name llvm-nm)
|
|
|
|
if [ "$NM" = "" ]; then
|
|
|
|
NM=${PREFIX}nm
|
|
|
|
fi
|
2016-09-29 23:50:04 +00:00
|
|
|
|
2017-06-24 04:23:52 +00:00
|
|
|
if [ -d /target ]; then
|
2016-12-31 04:18:17 +00:00
|
|
|
path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
|
2017-06-24 04:23:52 +00:00
|
|
|
else
|
|
|
|
path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
|
2016-10-07 19:29:34 +00:00
|
|
|
fi
|
|
|
|
|
2017-06-23 18:52:22 +00:00
|
|
|
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
|
2016-12-31 04:18:17 +00:00
|
|
|
for rlib in $(echo $path); do
|
2017-06-23 17:44:29 +00:00
|
|
|
set +x
|
2019-05-02 20:35:50 +00:00
|
|
|
echo "================================================================"
|
|
|
|
echo checking $rlib for duplicate symbols
|
|
|
|
echo "================================================================"
|
|
|
|
|
2020-05-29 19:38:29 +00:00
|
|
|
stdout=$($NM -g --defined-only $rlib 2>&1)
|
2017-06-24 17:12:17 +00: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 04:18:17 +00:00
|
|
|
set +e
|
2017-06-24 17:12:17 +00:00
|
|
|
echo "$stdout" | \
|
|
|
|
sort | \
|
|
|
|
uniq -d | \
|
|
|
|
grep -v __x86.get_pc_thunk | \
|
|
|
|
grep -v __builtin_cl | \
|
2017-07-07 18:20:04 +00:00
|
|
|
grep -v __builtin_ctz | \
|
2024-01-08 21:23:59 +00:00
|
|
|
grep -v __builtin_sadd_overflow | \
|
2017-06-24 17:12:17 +00:00
|
|
|
grep 'T __'
|
2016-09-29 23:50:04 +00:00
|
|
|
|
2016-12-31 04:18:17 +00:00
|
|
|
if test $? = 0; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-05-02 20:35:50 +00:00
|
|
|
|
2017-06-23 17:44:29 +00:00
|
|
|
set -ex
|
2016-12-31 04:18:17 +00:00
|
|
|
done
|
|
|
|
|
2017-06-23 22:16:07 +00:00
|
|
|
rm -f $path
|
|
|
|
|
2017-06-24 17:04:00 +00:00
|
|
|
# Verify that we haven't drop any intrinsic/symbol
|
2019-05-14 19:26:09 +00:00
|
|
|
build_intrinsics="$cargo build --target $1 -v --example intrinsics"
|
|
|
|
RUSTFLAGS="-C debug-assertions=no" $build_intrinsics
|
|
|
|
RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --release
|
|
|
|
RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --features c
|
|
|
|
RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --features c --release
|
2017-06-24 17:04:00 +00:00
|
|
|
|
|
|
|
# Verify that there are no undefined symbols to `panic` within our
|
|
|
|
# implementations
|
|
|
|
#
|
2017-06-23 22:16:07 +00:00
|
|
|
# TODO(#79) fix the undefined references problem for debug-assertions+lto
|
2017-06-24 04:36:36 +00:00
|
|
|
if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then
|
|
|
|
RUSTFLAGS="-C debug-assertions=no" \
|
2017-12-26 18:14:11 +00:00
|
|
|
CARGO_INCREMENTAL=0 \
|
2020-04-29 20:30:10 +00:00
|
|
|
CARGO_PROFILE_DEV_LTO=true \
|
|
|
|
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics
|
2017-06-24 04:36:36 +00:00
|
|
|
fi
|
2020-04-29 20:30:10 +00:00
|
|
|
CARGO_PROFILE_RELEASE_LTO=true \
|
|
|
|
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics --release
|
2017-06-23 22:16:07 +00:00
|
|
|
|
2017-06-23 18:52:22 +00:00
|
|
|
# Ensure no references to a panicking function
|
|
|
|
for rlib in $(echo $path); do
|
2017-06-23 22:16:07 +00:00
|
|
|
set +ex
|
2020-05-29 19:38:29 +00:00
|
|
|
$NM -u $rlib 2>&1 | grep panicking
|
2017-06-23 18:52:22 +00:00
|
|
|
|
|
|
|
if test $? = 0; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -ex
|
|
|
|
done
|
|
|
|
|
2016-12-31 04:18:17 +00:00
|
|
|
true
|