3838
3939if [ " ${TEST_VERBATIM:- } " = " 1" ]; then
4040 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
4243fi
4344
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+ }
4955
5056# 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[@]} "
5259
5360cargo build --target " $target "
5461cargo build --target " $target " --release
@@ -76,6 +83,7 @@ NM=$(find "$(rustc --print sysroot)" \( -name llvm-nm -o -name llvm-nm.exe \) )
7683if [ " $NM " = " " ]; then
7784 NM=" ${PREFIX} nm"
7885fi
86+
7987# i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with
8088# rustup run to ensure that those are in PATH.
8189TOOLCHAIN=" $( rustup show active-toolchain | sed ' s/ (default)//' ) "
@@ -84,11 +92,13 @@ if [[ "$TOOLCHAIN" == *i686-pc-windows-gnu ]]; then
8492fi
8593
8694# 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
8897 set +x
8998 echo " ================================================================"
9099 echo " checking $rlib for duplicate symbols"
91100 echo " ================================================================"
101+ set -x
92102
93103 duplicates_found=0
94104
@@ -108,7 +118,7 @@ for rlib in $rlib_paths; do
108118 fi
109119done
110120
111- rm -f $ rlib_paths
121+ rm -f " ${ rlib_paths[@]} "
112122
113123build_intrinsics () {
114124 cargo build --target " $target " -v --example intrinsics " $@ "
@@ -128,7 +138,8 @@ CARGO_PROFILE_RELEASE_LTO=true \
128138 cargo build --target " $target " --example intrinsics --release
129139
130140# 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
132143 set +x
133144 echo " ================================================================"
134145 echo " checking $rlib for references to core"
0 commit comments