Use `nm` to weed out panics

master
Alex Crichton 2017-06-23 11:52:22 -07:00
parent 5a444d58f2
commit a16ebb0dcb
3 changed files with 16 additions and 3 deletions

View File

@ -63,7 +63,6 @@ case $1 in
;;
esac
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
PREFIX=$(echo $1 | sed -e 's/unknown-//')-
case $1 in
armv7-*)
@ -95,6 +94,7 @@ 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)
@ -109,4 +109,15 @@ for rlib in $(echo $path); do
set -ex
done
# Ensure no references to a panicking function
for rlib in $(echo $path); do
set +x
$PREFIX$NM -u $rlib 2>&1 | grep panicking
if test $? = 0; then
exit 1
fi
set -ex
done
true

View File

@ -78,6 +78,7 @@ intrinsics! {
int_to_float!(i, i32, f64)
}
#[use_c_shim_if(any(target_arch = "x86", target_arch = "x86_64"))]
pub extern "C" fn __floatdidf(i: i64) -> f64 {
int_to_float!(i, i64, f64)
}
@ -100,6 +101,7 @@ intrinsics! {
int_to_float!(i, u32, f64)
}
#[use_c_shim_if(any(target_arch = "x86", target_arch = "x86_64"))]
pub extern "C" fn __floatundidf(i: u64) -> f64 {
int_to_float!(i, u64, f64)
}

View File

@ -54,11 +54,11 @@ trait Mulo: Int + ops::Neg<Output = Self> {
return result;
}
if sa == sb {
if abs_a > Self::max_value() / abs_b {
if abs_a > Self::max_value().checked_div(abs_b).unwrap_or_else(|| ::abort()) {
*overflow = 1;
}
} else {
if abs_a > Self::min_value() / -abs_b {
if abs_a > Self::min_value().checked_div(-abs_b).unwrap_or_else(|| ::abort()) {
*overflow = 1;
}
}