check that we don't have any call to panic in our implementations

This commit is contained in:
Jorge Aparicio 2016-09-30 23:10:30 -05:00
parent 534d22e287
commit a2ffc799d0
3 changed files with 75 additions and 44 deletions

View File

@ -26,3 +26,6 @@ c = []
weak = ["rlibc/weak"] weak = ["rlibc/weak"]
[workspace] [workspace]
[profile.release]
lto = true

View File

@ -28,6 +28,16 @@ case $1 in
;; ;;
esac esac
# Verify that there are no undefined symbols to `panic` within our implementations
case $1 in
thumb*)
xargo build --features c --target $1 --bin intrinsics --release
;;
*)
cargo build --features c --target $1 --bin intrinsics --release
;;
esac
# Look out for duplicated symbols when we include the compiler-rt (C) implementation # Look out for duplicated symbols when we include the compiler-rt (C) implementation
PREFIX=$(echo $1 | sed -e 's/unknown-//')- PREFIX=$(echo $1 | sed -e 's/unknown-//')-
case $1 in case $1 in

View File

@ -302,52 +302,70 @@ mod intrinsics {
#[cfg(feature = "c")] #[cfg(feature = "c")]
fn run() { fn run() {
use core::ptr;
use intrinsics::*; use intrinsics::*;
aeabi_d2f(2.); // We use volatile load/stores to prevent LLVM from optimizing away the intrinsics during LTO
aeabi_d2i(2.); macro_rules! arg {
aeabi_d2l(2.); () => {
aeabi_d2uiz(2.); unsafe {
aeabi_d2ulz(2.); ptr::read_volatile(0x0 as *const _)
aeabi_dadd(2., 3.); }
aeabi_dcmpeq(2., 3.); }
aeabi_dcmpgt(2., 3.); }
aeabi_dcmplt(2., 3.);
aeabi_ddiv(2., 3.); macro_rules! ret {
aeabi_dmul(2., 3.); ($e:expr) => {
aeabi_dsub(2., 3.); unsafe {
aeabi_f2d(2.); ptr::write_volatile(0x0 as *mut _, $e)
aeabi_f2iz(2.); }
aeabi_f2lz(2.); }
aeabi_f2uiz(2.); }
aeabi_f2ulz(2.);
aeabi_fadd(2., 3.); ret!(aeabi_d2f(arg!()));
aeabi_fcmpeq(2., 3.); ret!(aeabi_d2i(arg!()));
aeabi_fcmpgt(2., 3.); ret!(aeabi_d2l(arg!()));
aeabi_fcmplt(2., 3.); ret!(aeabi_d2uiz(arg!()));
aeabi_fdiv(2., 3.); ret!(aeabi_d2ulz(arg!()));
aeabi_fmul(2., 3.); ret!(aeabi_dadd(arg!(), arg!()));
aeabi_fsub(2., 3.); ret!(aeabi_dcmpeq(arg!(), arg!()));
aeabi_i2d(2); ret!(aeabi_dcmpgt(arg!(), arg!()));
aeabi_i2f(2); ret!(aeabi_dcmplt(arg!(), arg!()));
aeabi_idiv(2, 3); ret!(aeabi_ddiv(arg!(), arg!()));
aeabi_idivmod(2, 3); ret!(aeabi_dmul(arg!(), arg!()));
aeabi_l2d(2); ret!(aeabi_dsub(arg!(), arg!()));
aeabi_l2f(2); ret!(aeabi_f2d(arg!()));
aeabi_ldivmod(2, 3); ret!(aeabi_f2iz(arg!()));
aeabi_lmul(2, 3); ret!(aeabi_f2lz(arg!()));
aeabi_ui2d(2); ret!(aeabi_f2uiz(arg!()));
aeabi_ui2f(2); ret!(aeabi_f2ulz(arg!()));
aeabi_uidiv(2, 3); ret!(aeabi_fadd(arg!(), arg!()));
aeabi_uidivmod(2, 3); ret!(aeabi_fcmpeq(arg!(), arg!()));
aeabi_ul2d(2); ret!(aeabi_fcmpgt(arg!(), arg!()));
aeabi_ul2f(2); ret!(aeabi_fcmplt(arg!(), arg!()));
aeabi_uldivmod(2, 3); ret!(aeabi_fdiv(arg!(), arg!()));
moddi3(2, 3); ret!(aeabi_fmul(arg!(), arg!()));
mulodi4(2, 3); ret!(aeabi_fsub(arg!(), arg!()));
powidf2(2., 3); ret!(aeabi_i2d(arg!()));
powisf2(2., 3); ret!(aeabi_i2f(arg!()));
umoddi3(2, 3); ret!(aeabi_idiv(arg!(), arg!()));
ret!(aeabi_idivmod(arg!(), arg!()));
ret!(aeabi_l2d(arg!()));
ret!(aeabi_l2f(arg!()));
ret!(aeabi_ldivmod(arg!(), arg!()));
ret!(aeabi_lmul(arg!(), arg!()));
ret!(aeabi_ui2d(arg!()));
ret!(aeabi_ui2f(arg!()));
ret!(aeabi_uidiv(arg!(), arg!()));
ret!(aeabi_uidivmod(arg!(), arg!()));
ret!(aeabi_ul2d(arg!()));
ret!(aeabi_ul2f(arg!()));
ret!(aeabi_uldivmod(arg!(), arg!()));
ret!(moddi3(arg!(), arg!()));
ret!(mulodi4(arg!(), arg!()));
ret!(powidf2(arg!(), arg!()));
ret!(powisf2(arg!(), arg!()));
ret!(umoddi3(arg!(), arg!()));
} }
#[cfg(all(feature = "c", not(thumb)))] #[cfg(all(feature = "c", not(thumb)))]