Jorge Aparicio 8 жил өмнө
parent
commit
e05caa1227

+ 3 - 1
ci/run.sh

@@ -1,4 +1,6 @@
-set -e
+set -ex
+
+export RUST_BACKTRACE=1
 
 
 # Test our implementation
 # Test our implementation
 case $1 in
 case $1 in

+ 2 - 1
src/bin/intrinsics.rs

@@ -7,6 +7,7 @@
 #![cfg_attr(thumb, no_main)]
 #![cfg_attr(thumb, no_main)]
 #![deny(dead_code)]
 #![deny(dead_code)]
 #![feature(asm)]
 #![feature(asm)]
+#![feature(compiler_builtins_lib)]
 #![feature(core_float)]
 #![feature(core_float)]
 #![feature(lang_items)]
 #![feature(lang_items)]
 #![feature(libc)]
 #![feature(libc)]
@@ -15,7 +16,7 @@
 
 
 #[cfg(not(thumb))]
 #[cfg(not(thumb))]
 extern crate libc;
 extern crate libc;
-extern crate rustc_builtins;
+extern crate compiler_builtins;
 
 
 // NOTE cfg(not(thumbv6m)) means that the operation is not supported on ARMv6-M at all. Not even
 // NOTE cfg(not(thumbv6m)) means that the operation is not supported on ARMv6-M at all. Not even
 // compiler-rt provides a C/assembly implementation.
 // compiler-rt provides a C/assembly implementation.

+ 6 - 1
src/int/sdiv.rs

@@ -43,7 +43,12 @@ macro_rules! divmod {
                 fn $div(a: $ty, b: $ty) -> $ty;
                 fn $div(a: $ty, b: $ty) -> $ty;
             }
             }
 
 
-            let r = unsafe { $div(a, b) };
+            let r = match () {
+                #[cfg(not(all(feature = "c", any(target_arch = "x86"))))]
+                () => $div(a, b),
+                #[cfg(all(feature = "c", any(target_arch = "x86")))]
+                () => unsafe { $div(a, b) },
+            };
             *rem = a - (r * b);
             *rem = a - (r * b);
             r
             r
         }
         }

+ 14 - 2
src/int/udiv.rs

@@ -65,7 +65,14 @@ pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 {
         fn __udivsi3(n: u32, d: u32) -> u32;
         fn __udivsi3(n: u32, d: u32) -> u32;
     }
     }
 
 
-    n - unsafe { __udivsi3(n, d) * d }
+    let q = match () {
+        #[cfg(all(feature = "c", target_arch = "arm", not(target_os = "ios")))]
+        () => unsafe { __udivsi3(n, d) },
+        #[cfg(not(all(feature = "c", target_arch = "arm", not(target_os = "ios"))))]
+        () => __udivsi3(n, d),
+    };
+
+    n - q * d
 }
 }
 
 
 /// Returns `n / d` and sets `*rem = n % d`
 /// Returns `n / d` and sets `*rem = n % d`
@@ -77,7 +84,12 @@ pub extern "C" fn __udivmodsi4(n: u32, d: u32, rem: Option<&mut u32>) -> u32 {
         fn __udivsi3(n: u32, d: u32) -> u32;
         fn __udivsi3(n: u32, d: u32) -> u32;
     }
     }
 
 
-    let q = unsafe { __udivsi3(n, d) };
+    let q = match () {
+        #[cfg(all(feature = "c", target_arch = "arm", not(target_os = "ios")))]
+        () => unsafe { __udivsi3(n, d) },
+        #[cfg(not(all(feature = "c", target_arch = "arm", not(target_os = "ios"))))]
+        () => __udivsi3(n, d),
+    };
     if let Some(rem) = rem {
     if let Some(rem) = rem {
         *rem = n - (q * d);
         *rem = n - (q * d);
     }
     }

+ 2 - 2
src/lib.rs

@@ -1,6 +1,6 @@
 #![cfg_attr(not(stage0), deny(warnings))]
 #![cfg_attr(not(stage0), deny(warnings))]
 #![cfg_attr(not(test), no_std)]
 #![cfg_attr(not(test), no_std)]
-#![compiler_builtins]
+#![cfg_attr(rustbuild, compiler_builtins)]
 #![crate_name = "compiler_builtins"]
 #![crate_name = "compiler_builtins"]
 #![crate_type = "rlib"]
 #![crate_type = "rlib"]
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
@@ -15,7 +15,7 @@
 #![feature(naked_functions)]
 #![feature(naked_functions)]
 #![feature(staged_api)]
 #![feature(staged_api)]
 #![no_builtins]
 #![no_builtins]
-#![unstable(feature = "compiler_builtins",
+#![unstable(feature = "compiler_builtins_lib",
             reason = "Compiler builtins. Will never become stable.",
             reason = "Compiler builtins. Will never become stable.",
             issue = "0")]
             issue = "0")]