@@ -72,6 +72,108 @@ cargo build -p compiler_builtins --target "$target" --features no-asm --release
7272cargo build -p compiler_builtins --target " $target " --features no-f16-f128
7373cargo build -p compiler_builtins --target " $target " --features no-f16-f128 --release
7474
75+ PREFIX=${target// unknown-/ } -
76+ case " $target " in
77+ armv7-* )
78+ PREFIX=arm-linux-gnueabihf-
79+ ;;
80+ thumb* )
81+ PREFIX=arm-none-eabi-
82+ ;;
83+ * 86* -* )
84+ PREFIX=
85+ ;;
86+ esac
87+
88+ NM=$( find " $( rustc --print sysroot) " \( -name llvm-nm -o -name llvm-nm.exe \) )
89+ if [ " $NM " = " " ]; then
90+ NM=" ${PREFIX} nm"
91+ fi
92+
93+ # i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with
94+ # rustup run to ensure that those are in PATH.
95+ TOOLCHAIN=" $( rustup show active-toolchain | sed ' s/ (default)//' ) "
96+ if [[ " $TOOLCHAIN " == * i686-pc-windows-gnu ]]; then
97+ NM=" rustup run $TOOLCHAIN $NM "
98+ fi
99+
100+ # Look out for duplicated symbols when we include the compiler-rt (C) implementation
101+ update_rlib_paths
102+ for rlib in " ${rlib_paths[@]} " ; do
103+ set +x
104+ echo " ================================================================"
105+ echo " checking $rlib for duplicate symbols"
106+ echo " ================================================================"
107+ set -x
108+
109+ duplicates_found=0
110+
111+ # NOTE On i586, It's normal that the get_pc_thunk symbol appears several
112+ # times so ignore it
113+ $NM -g --defined-only " $rlib " 2>&1 |
114+ sort |
115+ uniq -d |
116+ grep -v __x86.get_pc_thunk --quiet |
117+ grep ' T __' && duplicates_found=1
118+
119+ if [ " $duplicates_found " != 0 ]; then
120+ echo " error: found duplicate symbols"
121+ exit 1
122+ else
123+ echo " success; no duplicate symbols found"
124+ fi
125+ done
126+
127+ rm -f " ${rlib_paths[@]} "
128+
129+ build_intrinsics_test () {
130+ cargo build \
131+ --target " $target " --verbose \
132+ --manifest-path builtins-test-intrinsics/Cargo.toml " $@ "
133+ }
134+
135+ # Verify that we haven't dropped any intrinsics/symbols
136+ build_intrinsics_test
137+ build_intrinsics_test --release
138+ build_intrinsics_test --features c
139+ build_intrinsics_test --features c --release
140+
141+ # Verify that there are no undefined symbols to `panic` within our
142+ # implementations
143+ CARGO_PROFILE_DEV_LTO=true build_intrinsics_test
144+ CARGO_PROFILE_RELEASE_LTO=true build_intrinsics_test --release
145+
146+ # Ensure no references to any symbols from core
147+ update_rlib_paths
148+ for rlib in " ${rlib_paths[@]} " ; do
149+ set +x
150+ echo " ================================================================"
151+ echo " checking $rlib for references to core"
152+ echo " ================================================================"
153+ set -x
154+
155+ tmpdir=" ${CARGO_TARGET_DIR:- target} /tmp"
156+ test -d " $tmpdir " || mkdir " $tmpdir "
157+ defined=" $tmpdir /defined_symbols.txt"
158+ undefined=" $tmpdir /defined_symbols.txt"
159+
160+ $NM --quiet -U " $rlib " | grep ' T _ZN4core' | awk ' {print $3}' | sort | uniq > " $defined "
161+ $NM --quiet -u " $rlib " | grep ' U _ZN4core' | awk ' {print $2}' | sort | uniq > " $undefined "
162+ grep_has_results=0
163+ grep -v -F -x -f " $defined " " $undefined " && grep_has_results=1
164+
165+ if [ " $target " = " powerpc64-unknown-linux-gnu" ]; then
166+ echo " FIXME: powerpc64 fails these tests"
167+ elif [ " $grep_has_results " != 0 ]; then
168+ echo " error: found unexpected references to core"
169+ exit 1
170+ else
171+ echo " success; no references to core found"
172+ fi
173+ done
174+
175+ # Test libm
176+
75177mflags=()
76178
77179# We enumerate features manually.
@@ -138,22 +240,23 @@ if [ "${BUILD_ONLY:-}" = "1" ]; then
138240else
139241 mflags+=(--all --target " $target " )
140242 cmd=(cargo test " ${mflags[@]} " )
141- profile =" --profile"
243+ profile_flag =" --profile"
142244
143245 # If nextest is available, use that
144246 command -v cargo-nextest && nextest=1 || nextest=0
145247 if [ " $nextest " = " 1" ]; then
146- cfg_flags=()
248+ cmd=(cargo nextest run --max-fail=10)
249+
147250 # Workaround for https://github.com/nextest-rs/nextest/issues/2066
148251 if [ -f /.dockerenv ]; then
149252 cfg_file=" /tmp/nextest-config.toml"
150253 echo " [store]" >> " $cfg_file "
151254 echo " dir = \" $CARGO_TARGET_DIR /nextest\" " >> " $cfg_file "
152- cfg_flags =(--config-file " $cfg_file " )
255+ cmd+ =(--config-file " $cfg_file " )
153256 fi
154257
155- cmd=(cargo nextest run " ${cfg_flags[@]} " --max-fail=10 " ${mflags[@]} " )
156- profile =" --cargo-profile"
258+ cmd+=( " ${mflags[@]} " )
259+ profile_flag =" --cargo-profile"
157260 fi
158261
159262 # Test once without intrinsics
@@ -172,10 +275,10 @@ else
172275
173276 # Test the same in release mode, which also increases coverage. Also ensure
174277 # the soft float routines are checked.
175- " ${cmd[@]} " " $profile " release-checked
176- " ${cmd[@]} " " $profile " release-checked --features force-soft-floats
177- " ${cmd[@]} " " $profile " release-checked --features unstable-intrinsics
178- " ${cmd[@]} " " $profile " release-checked --features unstable-intrinsics --benches
278+ " ${cmd[@]} " " $profile_flag " release-checked
279+ " ${cmd[@]} " " $profile_flag " release-checked --features force-soft-floats
280+ " ${cmd[@]} " " $profile_flag " release-checked --features unstable-intrinsics
281+ " ${cmd[@]} " " $profile_flag " release-checked --features unstable-intrinsics --benches
179282
180283 # Ensure that the routines do not panic.
181284 #
@@ -190,106 +293,3 @@ else
190293 --tests \
191294 --profile release-opt
192295fi
193-
194-
195- PREFIX=${target// unknown-/ } -
196- case " $target " in
197- armv7-* )
198- PREFIX=arm-linux-gnueabihf-
199- ;;
200- thumb* )
201- PREFIX=arm-none-eabi-
202- ;;
203- * 86* -* )
204- PREFIX=
205- ;;
206- esac
207-
208- NM=$( find " $( rustc --print sysroot) " \( -name llvm-nm -o -name llvm-nm.exe \) )
209- if [ " $NM " = " " ]; then
210- NM=" ${PREFIX} nm"
211- fi
212-
213- # i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with
214- # rustup run to ensure that those are in PATH.
215- TOOLCHAIN=" $( rustup show active-toolchain | sed ' s/ (default)//' ) "
216- if [[ " $TOOLCHAIN " == * i686-pc-windows-gnu ]]; then
217- NM=" rustup run $TOOLCHAIN $NM "
218- fi
219-
220- # Look out for duplicated symbols when we include the compiler-rt (C) implementation
221- update_rlib_paths
222- for rlib in " ${rlib_paths[@]} " ; do
223- set +x
224- echo " ================================================================"
225- echo " checking $rlib for duplicate symbols"
226- echo " ================================================================"
227- set -x
228-
229- duplicates_found=0
230-
231- # NOTE On i586, It's normal that the get_pc_thunk symbol appears several
232- # times so ignore it
233- $NM -g --defined-only " $rlib " 2>&1 |
234- sort |
235- uniq -d |
236- grep -v __x86.get_pc_thunk --quiet |
237- grep ' T __' && duplicates_found=1
238-
239- if [ " $duplicates_found " != 0 ]; then
240- echo " error: found duplicate symbols"
241- exit 1
242- else
243- echo " success; no duplicate symbols found"
244- fi
245- done
246-
247- rm -f " ${rlib_paths[@]} "
248-
249- build_intrinsics_test () {
250- cargo build \
251- --target " $target " --verbose \
252- --manifest-path builtins-test-intrinsics/Cargo.toml " $@ "
253- }
254-
255- # Verify that we haven't dropped any intrinsics/symbols
256- build_intrinsics_test
257- build_intrinsics_test --release
258- build_intrinsics_test --features c
259- build_intrinsics_test --features c --release
260-
261- # Verify that there are no undefined symbols to `panic` within our
262- # implementations
263- CARGO_PROFILE_DEV_LTO=true build_intrinsics_test
264- CARGO_PROFILE_RELEASE_LTO=true build_intrinsics_test --release
265-
266- # Ensure no references to any symbols from core
267- update_rlib_paths
268- for rlib in " ${rlib_paths[@]} " ; do
269- set +x
270- echo " ================================================================"
271- echo " checking $rlib for references to core"
272- echo " ================================================================"
273- set -x
274-
275- tmpdir=" ${CARGO_TARGET_DIR:- target} /tmp"
276- test -d " $tmpdir " || mkdir " $tmpdir "
277- defined=" $tmpdir /defined_symbols.txt"
278- undefined=" $tmpdir /defined_symbols.txt"
279-
280- $NM --quiet -U " $rlib " | grep ' T _ZN4core' | awk ' {print $3}' | sort | uniq > " $defined "
281- $NM --quiet -u " $rlib " | grep ' U _ZN4core' | awk ' {print $2}' | sort | uniq > " $undefined "
282- grep_has_results=0
283- grep -v -F -x -f " $defined " " $undefined " && grep_has_results=1
284-
285- if [ " $target " = " powerpc64-unknown-linux-gnu" ]; then
286- echo " FIXME: powerpc64 fails these tests"
287- elif [ " $grep_has_results " != 0 ]; then
288- echo " error: found unexpected references to core"
289- exit 1
290- else
291- echo " success; no references to core found"
292- fi
293- done
294-
295- true
0 commit comments