38
38
39
39
if [ " ${TEST_VERBATIM:- } " = " 1" ]; then
40
40
verb_path=$( cmd.exe //C echo \\\\ ? \\ %cd%\\ testcrate\\ target2)
41
- cargo build --manifest-path testcrate/Cargo.toml --target $target --target-dir $verb_path --features c
41
+ cargo build --manifest-path testcrate/Cargo.toml \
42
+ --target " $target " --target-dir " $verb_path " --features c
42
43
fi
43
44
44
- if [ -d /builtins-target ]; then
45
- rlib_paths=/builtins-target/" ${target} " /debug/deps/libcompiler_builtins-* .rlib
46
- else
47
- rlib_paths=target/" ${target} " /debug/deps/libcompiler_builtins-* .rlib
48
- fi
45
+ declare -a rlib_paths
46
+
47
+ # Set the `rlib_paths` global array to a list of all compiler-builtins rlibs
48
+ update_rlib_paths () {
49
+ if [ -d /builtins-target ]; then
50
+ rlib_paths=( /builtins-target/" ${target} " /debug/deps/libcompiler_builtins-* .rlib )
51
+ else
52
+ rlib_paths=( target/" ${target} " /debug/deps/libcompiler_builtins-* .rlib )
53
+ fi
54
+ }
49
55
50
56
# Remove any existing artifacts from previous tests that don't set #![compiler_builtins]
51
- rm -f $rlib_paths
57
+ update_rlib_paths
58
+ rm -f " ${rlib_paths[@]} "
52
59
53
60
cargo build --target " $target "
54
61
cargo build --target " $target " --release
@@ -76,6 +83,7 @@ NM=$(find "$(rustc --print sysroot)" \( -name llvm-nm -o -name llvm-nm.exe \) )
76
83
if [ " $NM " = " " ]; then
77
84
NM=" ${PREFIX} nm"
78
85
fi
86
+
79
87
# i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with
80
88
# rustup run to ensure that those are in PATH.
81
89
TOOLCHAIN=" $( rustup show active-toolchain | sed ' s/ (default)//' ) "
@@ -84,11 +92,13 @@ if [[ "$TOOLCHAIN" == *i686-pc-windows-gnu ]]; then
84
92
fi
85
93
86
94
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
87
- for rlib in $rlib_paths ; do
95
+ update_rlib_paths
96
+ for rlib in " ${rlib_paths[@]} " ; do
88
97
set +x
89
98
echo " ================================================================"
90
99
echo " checking $rlib for duplicate symbols"
91
100
echo " ================================================================"
101
+ set -x
92
102
93
103
duplicates_found=0
94
104
@@ -108,7 +118,7 @@ for rlib in $rlib_paths; do
108
118
fi
109
119
done
110
120
111
- rm -f $ rlib_paths
121
+ rm -f " ${ rlib_paths[@]} "
112
122
113
123
build_intrinsics () {
114
124
cargo build --target " $target " -v --example intrinsics " $@ "
@@ -128,7 +138,8 @@ CARGO_PROFILE_RELEASE_LTO=true \
128
138
cargo build --target " $target " --example intrinsics --release
129
139
130
140
# Ensure no references to any symbols from core
131
- for rlib in $( echo $rlib_paths ) ; do
141
+ update_rlib_paths
142
+ for rlib in " ${rlib_paths[@]} " ; do
132
143
set +x
133
144
echo " ================================================================"
134
145
echo " checking $rlib for references to core"
0 commit comments