1
1
set -ex
2
2
3
- cargo=cargo
4
-
5
3
# Test our implementation
6
- if [ " $XARGO " = " 1" ]; then
7
- # FIXME: currently these tests don't work...
4
+ if [ " $NO_STD " = " 1" ]; then
8
5
echo nothing to do
9
6
else
10
7
run=" cargo test --manifest-path testcrate/Cargo.toml --target $1 "
16
13
$run --features no-asm --release
17
14
fi
18
15
16
+ if [ -d /target ]; then
17
+ path=/target/${1} /debug/deps/libcompiler_builtins-* .rlib
18
+ else
19
+ path=target/${1} /debug/deps/libcompiler_builtins-* .rlib
20
+ fi
21
+
22
+ # Remove any existing artifacts from previous tests that don't set #![compiler_builtins]
23
+ rm -f $path
24
+
19
25
cargo build --target $1
20
26
cargo build --target $1 --release
21
27
cargo build --target $1 --features c
@@ -41,12 +47,6 @@ if [ "$NM" = "" ]; then
41
47
NM=${PREFIX} nm
42
48
fi
43
49
44
- if [ -d /target ]; then
45
- path=/target/${1} /debug/deps/libcompiler_builtins-* .rlib
46
- else
47
- path=target/${1} /debug/deps/libcompiler_builtins-* .rlib
48
- fi
49
-
50
50
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
51
51
for rlib in $( echo $path ) ; do
52
52
set +x
79
79
rm -f $path
80
80
81
81
# Verify that we haven't drop any intrinsic/symbol
82
- build_intrinsics=" $ cargo build --target $1 -v --example intrinsics"
83
- RUSTFLAGS= " -C debug-assertions=no " $build_intrinsics
84
- RUSTFLAGS= " -C debug-assertions=no " $build_intrinsics --release
85
- RUSTFLAGS= " -C debug-assertions=no " $build_intrinsics --features c
86
- RUSTFLAGS= " -C debug-assertions=no " $build_intrinsics --features c --release
82
+ build_intrinsics=" cargo build --target $1 -v --example intrinsics"
83
+ $build_intrinsics
84
+ $build_intrinsics --release
85
+ $build_intrinsics --features c
86
+ $build_intrinsics --features c --release
87
87
88
88
# Verify that there are no undefined symbols to `panic` within our
89
89
# implementations
90
- #
91
- # TODO(#79) fix the undefined references problem for debug-assertions+lto
92
- if [ -z " $DEBUG_LTO_BUILD_DOESNT_WORK " ]; then
93
- RUSTFLAGS=" -C debug-assertions=no" \
94
- CARGO_INCREMENTAL=0 \
95
- CARGO_PROFILE_DEV_LTO=true \
96
- $cargo rustc --features " $INTRINSICS_FEATURES " --target $1 --example intrinsics
97
- fi
90
+ CARGO_PROFILE_DEV_LTO=true \
91
+ cargo build --target $1 --example intrinsics
98
92
CARGO_PROFILE_RELEASE_LTO=true \
99
- $cargo rustc --features " $INTRINSICS_FEATURES " --target $1 --example intrinsics --release
93
+ cargo build --target $1 --example intrinsics --release
100
94
101
- # Ensure no references to a panicking function
95
+ # Ensure no references to any symbols from core
102
96
for rlib in $( echo $path ) ; do
103
97
set +ex
104
- $NM -u $rlib 2>&1 | grep panicking
98
+ echo " ================================================================"
99
+ echo checking $rlib for references to core
100
+ echo " ================================================================"
101
+
102
+ $NM --quiet -U $rlib | grep ' T _ZN4core' | awk ' {print $3}' | sort | uniq > defined_symbols.txt
103
+ $NM --quiet -u $rlib | grep ' U _ZN4core' | awk ' {print $2}' | sort | uniq > undefined_symbols.txt
104
+ grep -v -F -x -f defined_symbols.txt undefined_symbols.txt
105
105
106
106
if test $? = 0; then
107
107
exit 1
0 commit comments