forked from rust-lang/compiler-builtins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·143 lines (123 loc) · 3.66 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·143 lines (123 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
set -ex
case $1 in
thumb*)
cargo=xargo
;;
*)
cargo=cargo
;;
esac
INTRINSICS_FEATURES="c"
# Some architectures like ARM apparently seem to require the `mem` feature
# enabled to successfully compile the `intrinsics` example, and... we're not
# sure why!
if [ -z "$INTRINSICS_FAILS_WITH_MEM_FEATURE" ]; then
INTRINSICS_FEATURES="$INTRINSICS_FEATURES mem"
fi
# Test our implementation
case $1 in
thumb*)
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
# FIXME(#150) debug assertion in divmoddi4
case $1 in
thumbv6m-*)
case $t in
divdi3 | divmoddi4 | moddi3 | modsi3 | udivmoddi4 | udivmodsi4 | umoddi3 | \
umodsi3)
continue
;;
esac
;;
esac
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run
qemu-arm-static target/${1}/debug/$t-*
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release
qemu-arm-static target/${1}/release/$t-*
done
;;
*)
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
;;
esac
PREFIX=$(echo $1 | sed -e 's/unknown-//')-
case $1 in
armv7-*)
PREFIX=arm-linux-gnueabihf-
;;
thumb*)
PREFIX=arm-none-eabi-
;;
*86*-*)
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
NM=gnm
brew install binutils
;;
*)
NM=nm
;;
esac
if [ -d /target ]; then
path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
else
path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
fi
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
for rlib in $(echo $path); do
set +x
stdout=$($PREFIX$NM -g --defined-only $rlib 2>&1)
# 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.
set +e
echo "$stdout" | \
sort | \
uniq -d | \
grep -v __x86.get_pc_thunk | \
grep -v __builtin_cl | \
grep 'T __'
if test $? = 0; then
exit 1
fi
set -ex
done
rm -f $path
# Verify that we haven't drop any intrinsic/symbol
RUSTFLAGS="-C debug-assertions=no" \
$cargo build --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics -v
# Verify that there are no undefined symbols to `panic` within our
# implementations
#
# TODO(#79) fix the undefined references problem for debug-assertions+lto
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
# Ensure no references to a panicking function
for rlib in $(echo $path); do
set +ex
$PREFIX$NM -u $rlib 2>&1 | grep panicking
if test $? = 0; then
exit 1
fi
set -ex
done
true